substitutions: device_name: fountain_outside device_description: Energy Monitoring Smart Plug with button, blue LED, and red LED. friendly_name: Fountain Outside esphome: name: ${device_name} platform: ESP8266 board: esp01_1m wifi: ssid: kungle-ot password: ThingsWelcomeToKungle manual_ip: static_ip: 192.168.37.72 gateway: 192.168.37.1 subnet: 255.255.255.0 # Enable logging logger: # Enable Home Assistant API api: ota: # Enable web server # web_server: # port: 80 # Enable time component for use by daily power sensor time: - platform: homeassistant id: homeassistant_time binary_sensor: - platform: gpio pin: number: GPIO1 mode: INPUT_PULLUP inverted: True name: ${friendly_name} button on_multi_click: - timing: - ON for at most 1s - OFF for at most 1s - ON for at most 1s - OFF for at least 0.2s then: - logger.log: "Double Clicked" - switch.toggle: relay2 - timing: - ON for 1s to 2s - OFF for at least 0.5s then: - logger.log: "Single Long Clicked" - timing: - ON for at most 1s - OFF for at least 0.5s then: - logger.log: "Single Short Clicked" - switch.toggle: relay1 switch: - platform: gpio name: ${friendly_name} relay pin: GPIO12 id: relay1 - platform: gpio name: ${friendly_name} Light relay pin: GPIO14 id: relay2 status_led: pin: number: GPIO3 # inverted: yes sensor: - platform: wifi_signal name: ${friendly_name} WiFi signal update_interval: 60s - platform: uptime name: ${friendly_name} uptime # Reports the Current, Voltage, and Power used by the plugged-in device (not counting this plug's own usage of about 0.7W/0.02A, so subtract those when calibrating with this plugged into a Kill-A-Watt type meter) - platform: hlw8012 sel_pin: number: GPIO13 inverted: True cf_pin: GPIO4 cf1_pin: GPIO5 current_resistor: 0.001 #The value of the shunt resistor for current measurement. Defaults to the Sonoff POW’s value 0.001 ohm. Verified on https://fccid.io/2AKBP-X10S/Internal-Photos/X10S-Int-photo-4308983 that we use "R001" = 0.001 ohm voltage_divider: 2351 #The value of the voltage divider on the board as (R_upstream + R_downstream) / R_downstream. Defaults to the Sonoff POW’s value 2351. From the pic we use 2x "125" = 2x 1.2Mohm for R_upstream and "102" = 1kohm for R_downstream, so (1,200,000+1,200,000+1,000)/1,000 = 2401 # but those don't fix the measurement values, probably because we actually have a BL0937 chip instead of a HLW8012, (and part variance aswell) so we have to manually calibrate with a known load or a load and a Kill-A-Watt type meter. My values used below will only be +/-10% of yours I think. # The comments about the voltage divider were taken from the AWP04L template. I was unable to verify the voltage divider in the Aoycocr X10S plug. power: name: ${friendly_name} Power unit_of_measurement: W id: wattage filters: - calibrate_linear: # Map 0.0 (from sensor) to 0.0 (true value) - 0.0 -> 0.0 #Need to keep 0 mapped to 0 for when connected device is not drawing any power - 1379.1 -> 200.0 # Tested outdoor fountain pump via Kill-A-Watt - 2816.9 -> 411.0 # Tested blow-dryer low via Kill-A-Watt - 9250.6 -> 1341.0 # Tested water boiler via Kill-A-Watt - 10736.7 -> 1562.0 # Tested blow-dryer high via Kill-A-Watt current: name: ${friendly_name} Current unit_of_measurement: A filters: - calibrate_linear: # Map 0.0 (from sensor) to 0.0 (true value) - 0.0 -> 0.0 #Need to keep 0 mapped to 0 for when connected device is not drawing any power - 2.07 -> 1.67 # Tested outdoor fountain pump via Kill-A-Watt - 4.18 -> 3.41 # Tested blow-dryer low via Kill-A-Watt - 14.37 -> 11.64 # Tested water boiler via Kill-A-Watt - 16.26 -> 13.12 # Tested blow-dryer high via Kill-A-Watt voltage: name: ${friendly_name} Voltage unit_of_measurement: V filters: - calibrate_linear: # Map 0.0 (from sensor) to 0.0 (true value) - 0.0 -> 0.0 - 355.9 -> 120.6 #Tested using a Kill-A-Watt meter, value while connected LED bulb was on # change_mode_every: 3 # 1 - Skips first reading after each change, so this will double the update interval. Default 8 # update_interval: 3s # 10s - 20 second effective update rate for Power, 40 second for Current and Voltage. Default 60s # Reports the total Power so-far each day, resets at midnight, see https://esphome.io/components/sensor/total_daily_energy.html - platform: total_daily_energy name: ${friendly_name} Total Daily Energy power_id: wattage filters: - multiply: 0.001 ## convert Wh to kWh unit_of_measurement: kWh text_sensor: - platform: version name: "Fountain 1 ESPHome version"