dzVents WActual Nil issue

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

Moderator: leecollings

Post Reply
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

dzVents WActual Nil issue

Post by heggink »

All, I must be thick but I cannot get this power usage actual to work. I have a device (Fridge) of type Usage subtype Electric where I am trying to print its value:

return {
active = true,
on = {
devices = {
'Fridge'
}
},
execute = function(domoticz, dev)
pow = dev.WActual
print('Dev power says ' .. pow)
end
}

Domoticz complains about concatenating a string and a nil value (pow). What am I doing wrong here?
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents WActual Nil issue

Post by mivo »

Hi,

try to convert pow value (numeric) to string before print, for example:

Code: Select all

print('Dev power says ' .. tostring(pow))
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents WActual Nil issue

Post by dannybloe »

Yes, you have to convert it to a string otherwise lua will complain. Interesting thing here though is why it is nil. You can turn debug logging on and inspect the log. You can also inspect the file domoticzData.lua that will be created in debug mode in /path/to/domoitcz/scripts/dzVents. Or you can do dev.dump() to dump all device attributes to the log.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents WActual Nil issue

Post by heggink »

Found it: it should be WhActual with an h after the W. I followed the wiki so is there a typo? WActual: Number. Current Watt usage.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents WActual Nil issue

Post by dannybloe »

Yup. That's likely a typo.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents WActual Nil issue

Post by heggink »

Yay for the dump() function. That's how I noticed the correct name.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents WActual Nil issue

Post by dannybloe »

I fixed the typo in the docs.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest