Page 1 of 1

LUA - device counter - updatedevice cumulate value

Posted: Thursday 04 June 2020 11:21
by multinet
Hello

I've a scripts that count the number of minutes à pump is powered on. It was running fine since few years.

I've just updated to domoticz v2020.2
Version: 2020.2
Build Hash: b63341bc0
Compile Date: 2020-04-26 13:47:55
dzVents Version: 3.0.2
Python Version: 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]

My lua script is now running differently it seems that every "UpdateDev" call it cumulate the values instead of change it

my function:

Code: Select all

function UpdateDev(device,nvalue,svalues)
    --Met à jour un device numérique Domoticz
    print("Updatedev")
    print("nvalue:"..tostring(nvalue))
    print("svalues:"..tostring(svalues))
    commandArray[CmdIdx] = {['UpdateDevice'] = otherdevices_idx[device]..'|'..tostring(nvalue)..'|'..tostring(svalues)}
    CmdIdx=CmdIdx+1
end
result before / after update domoticz (i updated domoticz on june 1st):
Capture d’écran 2020-06-04 à 11.16.39.png
Capture d’écran 2020-06-04 à 11.16.39.png (180.23 KiB) Viewed 850 times
and my device :
Capture d’écran 2020-06-04 à 11.20.47.png
Capture d’écran 2020-06-04 à 11.20.47.png (16.32 KiB) Viewed 850 times

exemple of log call 1

Code: Select all

2020-06-04 11:32:02.469  Status: LUA: ---Temperature de la piscine : 27.0
2020-06-04 11:32:02.618  Status: LUA: Déjà effectué : 680.0 minutes sur 815
2020-06-04 11:32:02.620  Status: LUA: PpeRest (conso piscine) : 135.0
2020-06-04 11:32:02.621  Status: LUA: =PpeDuree (conso piscine) : 815
2020-06-04 11:32:02.622  Status: LUA: -PpeFait (conso piscine) : 680.0
2020-06-04 11:32:02.624  Status: LUA: Temps restant de filtration : 135.0 minutes 
2020-06-04 11:32:02.625  Status: LUA: Updatedev
2020-06-04 11:32:02.626  Status: LUA: nvalue:0
2020-06-04 11:32:02.628  Status: LUA: svalues:680.0
call 2:

Code: Select all

020-06-04 11:33:03.137  Status: LUA: ---Temperature de la piscine : 27.0
2020-06-04 11:33:03.249  Status: LUA: Déjà effectué : 680.0 minutes sur 815
2020-06-04 11:33:03.251  Status: LUA: PpeRest (conso piscine) : 135.0
2020-06-04 11:33:03.252  Status: LUA: =PpeDuree (conso piscine) : 815
2020-06-04 11:33:03.253  Status: LUA: -PpeFait (conso piscine) : 680.0
2020-06-04 11:33:03.254  Status: LUA: Temps restant de filtration : 135.0 minutes 
2020-06-04 11:33:03.256  Status: LUA: Updatedev
2020-06-04 11:33:03.257  Status: LUA: nvalue:0
2020-06-04 11:33:03.258  Status: LUA: svalues:680.0
What is going wrong ?

Thank a lot and take care.

Multinet

Re: LUA - device counter - updatedevice cumulate value

Posted: Thursday 04 June 2020 11:53
by waaren
multinet wrote: Thursday 04 June 2020 11:21 I've a scripts that count the number of minutes à pump is powered on. It was running fine since few years.
I've just updated to domoticz v2020.2
My lua script is now running differently it seems that every "UpdateDev" call it cumulate the values instead of change it
What is going wrong ?
Check this topic for a possible explanation

Re: LUA - device counter - updatedevice cumulate value

Posted: Thursday 04 June 2020 12:07
by multinet
Hello Waaren

Thank you very much for you quick answer.

It seems that i'm concerned by what you write on the other post : I use an incremental counter and domoticz change the behavior of it in my new version).

Nos i have to adaot my. lua script !

Thank you
Multinet