vintlabs / fauxmoESP

Add voice control of your ESP32 and ESP8266 devices using Amazon Alexa
MIT License
383 stars 69 forks source link

return when _devices is empty #105

Closed pvint closed 3 years ago

pvint commented 4 years ago

Original report by Lucas Neumann (Bitbucket: fiakergulaschsaft, ).


I’m using fauxmo in my project and I’m calling the handle() function no matter whether there are any devices registered in my project for alexa or not. instead I’m globally enabling/disabling alexa-support (fauxmo).

this might be a quite special case but I think it would be good to just return if the _devices vector is empty instead of doing pointless stuff in the code. in my case, the _devices vector was empty and the esp8266 gave me a exception(28) error everytime when alexa was searching for new devices.

i have to admit however, that I’m using a heavily modified version of your code where I have merged the belkin emulation into a current version of fauxmoesp (nasty stuff) because the hue emulation suddenly stopped working a while ago.

nonetheless, I think my fix might be beneficial anyways, even for your code because i think that it is just pointless to do stuff and waste cycles when there is nothing to do anyway.

all the best

pvint commented 3 years ago

I think all of the places where this could be an issue have a check in them. Let me know if there's any lingering still....