Netgalleria / arska-node

Smart power manager for optimized solar power usage as well as greenest and cheapest energy purchase
GNU General Public License v3.0
24 stars 1 forks source link

RC1 channel rules for channel 6 does not save settings #41

Closed 3vdo closed 7 months ago

3vdo commented 7 months ago

Running with version 1.00.0-rc1.3486 - 2023-10-20 18:23:22.

Channel rules are not saved completely. For example Rule 1 I cannot get Up mode saved, it all way returns back to Down when page refreshed.

Olli69 commented 7 months ago

Hi, I tried to reproduce the reported error with the same version, but in my first tests channel 6 was saved successfully. First thing comes to mind is some kind is incompatibility issue with the browser settings or some kind of settings or rule combination which is not accepted. Could you make a few tests so we could get more info, thanks:

BR, Olli

3vdo commented 7 months ago

I have tried many things already. If I put just simple rule like Price < 30 and Up. The result after save and refresh is this: image

So, the Up returns to Down and also the value field gets empty.

Same thing happens with Firefox 122.0 and Chrome 121.0.6167.86 and also different Android browsers. My language settings are mainly English, but I'm Finnish. I also have quite a bit experience on coding and testing, so I am sure there is some thing wrong. Other channels and rules work just fine.

I run Arska on esp32-devkitc-v4. I recently updated Arska from some earlier version to 1.0.

I can check also serial console, but I'll come back to that later.

3vdo commented 7 months ago

I tried getting into console, but now for some reason windows does not detect USB virtual serial port connection to esp32 anymore. I did the Arska update to 1.0 using USB virtual serial connection and then windows recognized it, but now it doesn't. Everything else works fine, only issues are now serial port connection and channel 6 settings. All other work fine also when powered via USB from PC. I tried with two different PCs and same problem.

Should I try update some other version older or newer of Arska via web UI? With older version everything also worked fine, but I don't remember what was the version.

Also setting a schedule manually from dashboard works fine and activates Shelly normally.

Olli69 commented 7 months ago

Thanks for the precise info! I just made a new test version for you, 1.00.0-alfa15 . Just in case take anyway config backup before update. It should equal to 1.0 rc1 but there more memory allocated for json data structure handling settings #define CONFIG_JSON_SIZE_MAX 8192 . I did not reproduce the error you had, so I cannot say this helps, but it is possible that rule definitions of channels 1-5 have took all the allocated space.

EDIT: It might be that the error has nothing to do with that parameter CONFIG_JSON_SIZE_MAX I changed . But it still can be some kind of memory allocation issue because it causes problems with the last entry. I'll try to figure out what it could be. Some ideas:

3vdo commented 7 months ago

I just installed the alfa15 update, and I didn't even needed to change setting rules for channel 6. It was all in place as I set it before the update. So, some how settings were there, but did't take effect and didn't update to UI after refresh. I added some rules to all rules 1-4 and and now it seem to save everything correctly. It also seem to activate control properly now according to rules. Thanks, that did the trick!

3vdo commented 7 months ago

Additionally, every time I have manually updated fw, the firmware.bin goes just fine, but always I get upload failed when installing littlefs.bin, but it seem to go in still correctly.

Olli69 commented 7 months ago

Great! Most probably save was ok (no memory allocation problem), but when you got the new configuration from ESP32 to UI there was not enough allocated space which cut channel 6 data away. I'll make to same fix to ver 1.1 too.

That update thing is something which could better for sure. Not critical but kind of annoying. Hopefully I can fix it some day.

Olli69 commented 7 months ago

Additionally, every time I have manually updated fw, the firmware.bin goes just fine, but always I get upload failed when installing littlefs.bin, but it seem to go in still correctly.

After updating firmware.bin Arska actually tries to update automatically littlefs.bin from the installation server . And if a user starts manual update (for littlefs.bin) these update processes conflict (the later started manual process is canceled) and a error message is given. I changed manual update UUI (/update) for so that you cannot start manual update when there is ongoing automatic update process. This should fix this problem in future versions.