vintlabs / fauxmoESP

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

Adding more than 10 devices #76

Closed pvint closed 3 years ago

pvint commented 5 years ago

**Original report by Mario


Hi, I have a problem adding more than 10 devices. I would like to add up to 50 devices. After a lot of debug I have noticed that the JSON answer message is truncated after 2920 bytes (header + body). I have tried to modify the lwip configuration file in order to enlarge the tx buffer but without results. I have tried also to enable the "IP_FRAG" but the problem is the same. I don't know if the message body is truncated before that is tranfered to wifi library or is truncated by wifi and ESP8266 libraries.

fauxmoesp: 3.1.0 Arduino IDE 1.8.8 ESP8622 Core 2.5.0-beta2 LWIP: v1.4 Higher Bandwidth

Do you have any advice for this issue ?

Many thanks in advance. Best Regards.

Mario.

pvint commented 5 years ago

Original comment by Mario Machinè


Hi, no advice or solution about this topic ?

Many thanks in advance. Mario.

pvint commented 5 years ago

Original comment by Peter Feerick (Bitbucket: pfeerick, GitHub: pfeerick).


I just found out about this library as I also wanted to be able to do more than 10 devices, and it appears it also supports dimming and colour. Haven't tried it yet but may be worth a look.

https://github.com/Aircoookie/Espalexa

pvint commented 5 years ago

Original comment by Maxim Prokhorov


I think the problem is with how fauxmoESP controls sending the data: https://bitbucket.org/xoseperez/fauxmoesp/src/f60c46d80f9b8a400319ab8af9af2957eeb276aa/src/fauxmoESP.cpp#lines-335

Because JSON response does not fully fit into the network buffer of 2920 bytes, that callback (and probably onPoll too) should be utilized to supply another chunk of data. Espalexa, for example, avoids this issue by using ESPAsyncWebServer that implements AsyncClient handlers for onPoll (periodically, while client is connected) / onAck (when client received previous data chunk). After every write it checks the return value of write, so it knows how much data was really sent.

See web responses implementation and _fillBuffer funcs in ESPAsyncWebServer core.

pvint commented 3 years ago

I keep thinking about this issue, and I think I've decided that it's likely too much work to attempt to resolve.

I guess the answer simply is that 10 is the limit on ESP8266.