diff --git a/code/espurna/alexa.ino b/code/espurna/alexa.ino index 35bf6c8b..c6920976 100644 --- a/code/espurna/alexa.ino +++ b/code/espurna/alexa.ino @@ -30,6 +30,7 @@ void alexaSetup() { moveSetting("fauxmoEnabled", "alexaEnabled"); alexaConfigure(); + unsigned int relays = relayCount(); String hostname = getSetting("hostname"); if (relays == 1) { @@ -39,11 +40,17 @@ void alexaSetup() { alexa.addDevice((hostname + "_" + i).c_str()); } } - alexa.onMessage([relays](unsigned char device_id, const char * name, bool state) { + + alexa.onSetState([relays](unsigned char device_id, const char * name, bool state) { _alexa_change = true; _alexa_device_id = device_id; _alexa_state = state; }); + + alexa.onGetState([relays](unsigned char device_id, const char * name) { + return relayStatus(device_id); + }); + } void alexaLoop() { diff --git a/code/platformio.ini b/code/platformio.ini index 1cf2fbd3..6071544d 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -27,7 +27,7 @@ lib_deps = EspSoftwareSerial https://bitbucket.org/xoseperez/justwifi.git#1.1.4 https://bitbucket.org/xoseperez/hlw8012.git#1.1.0 - https://bitbucket.org/xoseperez/fauxmoesp.git#2.2.1 + https://bitbucket.org/xoseperez/fauxmoesp.git#2.3.0 https://bitbucket.org/xoseperez/nofuss.git#0.2.5 https://bitbucket.org/xoseperez/emonliteesp.git#0.2.0 https://bitbucket.org/xoseperez/debounceevent.git#2.0.1