mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Merge pull request #531 from marsman7/master
Adding system scripts that are automatically executed when idle level is changed
This commit is contained in:
commit
71237c2702
@ -1357,10 +1357,19 @@ void dispatch_idle(const char*, const char* payload, uint8_t source)
|
|||||||
uint8_t state = HASP_SLEEP_LAST;
|
uint8_t state = HASP_SLEEP_LAST;
|
||||||
if(!strcmp_P(payload, "off")) {
|
if(!strcmp_P(payload, "off")) {
|
||||||
hasp_set_sleep_state(HASP_SLEEP_OFF);
|
hasp_set_sleep_state(HASP_SLEEP_OFF);
|
||||||
|
if(HASP_FS.exists("L:/idle_off.cmd")) {
|
||||||
|
dispatch_run_script(NULL, "L:/idle_off.cmd", TAG_HASP);
|
||||||
|
};
|
||||||
} else if(!strcmp_P(payload, "short")) {
|
} else if(!strcmp_P(payload, "short")) {
|
||||||
hasp_set_sleep_state(HASP_SLEEP_SHORT);
|
hasp_set_sleep_state(HASP_SLEEP_SHORT);
|
||||||
|
if(HASP_FS.exists("L:/idle_short.cmd")) {
|
||||||
|
dispatch_run_script(NULL, "L:/idle_short.cmd", TAG_HASP);
|
||||||
|
};
|
||||||
} else if(!strcmp_P(payload, "long")) {
|
} else if(!strcmp_P(payload, "long")) {
|
||||||
hasp_set_sleep_state(HASP_SLEEP_LONG);
|
hasp_set_sleep_state(HASP_SLEEP_LONG);
|
||||||
|
if(HASP_FS.exists("L:/idle_long.cmd")) {
|
||||||
|
dispatch_run_script(NULL, "L:/idle_long.cmd", TAG_HASP);
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
LOG_WARNING(TAG_MSGR, F("Invalid idle value %s"), payload);
|
LOG_WARNING(TAG_MSGR, F("Invalid idle value %s"), payload);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user