dzVents 1.0 released
Moderator: leecollings
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Peepz, please use the tracker on GitHub for bugs/problems/errors. That way I can better keep tracker of things.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
Seriously, this should be merged with the main code and be the main engine for lua scripts.
So much simpler to work with in every way possible.
I am trying to get a notification sent when my dishwasher is done (consumption stays around 3.3w for a couple of minutes),
but it seems to through some errors.
Any ideas?
So much simpler to work with in every way possible.
I am trying to get a notification sent when my dishwasher is done (consumption stays around 3.3w for a couple of minutes),
but it seems to through some errors.
Code: Select all
2016-06-06 14:25:19.037 Error: EventSystem: in Dishwasher_Monitor: [string "commandArray = {}..."]:6: bad argument #1 to 'pairs' (table expected, got nil)
Code: Select all
return {
active = false,
on = {
['timer'] = 'every minute'
},
data = {
readingHistory = {
history = true,
maxItems = 3
},
notificationSent = {
initial = false
}
},
execute = function(domoticz, switch, triggerInfo)
local consumption = domoticz.devices['Kök, Diskmaskin'].WActual
domoticz.data.readingHistory.add(consumption)
local average = domoticz.data.readingHistory.avg()
if (average == 3.3 and not domoticz.data.notificationSent)
then
domoticz.data.notificationSent = true
domoticz.notify('Diskmaskinen klar!',
'Diskmaskinen har precis kört klart aktuellt program.',
domoticz.PRIORITY_LOW)
elseif (average > 100)
then
domoticz.data.notificationSent = false
end
end
}
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Working on itdhanjel wrote:Seriously, this should be merged with the main code and be the main engine for lua scripts.
So much simpler to work with in every way possible.

In the same log there should be a list of all the command array items that dzVents prepares and sends back to Domoticz. Can you post that list?dhanjel wrote: I am trying to get a notification sent when my dishwasher is done (consumption stays around 3.3w for a couple of minutes),
but it seems to through some errors.
Any ideas?Code: Select all
2016-06-06 14:25:19.037 Error: EventSystem: in Dishwasher_Monitor: [string "commandArray = {}..."]:6: bad argument #1 to 'pairs' (table expected, got nil)
Code: Select all
return { active = false, on = { ['timer'] = 'every minute' }, data = { readingHistory = { history = true, maxItems = 3 }, notificationSent = { initial = false } }, execute = function(domoticz, switch, triggerInfo) local consumption = domoticz.devices['Kök, Diskmaskin'].WActual domoticz.data.readingHistory.add(consumption) local average = domoticz.data.readingHistory.avg() if (average == 3.3 and not domoticz.data.notificationSent) then domoticz.data.notificationSent = true domoticz.notify('Diskmaskinen klar!', 'Diskmaskinen har precis kört klart aktuellt program.', domoticz.PRIORITY_LOW) elseif (average > 100) then domoticz.data.notificationSent = false end end }
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 6
- Joined: Thursday 12 May 2016 15:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8771
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
Excuse a beginner, but is this included when I started from BETA ver. 3.5187 och does I always have to install it separately?
Domoticz on Raspberry PI 3 since 2016.
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
For now you have to install it separately (which means copying some files over to the right location and renaming the settings file). See the README.md.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
Thats all I got.
I do have a single entry of this as well,
2016-06-06 15:02:51.720 Error: Getting error 'Transport endpoint is not connected' while getting remote_endpoint in connection_manager::start
I do have a single entry of this as well,
2016-06-06 15:02:51.720 Error: Getting error 'Transport endpoint is not connected' while getting remote_endpoint in connection_manager::start
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
That line is not related to dzVents.dhanjel wrote:Thats all I got.
I do have a single entry of this as well,
2016-06-06 15:02:51.720 Error: Getting error 'Transport endpoint is not connected' while getting remote_endpoint in connection_manager::start
But what if you don't send the notification but do a print statement instead?
I get the feeling that there's some other script that is causing problems. Do you have other scripts in the ../scripts/lua folder besides script_device_main.lua?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
Nope, this is my only script. Will debug a bit more later.
Sent from my Nexus 6P using Tapatalk
Sent from my Nexus 6P using Tapatalk
-
- Posts: 10
- Joined: Wednesday 28 January 2015 14:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Utrecht
- Contact:
Re: dzVents 1.0 released
Hi Danny, It's still happening...dannybloe wrote:
Did you find anything yet?
Code: Select all
2016-06-06 03:40:03.465 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/Domoticz.lua:445: attempt to index local 'device' (a nil value)
2016-06-06 05:25:02.595 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/Domoticz.lua:445: attempt to index local 'device' (a nil value)
2016-06-06 10:55:03.267 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/Domoticz.lua:445: attempt to index local 'device' (a nil value)
2016-06-06 14:35:03.204 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/Domoticz.lua:445: attempt to index local 'device' (a nil value)
2016-06-06 17:25:03.270 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/Domoticz.lua:445: attempt to index local 'device' (a nil value)
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Well, u gotta do some debugging then
. Maybe turning on debug logging in the settings gives some clues.

Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
One step in the right direction. It seemed I had to many parameters to the execute-function.
Next bump in the road, it seems that the power consumption always is null.

HTTP Fetch is configured
Next bump in the road, it seems that the power consumption always is null.
Code: Select all
return {
active = true,
on = { ['timer'] = 'every minute' },
data = {
readingHistory = { history = true, maxItems = 3 },
notificationSent = { initial = false }
},
execute = function(domoticz)
local consumption = domoticz.devices['Kök, Diskmaskin'].WActual
if (consumption == nill)
then
domoticz.log("Consumption could not be read.", domoticz.LOG_INFO)
else
domoticz.data.readingHistory.add(consumption)
domoticz.log("Current consumption: " .. consumption, domoticz.LOG_INFO)
local average = domoticz.data.readingHistory.avg()
if (average == 3.3 and not domoticz.data.notificationSent)
then
domoticz.data.notificationSent = true
--domoticz.notify('Diskmaskinen klar!',
-- 'Diskmaskinen har precis kört klart aktuellt program.',
-- domoticz.PRIORITY_LOW)
domoticz.log("Dishwasher done", domoticz.LOG_INFO)
elseif (average > 100)
then
domoticz.data.notificationSent = false
end
end
end
}
Code: Select all
2016-06-07 07:52:00.441 LUA: =====================================================
2016-06-07 07:52:00.441 LUA: >>> Handler: dishwasher
2016-06-07 07:52:00.441 LUA: .....................................................
2016-06-07 07:52:00.441 LUA: Consumption could not be read.
2016-06-07 07:52:00.441 LUA: .....................................................
2016-06-07 07:52:00.441 LUA: <<< Done
2016-06-07 07:52:00.441 LUA: -----------------------------------------------------

HTTP Fetch is configured
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Ok, the best step next is to look into the file devices.lua. First of all, that file should exist and be recent (not older than the fetch interval as set in the setttings file). If that is the case you can open the file and find the Kök device and see if it has the proper wattage listed. Also check that the name is exactly the same as you use in your code. (Can you post the piece for your device here?)dhanjel wrote:One step in the right direction. It seemed I had to many parameters to the execute-function.
Next bump in the road, it seems that the power consumption always is null.Code: Select all
return { active = true, on = { ['timer'] = 'every minute' }, data = { readingHistory = { history = true, maxItems = 3 }, notificationSent = { initial = false } }, execute = function(domoticz) local consumption = domoticz.devices['Kök, Diskmaskin'].WActual if (consumption == nill) then domoticz.log("Consumption could not be read.", domoticz.LOG_INFO) else domoticz.data.readingHistory.add(consumption) domoticz.log("Current consumption: " .. consumption, domoticz.LOG_INFO) local average = domoticz.data.readingHistory.avg() if (average == 3.3 and not domoticz.data.notificationSent) then domoticz.data.notificationSent = true --domoticz.notify('Diskmaskinen klar!', -- 'Diskmaskinen har precis kört klart aktuellt program.', -- domoticz.PRIORITY_LOW) domoticz.log("Dishwasher done", domoticz.LOG_INFO) elseif (average > 100) then domoticz.data.notificationSent = false end end end }
Code: Select all
2016-06-07 07:52:00.441 LUA: ===================================================== 2016-06-07 07:52:00.441 LUA: >>> Handler: dishwasher 2016-06-07 07:52:00.441 LUA: ..................................................... 2016-06-07 07:52:00.441 LUA: Consumption could not be read. 2016-06-07 07:52:00.441 LUA: ..................................................... 2016-06-07 07:52:00.441 LUA: <<< Done 2016-06-07 07:52:00.441 LUA: -----------------------------------------------------
HTTP Fetch is configured
Another thing you can do is dump the device state to the logs: domoticz.logDevice(domoticz.devices). It should show all the attributes on the device (although Domoticz has the tendency to swallow some log messages if they come too fast and too many in a row).
I'm just looking at the code that sets the WActual value:
Code: Select all
if (device.deviceType == 'General' and device.deviceSubType == 'kWh') then
device.addAttribute('WhTotal', tonumber(device.rawData[2]))
device.addAttribute('WActual', tonumber(device.rawData[1]))
local todayFormatted = httpDevice.CounterToday or ''
-- risky business, we assume no decimals, just thousands separators
-- there is no raw value available for today
local s = string.gsub(todayFormatted, '%.', '')
s = string.gsub(s, '%,', '')
s = string.gsub(s, ' kWh', '')
device.addAttribute('WhToday', tonumber(s))
end
In the mean time you can also look at the rawData attribute of the device in your case. It is likely that it holds the actual usage as well.
So, plenty of starting points to investigate this. I'm sure we can nail this bugger

Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
I don´t see a deviceType, only subType.
It is a Fibaro Wall Plug.
(Tried to change the name since I have many with the same name since consumptions are separate devices in Domoticz compared to for instance Fibaro)
If I do
I only get
Perhaps I managed so install someting incorrectly.
I don´t have any device in the devices.lua file with property WActual
Code: Select all
{
["AddjMulti"]= 1.0,
["AddjMulti2"]= 1.0,
["AddjValue"]= 0.0,
["AddjValue2"]= 0.0,
["BatteryLevel"]= 255,
["CustomImage"]= 0,
["Data"]= "3.4 Watt",
["Description"]= "",
["Favorite"]= 0,
["HardwareID"]= 2,
["HardwareName"]= "Z-Wave",
["HardwareType"]= "OpenZWave USB",
["HardwareTypeVal"]= 21,
["HaveTimeout"]= true,
["ID"]= "0001901",
["LastUpdate"]= "2016-06-07 07:40:22",
["Name"]= "Kök, Diskmaskin Förbrukning",
["Notifications"]= "false",
["PlanID"]= "0",
["PlanIDs"]= { 0 },
["Protected"]= false,
["ShowNotifications"]= true,
["SignalLevel"]= "-",
["SubType"]= "Electric",
["Timers"]= "false",
["Type"]= "Usage",
["TypeImg"]= "current",
["Unit"]= 2,
["Used"]= 1,
["XOffset"]= "0",
["YOffset"]= "0",
["idx"]= "97"
}
(Tried to change the name since I have many with the same name since consumptions are separate devices in Domoticz compared to for instance Fibaro)
If I do
Code: Select all
domoticz.logDevice(domoticz.devices)
Code: Select all
2016-06-07 09:03:00.261 LUA: =====================================================
2016-06-07 09:03:00.261 LUA: >>> Handler: dishwasher
2016-06-07 09:03:00.261 LUA: .....................................................
2016-06-07 09:03:00.261 LUA: ----------------------------
2016-06-07 09:03:00.261 LUA: An error occured when calling event handler dishwasher
2016-06-07 09:03:00.261 LUA: /home/daniel/domoticz/scripts/lua/dzVents/Domoticz.lua:269: attempt to concatenate field 'name' (a nil value)
2016-06-07 09:03:00.261 LUA: .....................................................
2016-06-07 09:03:00.261 LUA: <<< Done
2016-06-07 09:03:00.261 LUA: -----------------------------------------------------
I don´t have any device in the devices.lua file with property WActual
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Well, I found an omission in my code and indeed it didn't recognize Usage devices and their WActual information. I just release 1.0.2 that should fix this. Please check it out.
1.0.2:
1.0.2:
- Added device description attribute.
- Added support for setting the setpoint for opentherm gateway.
- Added timedOut boolean attribute to devices. Requires http data fetching to be anabled.
- Properly detects usage devices and their Wattage.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
Sweet, that part seems to work fine now.
Just need to wait until I can run the dishwasher again to test 
Code: Select all
2016-06-07 09:38:00.233 LUA: =====================================================
2016-06-07 09:38:00.233 LUA: >>> Handler: dishwasher
2016-06-07 09:38:00.233 LUA: .....................................................
2016-06-07 09:38:00.233 LUA: Current consumption: 3.4
2016-06-07 09:38:00.233 LUA: .....................................................
2016-06-07 09:38:00.233 LUA: <<< Done
2016-06-07 09:38:00.233 LUA: -----------------------------------------------------

-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
3.4 Watt when it's not running? I'd get a new onedhanjel wrote:Sweet, that part seems to work fine now.Just need to wait until I can run the dishwasher again to testCode: Select all
2016-06-07 09:38:00.233 LUA: ===================================================== 2016-06-07 09:38:00.233 LUA: >>> Handler: dishwasher 2016-06-07 09:38:00.233 LUA: ..................................................... 2016-06-07 09:38:00.233 LUA: Current consumption: 3.4 2016-06-07 09:38:00.233 LUA: ..................................................... 2016-06-07 09:38:00.233 LUA: <<< Done 2016-06-07 09:38:00.233 LUA: -----------------------------------------------------

Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
Its when it's idle. When it is powered off it is near 0. (It has a display that is on)
Sent from my Nexus 6P using Tapatalk
Sent from my Nexus 6P using Tapatalk
-
- Posts: 102
- Joined: Tuesday 05 August 2014 22:16
- Target OS: Linux
- Domoticz version: 3.5146
- Location: Sweden
- Contact:
Re: dzVents 1.0 released
is it possible to retrieve a device by id instead of name? I have a lot of devices with the same name
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Of course you can do it by id: domoticz.devices[123]. However, I strongly advise against having devices with the same name as dzVents has no way of keeping them apart in an easy way because Domoticz sends the stuff name-based. I'd rename the devices to make them unique.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 129
- Joined: Monday 25 November 2013 17:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Mallorca
- Contact:
Re: dzVents 1.0 released
Because there s no other place where scripts can showed, here my contribution based on the help of @dannybloe.
It is about heating control:
1. control heat circuits by setpoints:2. control heatpump:
I'm sure dannybloe will have a look at this and will comment if there is a need.
It is about heating control:
1. control heat circuits by setpoints:
Code: Select all
return {
active = true,
on = {
['timer'] = 'every 10 minutes',
},
execute = function(domoticz)
local function regulate(setpoint, temperature, boiler)
if (temperature < setpoint) and (boiler.state == 'Off') then boiler.switchOn()
else
if (boiler.state == 'On') then boiler.switchOff()
end
end
end
local spSalon = tonumber(domoticz.devices['Setpoint Salon'].state)
local tSalon = domoticz.devices['Salon'].temperature
local bSalon = domoticz.devices['FB 21 Heizkreis Salon']
local spBath = tonumber(domoticz.devices['Setpoint Bad'].state)
local tBath = domoticz.devices['Bad'].temperature
local bBath = domoticz.devices['FB 42 Heizkreis Bad']
local spBuero = tonumber(domoticz.devices['Setpoint Buero'].state)
local tBuero = domoticz.devices['Buero'].temperature
local bBuero = domoticz.devices['FB 23 Heizkreis Buero']
local spSchlafzimmer = tonumber(domoticz.devices['Setpoint Schlafzimmer'].state)
local tSchlafzimmer = domoticz.devices['Schlafzimmer'].temperature
local bSchlafzimmer = domoticz.devices['FB 32 Heizkreis Schlafzimmer']
local spGaestebad = tonumber(domoticz.devices['Setpoint Gaestebad'].state)
local tGaestebad = domoticz.devices['Gaestebad'].temperature
local bGaestebad = domoticz.devices['FB 41 Heizkreis Gaestebad']
regulate(spSalon, tSalon, bSalon)
regulate(spBath, tBath, bBath)
regulate(spBuero, tBuero, bBuero)
regulate(spSchlafzimmer, tSchlafzimmer, bSchlafzimmer)
regulate(spGaestebad, tGaestebad, bGaestebad)
end
}
Code: Select all
return {
active = true,
on = {
['timer'] = 'every 10 minutes',
},
execute = function(domoticz)
local Wp = domoticz.devices['FB 33 Wärmepumpe']
local bSalon = domoticz.devices['FB 21 Heizkreis Salon']
local bBath = domoticz.devices['FB 42 Heizkreis Bad']
local bBuero = domoticz.devices['FB 23 Heizkreis Buero']
local bSchlafzimmer = domoticz.devices['FB 32 Heizkreis Schlafzimmer']
local bGaestebad = domoticz.devices['FB 41 Heizkreis Gaestebad']
if (bSalon == 'On') or (bBath == 'On') or (bBuero == 'On') or (bSchlafzimmer == 'On') or (bGaestebad == 'On') and (Wp.state == 'Off')
then Wp.switchOn()
else if (Wp.state == 'On')
then Wp.switchOff()
end
end
end
}
Rfxcom
Raspi 4
Raspi 4
Who is online
Users browsing this forum: No registered users and 1 guest