Closed jsalatiel closed 2 years ago
Hi, please check this commit. It is working for me(gen1 and gen2). If @pvint agrees we can bring to this repo.
I applied your commit, but whats the signature for the onGetState callback? I tried:
fauxmo.onGetState([](unsigned char device_id, const char * device_name) {
but it does not work:
/home/.../esp32/Arduino/libraries/fauxmoESP-3.4/src/fauxmoESP.h:100:14: note: candidate: void fauxmoESP::onGetState(TGetStateCallback)
void onGetState(TGetStateCallback fn) { _getCallback = fn; }
/home/.../esp32/Arduino/libraries/fauxmoESP-3.4/src/fauxmoESP.h:100:14: note: no known conversion for argument 1 from 'setup()::<lambda(unsigned char, const char*)>' to 'TGetStateCallback {aka std::function<void(unsigned char, const char*, bool&, unsigned char&)>}'
exit status 1
Error explains itself.
This is your definition... fauxmo.onGetState([](unsigned char device_id, const char * device_name) {
This is what error says. no known conversion to -> {aka std::function<void(unsigned char, const char*, bool&, unsigned char&)>}
See the problem? If not, please check how its used here.
Thanks. I am not a programmer per se, so I still have problems to understand those errors. I could not find an example to that onGetState in the link you sent, but i suppose it uses the same args as the onSetState.
Please check the link again.
I can see the onGetState call back being called and I am returning the correct value afaik. 1 for ON 0 for Off But on alexa I still get "Device doesn't support requested value"
when you ask "Alexa, is your_device_name is on?" You don't get correct answer. Alexa says "Device doesn't support requested value" Did I understand you right?
what's your Amazon Alexa generation?
Did you try with Alexa app? did you get correct on / off status there?
3rd generation.
The alexa app shows me the message "Device doesn't support requested value".
"when you ask "Alexa, is your_device_name is on?" Alexa says ( translated from my language ) "Device is not compatible"
I can turn the devices on and off, but since alexa can not detect the current state it makes a two steps thing.
In the onGetState callback I am printing some debug , so I see that alexa is running the getstate.
[ALEXA] 11:16:13 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:18 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:18 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:21 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:21 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:24 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:24 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:16:27 Getting current state for device #0 (buraco 1): ON
[ALEXA] 11:17:33 Getting current state for device #1 (buraco 2): OFF
I see, what happens when you tap "buraco 1"? does it shows correct value screen after tapping? as I told you at the beginning
It is working for me(gen1 and gen2)
I don't think I can help more than this. Sorry.
"I see, what happens when you tap "buraco 1"? does it shows correct value screen after tapping" Yes
"I don't think I can help more than this. Sorry." Tks for all your help!
@MrGreensWorkshop I have switched from this repo to FauxmoBelkinPlugfrom your repo and that works great! Well, at least it works for esp32, unfortunatelly on esp8266-esp1 it does not work. ( the devices get not discovered ). Have you ever tested on esp8266 ?
If you want to discuss about FauxmoBelkinPlug, please open a new discussion with the content you wrote from the link.
I have found the solution in another link for the esp8266. Sharing here: I had to set LwIP variant to "V2 higher bandwidth" I suppose that the "V2 low memory" sending 536 byte packets and "V2 higher bandwidth" sending 1460 byte packets makes the difference here.
Now I have the same code working on both esp32 and esp8266-esp1
Hi, to make alexa be able to get the current state for one device, it requires the onGetState callback, but apparently that callback was removed in version 3.0. Any replacement for that ?