Edit esp-officeduallights.yaml

This commit is contained in:
ESPHome Device Builder
2026-07-25 13:08:53 +12:00
parent 5891df3c45
commit 37faf62809
+19
View File
@@ -124,6 +124,12 @@ substitutions:
mqtt_mainlight_function_overhead: "office-main-lights-right" mqtt_mainlight_function_overhead: "office-main-lights-right"
mqtt_mainlight_command_overhead: "${mqtt_command_main_topic}/${mqtt_mainlight_function_overhead}" mqtt_mainlight_command_overhead: "${mqtt_command_main_topic}/${mqtt_mainlight_function_overhead}"
# MQTT Overhead Status - shared topic for overhead state sync
# Both this device and esp-officelights publish and subscribe to this topic so
# whichever device's timer finishes first keeps the other in sync.
mqtt_shared_overhead_status_function: "office-overhead-status"
mqtt_shared_overhead_status_topic: "${mqtt_status_main_topic}/${mqtt_shared_overhead_status_function}"
# MQTT Status/Command payloads # MQTT Status/Command payloads
mqtt_command_on: "On" mqtt_command_on: "On"
mqtt_command_off: "Off" mqtt_command_off: "Off"
@@ -231,6 +237,11 @@ mqtt:
payload: !lambda |- payload: !lambda |-
return id(relay_2).state ? "${mqtt_command_on}" : "${mqtt_command_off}"; return id(relay_2).state ? "${mqtt_command_on}" : "${mqtt_command_off}";
retain: true retain: true
- mqtt.publish:
topic: "${mqtt_shared_overhead_status_topic}"
payload: !lambda |-
return id(relay_2).state ? "${mqtt_command_on}" : "${mqtt_command_off}";
retain: true
on_message: on_message:
- topic: "${mqtt_local_command1_topic}" - topic: "${mqtt_local_command1_topic}"
@@ -465,6 +476,10 @@ switch:
topic: "${mqtt_local_status2_topic}" topic: "${mqtt_local_status2_topic}"
payload: "On" payload: "On"
retain: true retain: true
- mqtt.publish:
topic: "${mqtt_shared_overhead_status_topic}"
payload: "On"
retain: true
- if: - if:
condition: condition:
switch.is_off: relay_1 switch.is_off: relay_1
@@ -477,6 +492,10 @@ switch:
topic: "${mqtt_local_status2_topic}" topic: "${mqtt_local_status2_topic}"
payload: "Off" payload: "Off"
retain: true retain: true
- mqtt.publish:
topic: "${mqtt_shared_overhead_status_topic}"
payload: "Off"
retain: true
- if: - if:
condition: condition:
switch.is_off: relay_1 switch.is_off: relay_1