From 23f6aff42cec7c9d536671a4666434bcd954af82 Mon Sep 17 00:00:00 2001 From: ESPHome Device Builder Date: Sun, 26 Jul 2026 17:36:20 +1200 Subject: [PATCH] Edit esp-loungebookshelfleds.yaml --- esphome/esp-loungebookshelfleds.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/esphome/esp-loungebookshelfleds.yaml b/esphome/esp-loungebookshelfleds.yaml index f879e92..7a6448c 100644 --- a/esphome/esp-loungebookshelfleds.yaml +++ b/esphome/esp-loungebookshelfleds.yaml @@ -6,6 +6,7 @@ # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-loungebookshelfleds.yaml #:########################################################################################:# # VERSIONS: +# V2.4 2026-07-26 Republish retained MQTT status whenever the broker reconnects # V2.3 2026-07-25 Standardized MQTT payloads: "ON"/"OFF" → "On"/"Off" # V2.2 2026-07-20 Simplified local MQTT command and status topics to the device root # V2.1 2026-03-11 Updated yaml to zorruno layout V1.1 @@ -86,7 +87,7 @@ substitutions: # Project Naming project_name: "Magichome Single Colour V1.1 LED Controller.Generic ESP8266" # Project details. Manufacturer before the dot, device after the dot. - project_version: "v2.3" # Project version denotes release of the YAML file, allowing checking of deployed vs latest version + project_version: "v2.4" # Project version denotes release of the YAML file, allowing checking of deployed vs latest version # Passwords & Secrets (Unfortunately, you can't use substitutions inside secret names) api_key: !secret esp-api_key # If using HA API @@ -350,6 +351,16 @@ status_led: # This adds device-specific MQTT command triggers to the common MQTT configuration. #:########################################################################################:# mqtt: + on_connect: + then: + - mqtt.publish: + topic: "${mqtt_local_status_topic}" + payload: !lambda |- + return id(mosfet_leds).current_values.is_on() + ? "${mqtt_local_device_command_ON}" + : "${mqtt_local_device_command_OFF}"; + retain: true + on_message: # Light control to ramp up - topic: "${mqtt_local_command_topic}"