LUA - device counter - updatedevice cumulate value

Moderator: leecollings

Post Reply
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

LUA - device counter - updatedevice cumulate value

Post 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 824 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 824 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
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: LUA - device counter - updatedevice cumulate value

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: LUA - device counter - updatedevice cumulate value

Post 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
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests