Page 1 of 1
Variable set to zero after Domoticz update
Posted: Tuesday 05 November 2024 16:35
by JPSke
Not sure where to post this:
I have a script with a calculated value (running total) stored in a local variable.
When a new version is available and I update Domoticz the variable is set to zero after the restart, which corrupts the script.
Is there way of preventing this by recalling the last value of the variable on restart?
Thanks in advance for any suggestions.
Re: Variable set to zero after Domoticz update
Posted: Tuesday 05 November 2024 17:13
by waltervl
You mean a user variable in menu Setup > More Options > User variables ?
This should not be reset after an update. Is there some script setting this user variable?- Perhaps that script is not working correctly in the new version or right after a startup?
Re: Variable set to zero after Domoticz update
Posted: Tuesday 05 November 2024 17:47
by JPSke
The variable is set in the script: local expecpiek = tonumber(domoticz.devices('PiekPrognose').rawData[1])
The device is read via "MySensors Gateway USB".
Probably it is the "MySensors" device that sends a 0 value, because it is powered through USB by the RPI.
I presume the RPI is reset by Domoticz after the update (must check this next time) and the power is temporary cut.
Re: Variable set to zero after Domoticz update
Posted: Tuesday 05 November 2024 19:23
by waltervl
Normally an update of Domoticz will not trigger a reboot of the Pi. Unless you did so yourself manually.
Re: Variable set to zero after Domoticz update
Posted: Tuesday 26 November 2024 10:19
by JPSke
Checked while updating Domoticz: I think the USB power stays on but the Arduino which is communicating with the RPi via USB, resets after the update. Probably normal behaviour of the MySensors interface. Since the variable in the Arduino is stored in RAM, it resets to 0. The best solution will be to store this variable in EEPROM and retrieve it after the Arduino is reset. Thanks for the help.