CounterDelivToday no return value?  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

CounterDelivToday no return value?

Post by Kranendijk »

Hi all,

Domoticz time lately :D

All counters are working - but one it seems. I have a simple script to get the “CounterDelivToday” from my smart meter which is called “verbruik” to transfer the value of “CounterDelivToday” to a custom sensor called “StroomPanelenVandaag” to be shown on my dashticz v3 dashboard. The wife really loves it!

However it seems not to be filled, what’s wrong as I use the exact same mechanism for gas and electricity consumption??
Spoiler: show
--Voor Dashticz overal custom sensor van maken
return {
on = { timer = {'every 5 minutes'}},
logging = {level = domoticz.LOG_DEBUG, -- LOG_DEBUG, set to LOG_ERROR when script works as expected
},
execute = function(domoticz)
local STROOMPANELEN = domoticz.devices('Verbruik').CounterDelivToday
domoticz.devices('StroomPanelenVandaag').updateCustomSensor(STROOMPANELEN)
end
}
And a part of the json result:
Spoiler: show
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"Counter" : "6081.569",
"CounterDeliv" : "1738.629",
"CounterDelivToday" : "0.284 kWh",
"CounterToday" : "14.969 kWh",
"CustomImage" : 0,
"Data" : "3113308;2968261;522264;1216365;296;0",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 2,
"HardwareName" : "Slimme meter",
"HardwareType" : "P1 Smart Meter USB",
"HardwareTypeVal" : 4,
"HaveTimeout" : false,
"ID" : "0001",
"LastUpdate" : "2021-01-30 23:17:08",
"Name" : "Verbruik",
"Notifications" : "false",
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: CounterDelivToday no return value?

Post by waaren »

Kranendijk wrote: Saturday 30 January 2021 23:20 local STROOMPANELEN = domoticz.devices('Verbruik').CounterDelivToday
The JSON key names do not have a one to one relation with dzVents attributes (names).
You can find the dzVents attribute names for a P1 type device in the dzVents wiki. For this value you will have to use the counterDeliveredToday attribute
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Re: CounterDelivToday no return value?  [Solved]

Post by Kranendijk »

Hahaha I used one of your dump scripts on the forum to check what is in the “Verbruik” device. I used CounterDeliveredToday which gave me no results... reading your post well, it should not be a capital C.

That was the trick. Easy peasy,

Getting the hang of it.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest