Edit esp-officeusbhubpower.yaml
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-officeusbhubpower.yaml
|
||||
#:########################################################################################:#
|
||||
# VERSIONS:
|
||||
# V1.4 2026-07-26 Added retained relay status and reconnect republishing
|
||||
# V1.3 2026-07-25 Standardized MQTT payloads: "ON"/"OFF" → "On"/"Off"
|
||||
# V1.2 2026-07-20 Simplified local MQTT command and status topics to the device root
|
||||
# V1.1 2026-02-25 Updated yaml to zorruno layout V1.1
|
||||
@@ -24,10 +25,10 @@
|
||||
#:########################################################################################:#
|
||||
# MQTT COMMANDS:
|
||||
# Command (set relay):
|
||||
# - ${mqtt_command_topic} -> ON, OFF
|
||||
# - ${mqtt_command_topic} -> On, Off
|
||||
#
|
||||
# Status (published from template sensor):
|
||||
# - ${mqtt_status_topic} -> ON, OFF
|
||||
# - ${mqtt_status_topic} -> On, Off (retained)
|
||||
#:########################################################################################:#
|
||||
# OFFLINE NOTES:
|
||||
# a) Home Assistant OFFLINE, but Network and MQTT ONLINE
|
||||
@@ -56,7 +57,7 @@ substitutions:
|
||||
|
||||
# Project Naming
|
||||
project_name: "Sonoff Technologies.Sonoff Basic V1"
|
||||
project_version: "v1.3"
|
||||
project_version: "v1.4"
|
||||
|
||||
# Passwords & Secrets (Unfortunately, you cannot use substitutions inside secret names)
|
||||
api_key: !secret esp-api_key
|
||||
@@ -169,6 +170,16 @@ switch:
|
||||
id: relay1
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
icon: "${relay_icon}"
|
||||
on_turn_on:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_status_topic}"
|
||||
payload: "On"
|
||||
retain: true
|
||||
on_turn_off:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_status_topic}"
|
||||
payload: "Off"
|
||||
retain: true
|
||||
|
||||
#:########################################################################################:#
|
||||
# BINARY SENSORS:
|
||||
@@ -201,16 +212,6 @@ binary_sensor:
|
||||
name: "${relay_1_name} Status"
|
||||
lambda: |-
|
||||
return id(relay1).state;
|
||||
on_press:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_status_topic}"
|
||||
payload: "On"
|
||||
retain: false
|
||||
on_release:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_status_topic}"
|
||||
payload: "Off"
|
||||
retain: false
|
||||
|
||||
#:########################################################################################:#
|
||||
# STATUS LED:
|
||||
@@ -228,6 +229,14 @@ status_led:
|
||||
# https://esphome.io/components/mqtt.html
|
||||
#:########################################################################################:#
|
||||
mqtt:
|
||||
on_connect:
|
||||
then:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_status_topic}"
|
||||
payload: !lambda |-
|
||||
return id(relay1).state ? "On" : "Off";
|
||||
retain: true
|
||||
|
||||
on_message:
|
||||
- topic: "${mqtt_command_topic}"
|
||||
payload: "On"
|
||||
|
||||
Reference in New Issue
Block a user