2017-02-21 23:59:47 +01:00
|
|
|
void alexaOn();
|
|
|
|
void alexaOff();
|
2017-12-28 00:37:13 +01:00
|
|
|
void alexaDim();
|
2017-02-21 23:59:47 +01:00
|
|
|
|
|
|
|
void alexaInit()
|
|
|
|
{
|
|
|
|
if (alexaEnabled && WiFi.status() == WL_CONNECTED)
|
|
|
|
{
|
|
|
|
upnpBroadcastResponder.beginUdpMulticast();
|
|
|
|
alexa = new Switch(alexaInvocationName, 81, alexaOn, alexaOff);
|
|
|
|
upnpBroadcastResponder.addDevice(*alexa);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void handleAlexa()
|
|
|
|
{
|
|
|
|
if (alexaEnabled && WiFi.status() == WL_CONNECTED)
|
|
|
|
{
|
|
|
|
upnpBroadcastResponder.serverLoop();
|
|
|
|
alexa->serverLoop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void alexaOn()
|
|
|
|
{
|
2017-12-28 00:37:13 +01:00
|
|
|
if (alexaOnMacro == 255)
|
2017-02-21 23:59:47 +01:00
|
|
|
{
|
2017-12-28 00:37:13 +01:00
|
|
|
handleSet((alexaNotify)?"win&T=1&IN":"win&T=1&NN&IN");
|
2017-02-21 23:59:47 +01:00
|
|
|
} else
|
|
|
|
{
|
2017-12-28 00:37:13 +01:00
|
|
|
applyMacro(alexaOnMacro);
|
2017-02-21 23:59:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void alexaOff()
|
|
|
|
{
|
2017-12-28 00:37:13 +01:00
|
|
|
if (alexaOffMacro == 255)
|
2017-02-21 23:59:47 +01:00
|
|
|
{
|
2017-12-28 00:37:13 +01:00
|
|
|
handleSet((alexaNotify)?"win&T=0&IN":"win&T=0&NN&IN");
|
2017-02-21 23:59:47 +01:00
|
|
|
} else
|
|
|
|
{
|
2017-12-28 00:37:13 +01:00
|
|
|
applyMacro(alexaOffMacro);
|
2017-02-21 23:59:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-28 00:37:13 +01:00
|
|
|
void alexaDim(uint8_t bri)
|
|
|
|
{
|
|
|
|
String ct = (alexaNotify)?"win&IN&A=":"win&NN&IN&A=";
|
|
|
|
ct = ct + bri;
|
|
|
|
handleSet(ct);
|
|
|
|
}
|
|
|
|
|