Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: awp07l
- platform: ESP8266
- board: esp01_1m
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable logging
- logger:
- # Enable Home Assistant API
- api:
- # Enable over-the-air updates
- ota:
- # Enable Web server
- web_server:
- port: 80
- sensor:
- # Power sensor
- - platform: hlw8012
- sel_pin:
- number: GPIO12
- inverted: true
- cf_pin: GPIO05
- cf1_pin: GPIO14
- update_interval: 1s
- # Current sensor
- current:
- name: current
- unit_of_measurement: A
- accuracy_decimals: 3
- filters:
- - median:
- window_size: 5
- send_every: 5
- send_first_at: 1
- - calibrate_linear:
- - 0.0 -> 0.0
- - 0.06518 -> 0.051
- - 0.21003 -> 0.175
- # plug uses 0.010A when turned off and ~0.013A when on
- - lambda: if (id(relay).state) return (x+0.013); else return 0.010;
- # Voltage sensor
- voltage:
- name: voltage
- unit_of_measurement: V
- accuracy_decimals: 1
- filters:
- - median:
- window_size: 5
- send_every: 5
- send_first_at: 1
- - calibrate_linear:
- - 0.0 -> 0.0
- - 574.74725 -> 231.0
- - 576.38177 -> 231.3
- - 577.81201 -> 231.8
- - 580.05951 -> 232.6
- # Power sensor
- power:
- id: power
- name: power
- unit_of_measurement: W
- accuracy_decimals: 1
- filters:
- - median:
- window_size: 5
- send_every: 5
- send_first_at: 1
- - calibrate_linear:
- - 0.0 -> 0.0
- - 36.20264 -> 6.7
- - 232.73126 -> 40.7
- # plug uses 0.9W when turned off and ~1.3W when on
- - lambda: if (id(relay).state) return (x+1.25); else return 0.9;
- binary_sensor:
- # Binary sensor for the button press
- - platform: gpio
- name: button
- pin:
- number: GPIO13
- inverted: true
- on_press:
- - switch.toggle: relay
- switch:
- # Switch to toggle the relay
- - platform: gpio
- id: relay
- name: switch
- pin: GPIO15
- on_turn_on:
- - light.turn_on: led
- on_turn_off:
- - light.turn_off: led
- output:
- # Relay state led
- - platform: esp8266_pwm
- id: state_led
- pin:
- number: GPIO00
- inverted: true
- light:
- # Relay state light
- - platform: monochromatic
- output: state_led
- id: led
- # Uses the red LED as a status indicator
- status_led:
- pin:
- number: GPIO02
- inverted: true
RAW Paste Data