Edit esp-reterminal-e1001.yaml
This commit is contained in:
@@ -1251,7 +1251,8 @@ interval:
|
||||
|
||||
#:########################################################################################:#
|
||||
# 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.
|
||||
#:########################################################################################:#
|
||||
mqtt:
|
||||
@@ -1259,24 +1260,33 @@ mqtt:
|
||||
|
||||
on_message:
|
||||
- topic: "${mqtt_command_topic}/deepsleep"
|
||||
payload: "On"
|
||||
then:
|
||||
- script.execute: apply_sleep_allowed
|
||||
|
||||
- topic: "${mqtt_command_topic}/deepsleep"
|
||||
payload: "ON"
|
||||
then:
|
||||
- script.execute: apply_sleep_allowed
|
||||
|
||||
- topic: "${mqtt_command_topic}/deepsleep"
|
||||
payload: "Off"
|
||||
then:
|
||||
- script.execute: apply_sleep_prevented
|
||||
|
||||
- topic: "${mqtt_command_topic}/deepsleep"
|
||||
payload: "OFF"
|
||||
then:
|
||||
- script.execute: apply_sleep_prevented
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
std::string command = x;
|
||||
for (char &character : command) {
|
||||
if (character >= 'A' && character <= 'Z') character += 'a' - 'A';
|
||||
}
|
||||
return command == "on";
|
||||
then:
|
||||
- script.execute: apply_sleep_allowed
|
||||
else:
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
std::string command = x;
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user