Variable set to zero after Domoticz update

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
JPSke
Posts: 32
Joined: Wednesday 11 November 2020 11:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Sint-Gillis-Waas, Belgium
Contact:

Variable set to zero after Domoticz update

Post 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.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Variable set to zero after Domoticz update

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JPSke
Posts: 32
Joined: Wednesday 11 November 2020 11:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Sint-Gillis-Waas, Belgium
Contact:

Re: Variable set to zero after Domoticz update

Post 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.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Variable set to zero after Domoticz update

Post by waltervl »

Normally an update of Domoticz will not trigger a reboot of the Pi. Unless you did so yourself manually.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JPSke
Posts: 32
Joined: Wednesday 11 November 2020 11:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Sint-Gillis-Waas, Belgium
Contact:

Re: Variable set to zero after Domoticz update

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest