Edit esp-officeduallights.yaml

This commit is contained in:
ESPHome Device Builder
2026-09-13 11:18:37 +12:00
parent 25e73750dc
commit 2c22e6c07f
+25 -10
View File
@@ -6,6 +6,8 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-officeduallights.yaml # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-officeduallights.yaml
#:########################################################################################:# #:########################################################################################:#
# VERSIONS: # VERSIONS:
# V3.0 2026-09-12 Makes HA the primary Office synchronizer. Direct MQTT peer synchronization
# runs only while HA's native API state subscription is disconnected.
# V2.9 2026-08-16 Makes this physical relay the sole overhead status authority. Removes the # V2.9 2026-08-16 Makes this physical relay the sole overhead status authority. Removes the
# bidirectional shared retained-status topic that could chatter during reconnects. # bidirectional shared retained-status topic that could chatter during reconnects.
# V2.8 2026-07-25 Added 2-way MQTT sync with esp-officelights (office main lightswitch). # V2.8 2026-07-25 Added 2-way MQTT sync with esp-officelights (office main lightswitch).
@@ -93,7 +95,7 @@ substitutions:
# Project Naming # Project Naming
project_name: "Sonoff Technologies.Sonoff Dual R1" project_name: "Sonoff Technologies.Sonoff Dual R1"
project_version: "v2.9" project_version: "v3.0"
# Passwords and Secrets # Passwords and Secrets
api_key: !secret esp-api_key api_key: !secret esp-api_key
@@ -311,16 +313,19 @@ mqtt:
id(relay_2_timer_script)->execute(timer_seconds * 1000); id(relay_2_timer_script)->execute(timer_seconds * 1000);
# Mirror remote bunker command from esp-officelights onto light_1, but only if a real # MQTT peer synchronization is the HA-down fallback. When HA is connected it is the
# state change is needed. Do not republish the command from here. Relay status is # sole synchronizer, so remote MQTT commands must not change either physical relay.
# published by the relay callback below.
- topic: "${mqtt_mainlight_command_bunker}" - topic: "${mqtt_mainlight_command_bunker}"
payload: "${mqtt_command_on}" payload: "${mqtt_command_on}"
then: then:
- script.stop: relay_1_timer_script - script.stop: relay_1_timer_script
- if: - if:
condition: condition:
lambda: "return !id(relay_1).state;" and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return !id(relay_1).state;"
then: then:
- light.turn_on: light_1 - light.turn_on: light_1
@@ -330,19 +335,25 @@ mqtt:
- script.stop: relay_1_timer_script - script.stop: relay_1_timer_script
- if: - if:
condition: condition:
lambda: "return id(relay_1).state;" and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return id(relay_1).state;"
then: then:
- light.turn_off: light_1 - light.turn_off: light_1
# Mirror remote overhead command from esp-officelights onto light_2, but only if a real
# state change is needed.
- topic: "${mqtt_mainlight_command_overhead}" - topic: "${mqtt_mainlight_command_overhead}"
payload: "${mqtt_command_on}" payload: "${mqtt_command_on}"
then: then:
- script.stop: relay_2_timer_script - script.stop: relay_2_timer_script
- if: - if:
condition: condition:
lambda: "return !id(relay_2).state;" and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return !id(relay_2).state;"
then: then:
- light.turn_on: light_2 - light.turn_on: light_2
@@ -352,7 +363,11 @@ mqtt:
- script.stop: relay_2_timer_script - script.stop: relay_2_timer_script
- if: - if:
condition: condition:
lambda: "return id(relay_2).state;" and:
- not:
api.connected:
state_subscription_only: true
- lambda: "return id(relay_2).state;"
then: then:
- light.turn_off: light_2 - light.turn_off: light_2