Edit esp-reterminal-e1001.yaml

This commit is contained in:
ESPHome Device Builder
2026-08-02 16:27:18 +12:00
parent ed4758f1c8
commit ed59a3c62c
+28 -18
View File
@@ -1251,7 +1251,8 @@ interval:
#:########################################################################################:# #:########################################################################################:#
# MQTT COMMANDS: # MQTT COMMANDS:
# Retained On/ON allows sleep; retained Off/OFF prevents sleep for OTA/development. # Retained ON allows sleep; retained OFF prevents sleep for OTA/development.
# Payload matching is case-insensitive.
# This extends common/mqtt_common.yaml with device-specific subscriptions. # This extends common/mqtt_common.yaml with device-specific subscriptions.
#:########################################################################################:# #:########################################################################################:#
mqtt: mqtt:
@@ -1259,24 +1260,33 @@ mqtt:
on_message: on_message:
- topic: "${mqtt_command_topic}/deepsleep" - topic: "${mqtt_command_topic}/deepsleep"
payload: "On"
then: then:
- script.execute: apply_sleep_allowed - if:
condition:
- topic: "${mqtt_command_topic}/deepsleep" lambda: |-
payload: "ON" std::string command = x;
then: for (char &character : command) {
- script.execute: apply_sleep_allowed if (character >= 'A' && character <= 'Z') character += 'a' - 'A';
}
- topic: "${mqtt_command_topic}/deepsleep" return command == "on";
payload: "Off" then:
then: - script.execute: apply_sleep_allowed
- script.execute: apply_sleep_prevented else:
- if:
- topic: "${mqtt_command_topic}/deepsleep" condition:
payload: "OFF" lambda: |-
then: std::string command = x;
- script.execute: apply_sleep_prevented for (char &character : command) {
if (character >= 'A' && character <= 'Z') character += 'a' - 'A';
}
return command == "off";
then:
- script.execute: apply_sleep_prevented
else:
- logger.log:
level: WARN
format: "Ignoring invalid deep-sleep MQTT payload: %s"
args: ["x.c_str()"]
#:########################################################################################:# #:########################################################################################:#
# DEEP SLEEP: # DEEP SLEEP: