mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 02:09:06 +08:00
Added support for IFTTT Webhook integration (#708)
* first push * modified post to work with IFTTT * working but returning wrong error code * command successfully being sent to, IFTTT * resolved issue with ESP600 returing "Wrong Command
This commit is contained in:
parent
c1733a83e5
commit
f80b247f38
37
.vscode/settings.json
vendored
37
.vscode/settings.json
vendored
@ -2,5 +2,42 @@
|
|||||||
"terminal.integrated.env.windows": {
|
"terminal.integrated.env.windows": {
|
||||||
"PATH": "C:\\Users\\user\\.platformio\\penv\\Scripts;C:\\Users\\user\\.platformio\\penv;C:\\ImageMagick\\ImageMagick-7.0.8-Q16;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Users\\user\\AppData\\Local\\GitHubDesktop\\bin;C:\\Eclipse\\GNUTools\\2.6-201507152002\\bin;C:\\Users\\user\\AppData\\Roaming\\npm;C:\\Users\\user\\AppData\\Local\\atom\\bin;C:\\Unxtools;;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps;C:\\ImageMagick\\ImageMagick-7.0.8-Q16;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Users\\user\\AppData\\Local\\GitHubDesktop\\bin;C:\\Eclipse\\GNUTools\\2.6-201507152002\\bin;C:\\Users\\user\\AppData\\Roaming\\npm;C:\\Users\\user\\AppData\\Local\\atom\\bin;C:\\Unxtools;;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps",
|
"PATH": "C:\\Users\\user\\.platformio\\penv\\Scripts;C:\\Users\\user\\.platformio\\penv;C:\\ImageMagick\\ImageMagick-7.0.8-Q16;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Users\\user\\AppData\\Local\\GitHubDesktop\\bin;C:\\Eclipse\\GNUTools\\2.6-201507152002\\bin;C:\\Users\\user\\AppData\\Roaming\\npm;C:\\Users\\user\\AppData\\Local\\atom\\bin;C:\\Unxtools;;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps;C:\\ImageMagick\\ImageMagick-7.0.8-Q16;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Users\\user\\AppData\\Local\\GitHubDesktop\\bin;C:\\Eclipse\\GNUTools\\2.6-201507152002\\bin;C:\\Users\\user\\AppData\\Roaming\\npm;C:\\Users\\user\\AppData\\Local\\atom\\bin;C:\\Unxtools;;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps",
|
||||||
"PLATFORMIO_CALLER": "vscode"
|
"PLATFORMIO_CALLER": "vscode"
|
||||||
|
},
|
||||||
|
"files.associations": {
|
||||||
|
"string": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"typeinfo": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1244,6 +1244,8 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (ESP_EMAIL_NOTIFICATION), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (ESP_EMAIL_NOTIFICATION), output, espresponse);
|
||||||
ESPCOM::print (F("\"},{\"Line\":\""), output, espresponse);
|
ESPCOM::print (F("\"},{\"Line\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (ESP_LINE_NOTIFICATION), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (ESP_LINE_NOTIFICATION), output, espresponse);
|
||||||
|
ESPCOM::print (F("\"},{\"IFTTT\":\""), output, espresponse);
|
||||||
|
ESPCOM::print ( (const char *) CONFIG::intTostr (ESP_IFTTT_NOTIFICATION), output, espresponse);
|
||||||
ESPCOM::print (F("\"}]}"), output, espresponse);
|
ESPCOM::print (F("\"}]}"), output, espresponse);
|
||||||
ESPCOM::println (F (","), output, espresponse);
|
ESPCOM::println (F (","), output, espresponse);
|
||||||
//Token 1
|
//Token 1
|
||||||
@ -1719,7 +1721,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//Set/Get Notification settings
|
//Set/Get Notification settings
|
||||||
//[ESP610]type=<NONE/PUSHOVER/EMAIL/LINE> T1=<token1> T2=<token2> TS=<Settings> [pwd=<admin password>]
|
//[ESP610]type=<NONE/PUSHOVER/EMAIL/LINE/IFTTT> T1=<token1> T2=<token2> TS=<Settings> [pwd=<admin password>]
|
||||||
//Get will give type and settings only not the protected T1/T2
|
//Get will give type and settings only not the protected T1/T2
|
||||||
case 610:
|
case 610:
|
||||||
#ifdef AUTHENTICATION_FEATURE
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
@ -1737,7 +1739,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
}
|
}
|
||||||
char sbuf[MAX_DATA_LENGTH + 1];
|
char sbuf[MAX_DATA_LENGTH + 1];
|
||||||
static String tmp;
|
static String tmp;
|
||||||
tmp = (Ntype == ESP_PUSHOVER_NOTIFICATION)?"PUSHOVER":(Ntype == ESP_EMAIL_NOTIFICATION)?"EMAIL":(Ntype == ESP_LINE_NOTIFICATION)?"LINE":"NONE";
|
tmp = (Ntype == ESP_PUSHOVER_NOTIFICATION)?"PUSHOVER":(Ntype == ESP_EMAIL_NOTIFICATION)?"EMAIL":(Ntype == ESP_LINE_NOTIFICATION)?"LINE":(Ntype == ESP_IFTTT_NOTIFICATION)?"IFTTT":"NONE";
|
||||||
if (CONFIG::read_string (ESP_NOTIFICATION_SETTINGS, sbuf, MAX_NOTIFICATION_SETTINGS_LENGTH) ) {
|
if (CONFIG::read_string (ESP_NOTIFICATION_SETTINGS, sbuf, MAX_NOTIFICATION_SETTINGS_LENGTH) ) {
|
||||||
tmp+= " ";
|
tmp+= " ";
|
||||||
tmp += sbuf;
|
tmp += sbuf;
|
||||||
@ -1758,6 +1760,8 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
Ntype = ESP_EMAIL_NOTIFICATION;
|
Ntype = ESP_EMAIL_NOTIFICATION;
|
||||||
} else if (parameter == "LINE") {
|
} else if (parameter == "LINE") {
|
||||||
Ntype = ESP_LINE_NOTIFICATION;
|
Ntype = ESP_LINE_NOTIFICATION;
|
||||||
|
} else if (parameter == "IFTTT") {
|
||||||
|
Ntype = ESP_IFTTT_NOTIFICATION;
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
||||||
return false;
|
return false;
|
||||||
|
@ -420,6 +420,7 @@ const int DEFAULT_DHT_INTERVAL = 30;
|
|||||||
#define ESP_PUSHOVER_NOTIFICATION 1
|
#define ESP_PUSHOVER_NOTIFICATION 1
|
||||||
#define ESP_EMAIL_NOTIFICATION 2
|
#define ESP_EMAIL_NOTIFICATION 2
|
||||||
#define ESP_LINE_NOTIFICATION 3
|
#define ESP_LINE_NOTIFICATION 3
|
||||||
|
#define ESP_IFTTT_NOTIFICATION 4
|
||||||
|
|
||||||
#ifdef SDCARD_FEATURE
|
#ifdef SDCARD_FEATURE
|
||||||
#define DEFAULT_IS_DIRECT_SD 1
|
#define DEFAULT_IS_DIRECT_SD 1
|
||||||
|
@ -59,6 +59,10 @@ typedef WiFiClientSecure TSecureClient;
|
|||||||
#define LINESERVER "notify-api.line.me"
|
#define LINESERVER "notify-api.line.me"
|
||||||
#define LINEPORT 443
|
#define LINEPORT 443
|
||||||
|
|
||||||
|
#define IFTTTTIMEOUT 5000
|
||||||
|
#define IFTTTSERVER "maker.ifttt.com"
|
||||||
|
#define IFTTTPORT 443
|
||||||
|
|
||||||
#define EMAILTIMEOUT 5000
|
#define EMAILTIMEOUT 5000
|
||||||
|
|
||||||
NotificationsService notificationsservice;
|
NotificationsService notificationsservice;
|
||||||
@ -132,6 +136,8 @@ const char * NotificationsService::getTypeString()
|
|||||||
return "Email";
|
return "Email";
|
||||||
case ESP_LINE_NOTIFICATION:
|
case ESP_LINE_NOTIFICATION:
|
||||||
return "Line";
|
return "Line";
|
||||||
|
case ESP_IFTTT_NOTIFICATION:
|
||||||
|
return "IFTTT";
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -154,6 +160,9 @@ bool NotificationsService::sendMSG(const char * title, const char * message)
|
|||||||
case ESP_LINE_NOTIFICATION :
|
case ESP_LINE_NOTIFICATION :
|
||||||
return sendLineMSG(title,message);
|
return sendLineMSG(title,message);
|
||||||
break;
|
break;
|
||||||
|
case ESP_IFTTT_NOTIFICATION :
|
||||||
|
return sendIFTTTMSG(title,message);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -189,6 +198,7 @@ bool NotificationsService::sendPushoverMSG(const char * title, const char * mess
|
|||||||
data += message;
|
data += message;
|
||||||
data += "&device=";
|
data += "&device=";
|
||||||
data += wifi_config.get_hostname();
|
data += wifi_config.get_hostname();
|
||||||
|
|
||||||
//build post query
|
//build post query
|
||||||
postcmd = "POST /1/messages.json HTTP/1.1\r\nHost: api.pushover.net\r\nConnection: close\r\nCache-Control: no-cache\r\nUser-Agent: ESP3D\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nContent-Length: ";
|
postcmd = "POST /1/messages.json HTTP/1.1\r\nHost: api.pushover.net\r\nConnection: close\r\nCache-Control: no-cache\r\nUser-Agent: ESP3D\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nContent-Length: ";
|
||||||
postcmd += data.length();
|
postcmd += data.length();
|
||||||
@ -329,6 +339,47 @@ bool NotificationsService::sendLineMSG(const char * title, const char * message)
|
|||||||
Notificationclient.stop();
|
Notificationclient.stop();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
//IFTTT
|
||||||
|
bool NotificationsService::sendIFTTTMSG(const char * title, const char * message)
|
||||||
|
{
|
||||||
|
String data;
|
||||||
|
String postcmd;
|
||||||
|
bool res;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
TSecureClient Notificationclient;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
||||||
|
Notificationclient.setInsecure();
|
||||||
|
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
|
||||||
|
if (!Notificationclient.connect(_serveraddress.c_str(), _port)) {
|
||||||
|
//log_esp3d("Error connecting server %s:%d", _serveraddress.c_str(), _port);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//build data for post
|
||||||
|
|
||||||
|
data ="value1=";
|
||||||
|
data += title;
|
||||||
|
data += "&value2=";
|
||||||
|
data += message;
|
||||||
|
data += "&value3=";
|
||||||
|
data += wifi_config.get_hostname();
|
||||||
|
|
||||||
|
//build post query
|
||||||
|
postcmd = "POST /trigger/" + _token1 + "/with/key/" + _token2 + " HTTP/1.1\r\nHost: maker.ifttt.com\r\nConnection: close\r\nCache-Control: no-cache\r\nUser-Agent: ESP3D\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ";
|
||||||
|
postcmd += data.length();
|
||||||
|
postcmd +="\r\n\r\n";
|
||||||
|
postcmd +=data;
|
||||||
|
|
||||||
|
//log_esp3d("Query: %s", postcmd.c_str());
|
||||||
|
//send query
|
||||||
|
Notificationclient.print(postcmd);
|
||||||
|
res = Wait4Answer(Notificationclient, "Congratulations", "Congratulations", IFTTTTIMEOUT);
|
||||||
|
Notificationclient.stop();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
//Email#serveraddress:port
|
//Email#serveraddress:port
|
||||||
bool NotificationsService::getPortFromSettings()
|
bool NotificationsService::getPortFromSettings()
|
||||||
{
|
{
|
||||||
@ -386,7 +437,6 @@ bool NotificationsService::getEmailFromSettings()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool NotificationsService::begin()
|
bool NotificationsService::begin()
|
||||||
{
|
{
|
||||||
bool res = true;
|
bool res = true;
|
||||||
@ -416,6 +466,17 @@ bool NotificationsService::begin()
|
|||||||
_port = LINEPORT;
|
_port = LINEPORT;
|
||||||
_serveraddress = LINESERVER;
|
_serveraddress = LINESERVER;
|
||||||
break;
|
break;
|
||||||
|
case ESP_IFTTT_NOTIFICATION:
|
||||||
|
if (CONFIG::read_string (ESP_NOTIFICATION_TOKEN1, sbuf, MAX_NOTIFICATION_TOKEN_LENGTH) ) {
|
||||||
|
_token1 = sbuf;
|
||||||
|
}
|
||||||
|
if (CONFIG::read_string (ESP_NOTIFICATION_TOKEN2, sbuf, MAX_NOTIFICATION_TOKEN_LENGTH) ) {
|
||||||
|
_token2 = sbuf;
|
||||||
|
}
|
||||||
|
_port = IFTTTPORT;
|
||||||
|
_serveraddress = IFTTTSERVER;
|
||||||
|
break;
|
||||||
|
|
||||||
case ESP_EMAIL_NOTIFICATION:
|
case ESP_EMAIL_NOTIFICATION:
|
||||||
if (CONFIG::read_string (ESP_NOTIFICATION_TOKEN1, sbuf, MAX_NOTIFICATION_TOKEN_LENGTH) ) {
|
if (CONFIG::read_string (ESP_NOTIFICATION_TOKEN1, sbuf, MAX_NOTIFICATION_TOKEN_LENGTH) ) {
|
||||||
_token1 = base64::encode(sbuf);
|
_token1 = base64::encode(sbuf);
|
||||||
@ -462,4 +523,5 @@ void NotificationsService::handle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif //NOTIFICATION_FEATURE
|
#endif //NOTIFICATION_FEATURE
|
||||||
|
@ -50,6 +50,7 @@ private:
|
|||||||
bool sendPushoverMSG(const char * title, const char * message);
|
bool sendPushoverMSG(const char * title, const char * message);
|
||||||
bool sendEmailMSG(const char * title, const char * message);
|
bool sendEmailMSG(const char * title, const char * message);
|
||||||
bool sendLineMSG(const char * title, const char * message);
|
bool sendLineMSG(const char * title, const char * message);
|
||||||
|
bool sendIFTTTMSG(const char * title, const char * message);
|
||||||
bool getPortFromSettings();
|
bool getPortFromSettings();
|
||||||
bool getServerAddressFromSettings();
|
bool getServerAddressFromSettings();
|
||||||
bool getEmailFromSettings();
|
bool getEmailFromSettings();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user