Skip to content

Commit

Permalink
Merge pull request #531 from marsman7/master
Browse files Browse the repository at this point in the history
Adding system scripts that are automatically executed when idle level is changed
  • Loading branch information
fvanroie authored Aug 25, 2023
2 parents 5aceb04 + 4ae1e66 commit 71237c2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/hasp/hasp_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,10 +1357,19 @@ void dispatch_idle(const char*, const char* payload, uint8_t source)
uint8_t state = HASP_SLEEP_LAST;
if(!strcmp_P(payload, "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")) {
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")) {
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 {
LOG_WARNING(TAG_MSGR, F("Invalid idle value %s"), payload);
return;
Expand Down

0 comments on commit 71237c2

Please sign in to comment.