vintlabs / fauxmoESP

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

made several major changes and improvements to the library #108

Closed pvint closed 3 years ago

pvint commented 4 years ago

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


Hi

after working for about a year on your library, I have made several major improvements and changes to it and I was wondering whether you’d be interested in them.

  1. got rid of C++ strings, reworked everything to use char arrays, so no heap fragmentation at least from that anymore
  2. rewrote the tcp list function to send the fauxmo device list (json) as chunked response, fully non blocking, device per device with request->beginChunkedResponse. in my scenario, i wasn’t able to send responses larger than about 1.9k (and then the asyncwebserver did simply cut it off) so 3 fauxmo devices was the absolute max, I could use. Now I’ve got 10 devices and detection and control is still working.
  3. changed the interface to pass the whole request to fauxmo.process. this was necessary to achieve point 2.

i have customized it to work solely with an external server (espasyncwebserver, for sure), so I also removed some functions and stuff which were needed for the internal server. might need to reimplement that but shouldn’t be a big issue.

I’m still noticing some random crashes when alexa discovers where the memory runs out (allocation failed, exception 29) and I guess that’s due to the fact that all alexa devices I have (about 8 ) query the poor ESP8266 at once and when using an external webserver, the max connection/client limit is not enforced. will look into that later.

it was a sh*tload of work until I realized that the asyncwebserver just cuts off the JSON device list response if it is too long. and it was another sh*tload of work to figure out how to make it non blocking and async but still chunked and “thread safe”.

but now, it is done :slight_smile:

btw. i’m also planning to implement color support so i can integrate that library into my 8 channel PWM led stripe dimmer.

pvint commented 4 years ago

Original comment by Douglas Venancio (Bitbucket: dg, GitHub: dg).


hello you can show me the library improved library. i have problems with number of devices.

pvint commented 4 years ago

Original comment by Xose Pérez (Bitbucket: [Xose Pérez](https://bitbucket.org/Xose Pérez), ).


Hi Lucas, sure! You can submit a pull request with your changes. Will merge them to the main code.