Edit esp-centralstairs-bottom.yaml

This commit is contained in:
ESPHome Device Builder
2026-07-21 18:28:33 +12:00
parent 6dc9b56ff7
commit b9e9c98f7e
+33 -10
View File
@@ -6,6 +6,7 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-centralstairs-bottom.yaml # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-centralstairs-bottom.yaml
#:########################################################################################:# #:########################################################################################:#
# VERSIONS: # VERSIONS:
# V3.9 2026-07-21 Added retained MQTT status mirroring for HA-independent two-way switching
# V3.8 2026-06-09 Added Downstairs Lights Bulk Activation virtual switch toggled by Button 1 double-click # V3.8 2026-06-09 Added Downstairs Lights Bulk Activation virtual switch toggled by Button 1 double-click
# V3.7 2025-09-24 Upload to this device # V3.7 2025-09-24 Upload to this device
# V3.5 2025-07-24 YAML tidyups # V3.5 2025-07-24 YAML tidyups
@@ -83,7 +84,7 @@ substitutions:
# Project Naming # Project Naming
project_name: "Zemismart Technologies.KS-811 Double" # Project Details project_name: "Zemismart Technologies.KS-811 Double" # Project Details
project_version: "v2.1" # Project V denotes release of yaml file, allowing checking of deployed vs latest version project_version: "v3.9" # Project V denotes release of yaml file, allowing checking of deployed vs latest version
# MQTT Controls # MQTT Controls
mqtt_command_main_topic: !secret mqtt_command_main_topic mqtt_command_main_topic: !secret mqtt_command_main_topic
@@ -184,19 +185,19 @@ mqtt:
then: then:
- if: - if:
condition: condition:
lambda: 'return id(Relay_1).state;' lambda: "return id(Relay_1).state;"
then: then:
- mqtt.publish: - mqtt.publish:
topic: "${mqtt_status_topic_1}" topic: "${mqtt_status_topic_1}"
payload: "${mqtt_command_ON}" payload: "${mqtt_command_ON}"
qos: 0 qos: 1
retain: false retain: true
else: else:
- mqtt.publish: - mqtt.publish:
topic: "${mqtt_status_topic_1}" topic: "${mqtt_status_topic_1}"
payload: "${mqtt_command_OFF}" payload: "${mqtt_command_OFF}"
qos: 0 qos: 1
retain: false retain: true
on_message: on_message:
# Relay 1: only turn ON if currently OFF # Relay 1: only turn ON if currently OFF
@@ -241,6 +242,26 @@ mqtt:
then: then:
- switch.turn_off: Relay_2 - switch.turn_off: Relay_2
# Relay 2 is a mirror of the remote physical Stair Footer Lights relay.
- topic: "${mqtt_status_topic_2}"
payload: "${mqtt_command_ON}"
then:
- if:
condition:
not:
- switch.is_on: Relay_2
then:
- switch.turn_on: Relay_2
- topic: "${mqtt_status_topic_2}"
payload: "${mqtt_command_OFF}"
then:
- if:
condition:
- switch.is_on: Relay_2
then:
- switch.turn_off: Relay_2
#:########################################################################################:# #:########################################################################################:#
# STATUS LED: # STATUS LED:
# https://esphome.io/components/status_led.html # https://esphome.io/components/status_led.html
@@ -298,7 +319,7 @@ binary_sensor:
# Toggle the remote Footer Lights via COMMAND topic, based on our mirrored state # Toggle the remote Footer Lights via COMMAND topic, based on our mirrored state
- if: - if:
condition: condition:
lambda: 'return id(Relay_2).state;' lambda: "return id(Relay_2).state;"
then: then:
- mqtt.publish: - mqtt.publish:
topic: "${mqtt_command_topic_2}" topic: "${mqtt_command_topic_2}"
@@ -332,15 +353,17 @@ switch:
- mqtt.publish: - mqtt.publish:
topic: "${mqtt_status_topic_1}" topic: "${mqtt_status_topic_1}"
payload: "${mqtt_command_ON}" payload: "${mqtt_command_ON}"
retain: false qos: 1
retain: true
on_turn_off: on_turn_off:
- mqtt.publish: - mqtt.publish:
topic: "${mqtt_status_topic_1}" topic: "${mqtt_status_topic_1}"
payload: "${mqtt_command_OFF}" payload: "${mqtt_command_OFF}"
retain: false qos: 1
retain: true
- platform: gpio - platform: gpio
name: "Relay 2: ${switch_2_name}" name: "Relay 2: ${switch_2_name}"
pin: GPIO12 pin: GPIO12
id: Relay_2 id: Relay_2
# No mqtt.publish here (this is a mirror only) # No mqtt.publish here (this is a mirror only)