Edit esp-officelights.yaml

This commit is contained in:
ESPHome Device Builder
2026-09-13 11:18:12 +12:00
parent e205b0db67
commit 25e73750dc
+59 -10
View File
@@ -6,6 +6,8 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-officelights.yaml
#:########################################################################################:#
# VERSIONS:
# v3.2 2026-09-12 Makes HA the primary Office synchronizer. Direct MQTT peer synchronization
# runs only while HA's native API state subscription is disconnected.
# v3.1 2026-08-16 Makes the Sonoff Dual the sole overhead status authority. Removes the
# bidirectional shared retained-status topic that could chatter during reconnects.
# v3.0 2026-07-25 Refactored MQTT sync to use template HA switch actions; physical button and
@@ -81,7 +83,7 @@ substitutions:
# Project Naming
project_name: "Zemismart Technologies.KS-811 Triple"
project_version: "v3.1"
project_version: "v3.2"
# Passwords & Secrets
api_key: !secret esp-api_key
@@ -215,15 +217,18 @@ mqtt:
retain: true
on_message:
# Mirror remote overhead command onto virtual Relay_2, but only if a real state change
# is needed. Do not republish the command from here. Relay status is published by the
# relay callback below.
# MQTT peer synchronization is the HA-down fallback. When HA is connected it is the
# sole synchronizer, so remote MQTT state must not change this mirror.
- topic: "${mqtt_this_device_command_topic_overhead}"
payload: "${mqtt_command_on}"
then:
- if:
condition:
lambda: "return !id(Relay_2).state;"
and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return !id(Relay_2).state;"
then:
- switch.turn_on: Relay_2
@@ -232,7 +237,11 @@ mqtt:
then:
- if:
condition:
lambda: "return id(Relay_2).state;"
and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return id(Relay_2).state;"
then:
- switch.turn_off: Relay_2
@@ -244,7 +253,11 @@ mqtt:
then:
- if:
condition:
lambda: "return !id(Relay_2).state;"
and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return !id(Relay_2).state;"
then:
- switch.turn_on: Relay_2
@@ -253,7 +266,11 @@ mqtt:
then:
- if:
condition:
lambda: "return id(Relay_2).state;"
and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return id(Relay_2).state;"
then:
- switch.turn_off: Relay_2
@@ -265,7 +282,11 @@ mqtt:
then:
- if:
condition:
lambda: "return !id(Relay_1).state;"
and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return !id(Relay_1).state;"
then:
- switch.turn_on: Relay_1
@@ -274,7 +295,11 @@ mqtt:
then:
- if:
condition:
lambda: "return id(Relay_1).state;"
and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return id(Relay_1).state;"
then:
- switch.turn_off: Relay_1
@@ -341,6 +366,12 @@ script:
lambda: "return !id(Relay_1).state;"
then:
- switch.turn_on: Relay_1
- if:
condition:
not:
api.connected:
state_subscription_only: true
then:
- mqtt.publish:
topic: "${mqtt_this_device_command_topic_bunker}"
payload: "${mqtt_command_on}"
@@ -355,6 +386,12 @@ script:
lambda: "return id(Relay_1).state;"
then:
- switch.turn_off: Relay_1
- if:
condition:
not:
api.connected:
state_subscription_only: true
then:
- mqtt.publish:
topic: "${mqtt_this_device_command_topic_bunker}"
payload: "${mqtt_command_off}"
@@ -383,6 +420,12 @@ script:
lambda: "return !id(Relay_2).state;"
then:
- switch.turn_on: Relay_2
- if:
condition:
not:
api.connected:
state_subscription_only: true
then:
- mqtt.publish:
topic: "${mqtt_this_device_command_topic_overhead}"
payload: "${mqtt_command_on}"
@@ -397,6 +440,12 @@ script:
lambda: "return id(Relay_2).state;"
then:
- switch.turn_off: Relay_2
- if:
condition:
not:
api.connected:
state_subscription_only: true
then:
- mqtt.publish:
topic: "${mqtt_this_device_command_topic_overhead}"
payload: "${mqtt_command_off}"