Add auto notification setting

Alllow to automaticatilly send notification when device is online
This commit is contained in:
Luc
2019-09-08 10:48:28 +02:00
parent 46f2d27a7b
commit 7b2d4612df
6 changed files with 47 additions and 3 deletions

View File

@@ -1259,6 +1259,19 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
ESPCOM::print ( F ("\",\"H\":\"Notifications Settings\",\"M\":\""), output, espresponse);
ESPCOM::print ( (const char *) CONFIG::intTostr (MIN_NOTIFICATION_SETTINGS_LENGTH), output, espresponse);
ESPCOM::print ( F("\"}"), output, espresponse);
ESPCOM::println (F (","), output, espresponse);
//Auto Notification
ESPCOM::print (F ("{\"F\":\"network\",\"P\":\""), output, espresponse);
ESPCOM::print ( (const char *) CONFIG::intTostr (ESP_AUTO_NOTIFICATION), output, espresponse);
ESPCOM::print (F ("\",\"T\":\"B\",\"V\":\""), output, espresponse);
if (!CONFIG::read_byte (ESP_AUTO_NOTIFICATION, &bbuf ) ) {
ESPCOM::print ("???", output, espresponse);
} else {
ESPCOM::print ( (const char *) CONFIG::intTostr (bbuf), output, espresponse);
}
ESPCOM::print (F ("\",\"H\":\"Auto notification\",\"O\":[{\"No\":\"0\"},{\"Yes\":\"1\"}]}"), output, espresponse);
#endif //NOTIFICATION_FEATURE
}
@@ -1419,6 +1432,11 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
CONFIG::InitDHT(true);
}
#endif
#ifdef NOTIFICATION_FEATURE
if (pos == ESP_AUTO_NOTIFICATION) {
notificationsservice.setAutonotification ((bbuf == 0)? false: true);
}
#endif
#if defined(TIMESTAMP_FEATURE)
if ( (pos == EP_TIMEZONE) || (pos == EP_TIME_ISDST) || (pos == EP_TIME_SERVER1) || (pos == EP_TIME_SERVER2) || (pos == EP_TIME_SERVER3) ) {
CONFIG::init_time_client();