closed] getting value of watercounter

Moderator: leecollings

Post Reply
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

closed] getting value of watercounter

Post by BartSr »

Hi,
I am having an working incremental counter which monitors the water consumption
Daily consumption is shown as 0,191m3 whereas total shows 939.995m3.
So far so good.
Now I like to see these values in a lua script.
I am not good using lua so I will do step by step (goal is to create daily file with time interval of e.g.10 minutes)

In lua I coded:
print(otherdevices_svalues['watermeter'])

Now I get this in logfile:
2022-05-18 23:22:04.412 Status: LUA: 18446744073709379679

What does this show while looking at 0,191m3 and 939.995 m3?

TIA for your help
-Bart
Last edited by BartSr on Saturday 04 March 2023 13:48, edited 1 time in total.
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: getting value of watercounter

Post by waltervl »

If you are not good at LUA better learn DzVents as there it is just very easy to get it.

In LUA it seems not possible (please someone correct me if wrong). See also
viewtopic.php?p=282202
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Toulon7559
Posts: 859
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: getting value of watercounter

Post by Toulon7559 »

Please publish the complete lua-script, enabling the forum to see whether the declaration of values is correct.
Publishing is easiest if you set the code-markers and then copy the script-text inbetween those 2 markers, as shown below.

Code: Select all

text of script
If the script is long, use spoiler to set the markers: then the view is small, but contents can easily be called.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: getting value of watercounter

Post by BartSr »

Here we go; as said I am going step by step. So 1st step is : how to get the value of a device

Code: Select all

commandArray = {}

local a 
print ("watermeter")
print(otherdevices_svalues['watermeter'])

a = otherdevices_svalues['watermeter']
print (a)

return commandArray

if I want to see a tempvalue I do:
(I find expected tempvalue in logfile)

Code: Select all


commandArray = {}

local a 
a = otherdevices_svalues['Vv trapgat aanvoer']
print (a)


return commandArray
So as shown here
viewtopic.php?p=282202
It seems to be impossible to catch a counters'value. This is weird for me.

Any suggestion?
TIA
-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: getting value of watercounter

Post by BartSr »

@Watervl:
I.ve been programming databases for years using procedural code as well as OOP.
For me LUA is closest to those.
DzVents is very steep learning curve for me.
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: getting value of watercounter

Post by BartSr »

Nobody who has an advise?

KR
-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
RonkA
Posts: 115
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Re: getting value of watercounter

Post by RonkA »

Hello,

print(otherdevices_svalues['watermeter']) gave you 2022-05-18 23:22:04.412 Status: LUA: 18446744073709379679
Is the status output a constant number or is it changing?

Also in your latter post it states /a = otherdevices_svalues['Vv trapgat aanvoer']/ that looks to me not relevant to the counter..

Grt Ron.
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: getting value of watercounter

Post by BartSr »

Hi Ron,

I did not check for some time but currently it sents: 18446744073709369520
So there is a change.

KR
-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
RonkA
Posts: 115
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Re: getting value of watercounter

Post by RonkA »

Im NOT a educated person in programming but i like tinkering,
You didn't disclose the type of meter, maybe a manual wil give some clarity?
It could be there are more values beeng delivered like 2 or more.. like P1data gives out 6 values.

I have a script thats getting 2 values out of a solarmeter device, maybe this could get other values out of your meter

Code: Select all

solar_p, solar_e = otherdevices_svalues[solarmeter]:match("([^;]+);([^;]+)")
solar_p is getting the current power and solar _e is the day couter,.

Modify and try i would say..
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
BartSr
Posts: 395
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: getting value of watercounter

Post by BartSr »

Thanks fro your help Ron, but the problem is that what I am measuring is just counting the number of rotations of the watermeter.
That gives correct indication in Domoticz. But when I want to retrieve the value, as shown by Domoticz as a scriptvalue the weird data is received.
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest