Guest User

AWP07L

a guest
Apr 8th, 2020
373
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. esphome:
  2.   name: awp07l
  3.   platform: ESP8266
  4.   board: esp01_1m
  5.  
  6. wifi:
  7.   ssid: !secret wifi_ssid
  8.   password: !secret wifi_password
  9.  
  10. # Enable logging
  11. logger:
  12. # Enable Home Assistant API
  13. api:
  14. # Enable over-the-air updates
  15. ota:
  16. # Enable Web server
  17. web_server:
  18.   port: 80
  19.  
  20. sensor:
  21.  # Power sensor
  22.   - platform: hlw8012
  23.     sel_pin:
  24.       number: GPIO12
  25.       inverted: true
  26.     cf_pin: GPIO05
  27.     cf1_pin: GPIO14
  28.     update_interval: 1s
  29.     # Current sensor
  30.     current:
  31.       name: current
  32.       unit_of_measurement: A
  33.       accuracy_decimals: 3
  34.       filters:
  35.         - median:
  36.             window_size: 5
  37.             send_every: 5
  38.             send_first_at: 1
  39.         - calibrate_linear:
  40.          - 0.0 -> 0.0
  41.           - 0.06518 -> 0.051
  42.           - 0.21003 -> 0.175
  43.         # plug uses 0.010A when turned off and ~0.013A when on
  44.         - lambda: if (id(relay).state) return (x+0.013); else return 0.010;
  45.     # Voltage sensor
  46.     voltage:
  47.       name: voltage
  48.       unit_of_measurement: V
  49.       accuracy_decimals: 1
  50.       filters:
  51.         - median:
  52.             window_size: 5
  53.             send_every: 5
  54.             send_first_at: 1
  55.         - calibrate_linear:
  56.          - 0.0 -> 0.0
  57.           - 574.74725 -> 231.0
  58.           - 576.38177 -> 231.3
  59.           - 577.81201 -> 231.8
  60.           - 580.05951 -> 232.6
  61.     # Power sensor
  62.     power:
  63.       id: power
  64.       name: power
  65.       unit_of_measurement: W
  66.       accuracy_decimals: 1
  67.       filters:
  68.         - median:
  69.             window_size: 5
  70.             send_every: 5
  71.             send_first_at: 1
  72.         - calibrate_linear:
  73.          - 0.0 -> 0.0
  74.           - 36.20264 -> 6.7
  75.           - 232.73126 -> 40.7
  76.         # plug uses 0.9W when turned off and ~1.3W when on
  77.         - lambda: if (id(relay).state) return (x+1.25); else return 0.9;
  78.  
  79. binary_sensor:
  80.  # Binary sensor for the button press
  81.   - platform: gpio
  82.     name: button
  83.     pin:
  84.       number: GPIO13
  85.       inverted: true
  86.     on_press:
  87.       - switch.toggle: relay
  88.  
  89. switch:
  90.  # Switch to toggle the relay
  91.   - platform: gpio
  92.     id: relay
  93.     name: switch
  94.     pin: GPIO15
  95.     on_turn_on:
  96.       - light.turn_on: led
  97.     on_turn_off:
  98.       - light.turn_off: led
  99.  
  100. output:
  101.  # Relay state led
  102.   - platform: esp8266_pwm
  103.     id: state_led
  104.     pin:
  105.       number: GPIO00
  106.       inverted: true
  107.  
  108. light:
  109.  # Relay state light
  110.   - platform: monochromatic
  111.     output: state_led
  112.     id: led
  113.  
  114. # Uses the red LED as a status indicator
  115. status_led:
  116.   pin:
  117.     number: GPIO02
  118.     inverted: true
RAW Paste Data