#:########################################################################################:# # TITLE: LAUNDRY BENCH PLUGS POWER AND SWITCH # zorruno.com layout v1.1 2026 #:########################################################################################:# # REPO: # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-laundryplugpow.yaml #:########################################################################################:# # VERSIONS: # V1.1 2026-03-11 Updated yaml to zorruno layout V1.1 # V1.0 2025-03-28 Initial Version #:########################################################################################:# # HARDWARE: # - Sonoff POW R1 # - ESP8266 based # - HLW8012 power monitoring # - Single relay output # - Blue status LED on GPIO15 # - Local push button on GPIO0 # - Relay output on GPIO12 # - Reference: https://devices.esphome.io/devices/Sonoff-POW-R1 #:########################################################################################:# # OPERATION NOTES: # - Monitors plug load current, voltage, and power # - Provides a virtual relay switch that controls the physical relay and LED together # - Local button toggles the virtual relay switch # - On boot, the virtual relay is turned ON # - "Load Running" turns ON when measured power is above 4 W # - "Load Running" uses delayed_off: 15s to avoid rapid state changes #:########################################################################################:# # OFFLINE NOTES: # a) Home Assistant offline (network and MQTT online): # - Device continues running normally # - Local button still works # - MQTT remains available if your common MQTT package is enabled and broker is reachable # # b) MQTT offline (or HA/MQTT offline): # - Device continues running locally # - Local button, relay control, LED control, and power monitoring still work # # c) Entire WiFi/Network offline: # - Device continues running locally # - Local button, relay control, LED control, and power monitoring still work # - Accurate time is not needed; SNTP is not required for operation #:########################################################################################:# #:########################################################################################:# # SUBSTITUTIONS: # Specific device variable substitutions # If NOT using a secrets file, just replace these with the passwords etc (in quotes) #:########################################################################################:# substitutions: # Device Naming device_name: "esp-laundryplugpow" friendly_name: "Laundry Bench Plug Power" description_comment: "Laundry Bench Plug Power and switch override using a Sonoff Pow R1. (Layout V1.1)" device_area: "Laundry" # Project Naming project_name: "Sonoff Technologies.POW R1" project_version: "v1.1" # Entity Naming entity_prefix: "Load" # Passwords and Secrets api_key: !secret esp-laundryplugpow_api_key ota_pass: !secret esp-laundryplugpow_ota_pass static_ip_address: !secret esp-laundryplugpow_ip current_ip_address: ${static_ip_address} # Device Settings log_level: "INFO" update_interval: "60s" #:########################################################################################:# # PACKAGES: # Included common packages # https://esphome.io/components/packages.html #:########################################################################################:# packages: #### WIFI, Network (Static/DHCP/IPV6 etc), Fallback AP, Safemode #### common_wifi: !include file: common/network_common.yaml vars: local_device_name: "${device_name}" local_static_ip_address: "${static_ip_address}" local_current_ip_address: "${current_ip_address}" local_ota_pass: "${ota_pass}" #### HOME ASSISTANT API (choose encryption or no encryption options) #### common_api: !include file: common/api_common.yaml # file: common/api_common_noencryption.yaml vars: local_api_key: "${api_key}" #### MQTT #### common_mqtt: !include file: common/mqtt_common.yaml vars: local_device_name: "${device_name}" #### WEB PORTAL #### # common_webportal: !include common/webportal_common.yaml #### SNTP (Only use if you want/need accurate timeclocks) #### # common_sntp: !include common/sntp_common.yaml #### DIAGNOSTICS Sensors #### diag_basic: !include common/include_basic_diag_sensors.yaml diag_more: !include common/include_more_diag_sensors.yaml # diag_debug: !include common/include_debug_diag_sensors.yaml # diag_resetcount: !include common/include_resetcount_diag_sensors.yaml #:########################################################################################:# # ESPHOME: # https://esphome.io/components/esphome.html #:########################################################################################:# esphome: name: "${device_name}" friendly_name: "${friendly_name}" comment: "${description_comment}" area: "${device_area}" project: name: "${project_name}" version: "${project_version}" on_boot: priority: 200 then: - switch.turn_on: virtual_button #:########################################################################################:# # ESP PLATFORM AND FRAMEWORK: # https://esphome.io/components/esp8266.html #:########################################################################################:# esp8266: board: esp01_1m early_pin_init: false board_flash_mode: dout #:########################################################################################:# # LOGGER: # https://esphome.io/components/logger.html #:########################################################################################:# logger: level: "${log_level}" # baud_rate: 0 # esp8266_store_log_strings_in_flash: false # tx_buffer_size: 64 #:########################################################################################:# # STATUS LED: # https://esphome.io/components/status_led.html #:########################################################################################:# # status_led: # pin: # number: GPIO2 # inverted: true #:########################################################################################:# # BINARY SENSORS: # https://esphome.io/components/binary_sensor/ #:########################################################################################:# binary_sensor: - platform: gpio pin: number: GPIO0 mode: INPUT_PULLUP inverted: true name: "Button" on_press: - switch.toggle: virtual_button - platform: template name: "${entity_prefix} Running" filters: - delayed_off: 15s lambda: |- if (isnan(id(power).state)) { return {}; } else if (id(power).state > 4) { return true; } else { return false; } #:########################################################################################:# # SENSORS: # https://esphome.io/components/sensor/ #:########################################################################################:# sensor: - platform: hlw8012 sel_pin: GPIO5 cf_pin: GPIO14 cf1_pin: GPIO13 update_interval: 2s current: name: "${entity_prefix} Current" voltage: name: "${entity_prefix} Voltage" power: name: "${entity_prefix} Power" id: power # on_value_range: # - above: 4.0 # then: # - light.turn_on: led # - below: 3.0 # then: # - light.turn_off: led #:########################################################################################:# # SWITCH: # https://esphome.io/components/switch/ #:########################################################################################:# switch: - platform: template name: "Relay" id: virtual_button optimistic: true turn_on_action: - switch.turn_on: relay - light.turn_on: led turn_off_action: - switch.turn_off: relay - light.turn_off: led - platform: gpio id: relay pin: GPIO12 # restore_mode: ALWAYS_ON #:########################################################################################:# # OUTPUT: # https://esphome.io/components/output/ #:########################################################################################:# output: - platform: esp8266_pwm id: pow_blue_led pin: number: GPIO15 inverted: true #:########################################################################################:# # LIGHT: # https://esphome.io/components/light/ #:########################################################################################:# light: - platform: monochromatic name: "Status LED" output: pow_blue_led id: led