visualapproach / WiFi-remote-for-Bestway-Lay-Z-SPA

Hack - ESP8266 as WiFi remote control for Bestway Lay-Z spa Helsinki
GNU General Public License v3.0
269 stars 71 forks source link

Add feature to override power usages #713

Closed choumarin closed 3 weeks ago

choumarin commented 1 month ago

This adds an option in the hardware configuration to override power usage for each element. With this, it is possible to better adjust power usage statistics for non standard models, especially 110V based ones.

choumarin commented 1 month ago

What's the proper test process?

visualapproach commented 1 month ago

Looks nice at first glance (reading file changes on phone). There is no established test procedure. I trust that the editor has tested as much as practically possible, then I check the changefile and test it on my 6-wire pump. Can't really test on 4-wire. The real test is when people try the dev version. Hence I don't want PR's to master.

choumarin commented 1 month ago

Thanks! I'll run a few more tests on my own (6W) pump

visualapproach commented 1 month ago

@choumarin I've tested you PR on my device now. First I must say I'm impressed by your work. It's not easy to get into someone else's code, but i think you made all the necessary changes :-) I had some issues though with web pages not loading properly. I've struggled a lot with that myself, when I update the code. I am quite confident that it's due to out of memory somewhere. I've squeezed byte by byte to the best of my ability but it feels I got to do some radical changes. Thinking of ditching the web sockets and do polling instead. Maybe also replacing some other libraries - wifi manager, web server and so on. I tried another web server but it ate more memory than stock one. I don't know how much the DallasTemperatur library takes but maybe need to cut that... Any thoughts?

choumarin commented 1 month ago

Thanks for the kind words! I'm really not familiar with this platform (esp) or even with this dev environment (arduino/platformio), so I'm not sure I have any thoughts. I'm not even sure how to check how much RAM / stack it's currently using and if that's even the issue. I also had some weird things happen where I was expecting the doc to reload properly but it didn't, hence me increasing the JSON doc allocation. I can definitely look, but I can't spend more than an hour here and there on this and no promises that I'll find anything.

visualapproach commented 1 month ago

No rush. I also only have limited time. I think it's hard to monitor memory. You can throw in some checks in your own code but it doesn't matter if some WiFi function smashes the stack. I'm not a professional programmer so I'm sure there are some clever ways that I am unaware of. I'll see if I can tweak it to work but now you know why I don't pull the code immediately.

visualapproach commented 1 month ago

Hm, when I set -DDEBUG_ESP_PORT=Serial it works. That is strange because it wastes more memory. So I have a hunch that there is too many web server requests beeing done too fast for the ESP to cope. And when the debug logging is ON there is enough time to process memory clean up. Or something. Every html page loads .css, .js and stuff. Need to experiment more...

visualapproach commented 3 weeks ago

PR merged. Problem was that the HTML pages tried to load too many resources at once. Internalized some resources and it appears to solve the half loaded pages 😃 Thanks for your contribution!

choumarin commented 3 weeks ago

Hey, sorry I dropped the ball on the investigation, good to know you found the issue. Thanks for the whole project !