dzVents 1.0 released
Moderator: leecollings
-
- 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 set a RGB/RGBW device (Fibaro) colors?
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
How is that done with traditional scripting in Domoticz?
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
No idea :/
I´ve started a script that will set the rgb-list behind the tv to different colors depending on the state.
tv-off: yellow
tv-on: green
tv-on and chromecast active: red
(or something like that)
I´ve started a script that will set the rgb-list behind the tv to different colors depending on the state.
tv-off: yellow
tv-on: green
tv-on and chromecast active: red
(or something like that)
-
- 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 can't find anything on how to control rgbw values from Lua so if someone knows how to do it I can add support for it.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Nice.jkimmel wrote: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: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 }
I'm sure dannybloe will have a look at this and will comment if there is a need.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 }
I just added an example script in the dev branch that controls heating in one room where a setpoint device, a temp-sensor and a boiler switch work together with some basic hysteresis control. You could duplicate the script for all device or adapt it to support multi-rooms. It uses one hystorical variable to catch unwanted peaks in the temperature readings. The script is triggered by device events and timer events all in one.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 21
- Joined: Sunday 08 May 2016 19:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: France
- Contact:
Re: dzVents 1.0 released
Hi dannybloe,
Device method updateLux(Lux) doesn't work.
The nValue is updated instead of sValue.
I corrected the function in Device.lua
Thanks for all
Device method updateLux(Lux) doesn't work.
The nValue is updated instead of sValue.
I corrected the function in Device.lua
Code: Select all
function self.updateLux(lux)
self.update(0,lux)
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
Thanks! Fixed this in the dev branch. Keep them comingNeutrino wrote:Hi dannybloe,
Device method updateLux(Lux) doesn't work.
The nValue is updated instead of sValue.
I corrected the function in Device.luaThanks for allCode: Select all
function self.updateLux(lux) self.update(0,lux) end
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
I just added the Kodi commands in dzVents. (dev branch).
Danny
- kodiExecuteAddOn(addonId): Function. Will send an Execute Addon command sending no parameters. Addon IDs are embedded in the addon configuration and are not to be confused with the Addon Name. For example: http://forums.homeseer.com/showthread.php?p=1213403.
- kodiPause(): Function. Will send a Pause command, only effective if the device is streaming.
- kodiPlay(): Function. Will send a Play command, only effective if the device was streaming and has been paused.
- kodiPlayFavorites([position]): Function. Will play an item from the Kodi's Favorites list optionally starting at position. Favorite positions start from 0 which is the default.
- kodiPlayPlaylist(name, [position]): Function. Will play a music or video Smart Playlist with name optionally starting at position. Playlist positions start from 0 which is the default.
- kodiSetVolume(level): Function. Set the volume for a Kodi device, 0 <= level <= 100.
- kodiStop(): Function. Will send a Stop command, only effective if the device is streaming.
- kodiSwitchOff(): Function. Will turn the device off if this is supported in settings on the device.
Danny
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 121
- Joined: Sunday 11 October 2015 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6224
- Location: Holland
- Contact:
Re: dzVents 1.0 released
I am rebuilding my lua scripts to dzVents style.
I have an simple energiemeter with one LED (1000pulse/kw) via espeasy (counted pulses/minute) to an incremental counter in Domoticz named 'WattCountRaw'
In Domoticz LUA I split the pulses in high and low (cost) incremental counting depending on day/time
In my working existing script I read the recieved pulses with:
In dzVents lua I cannot find the received pulses, so to say, I do not find an Device attribute which has the counted pulses
I tried :
But then I get:
Some help would be nice, I am using dzVents [1.0.2]
I have an simple energiemeter with one LED (1000pulse/kw) via espeasy (counted pulses/minute) to an incremental counter in Domoticz named 'WattCountRaw'
In Domoticz LUA I split the pulses in high and low (cost) incremental counting depending on day/time
In my working existing script I read the recieved pulses with:
Code: Select all
local pulse_counter = 'WattCountRaw'
local pulses = tonumber(otherdevices_svalues[pulse_counter])
I tried :
Code: Select all
local inWatt = domoticz.devices['WattCountRaw'].WActual
print ('Watt Pulses = ' .. inWatt)
Code: Select all
LUA: An error occured when calling event handler try
LUA: /home/pi/domoticz/scripts/lua/scripts/wattcount.lua:14: attempt to concatenate local 'inWatt' (a nil value)
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Could you send me the json output for that device (it should be in devices.lua if you have http fetching enabled). It is very well possible that that devicetype is not yet recognized by dzVents.NietGiftig wrote:I am rebuilding my lua scripts to dzVents style.
I have an simple energiemeter with one LED (1000pulse/kw) via espeasy (counted pulses/minute) to an incremental counter in Domoticz named 'WattCountRaw'
In Domoticz LUA I split the pulses in high and low (cost) incremental counting depending on day/time
In my working existing script I read the recieved pulses with:In dzVents lua I cannot find the received pulses, so to say, I do not find an Device attribute which has the counted pulsesCode: Select all
local pulse_counter = 'WattCountRaw' local pulses = tonumber(otherdevices_svalues[pulse_counter])
I tried :But then I get:Code: Select all
local inWatt = domoticz.devices['WattCountRaw'].WActual print ('Watt Pulses = ' .. inWatt)
Some help would be nice, I am using dzVents [1.0.2]Code: Select all
LUA: An error occured when calling event handler try LUA: /home/pi/domoticz/scripts/lua/scripts/wattcount.lua:14: attempt to concatenate local 'inWatt' (a nil value)
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 121
- Joined: Sunday 11 October 2015 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6224
- Location: Holland
- Contact:
Re: dzVents 1.0 released
Here you go, only totals to see not the last transmitted pulse count.
Code: Select all
{
["AddjMulti"]= 1.0,
["AddjMulti2"]= 1.0,
["AddjValue"]= 0.0,
["AddjValue2"]= 0.0,
["BatteryLevel"]= 255,
["Counter"]= "751.338 kWh",
["CounterToday"]= "3.551 kWh",
["CustomImage"]= 0,
["Data"]= "751.338 kWh",
["Description"]= "",
["Favorite"]= 0,
["HardwareID"]= 2,
["HardwareName"]= "ESPNetwork",
["HardwareType"]= "Dummy (Does nothing, use for virtual switches only)",
["HardwareTypeVal"]= 15,
["HaveTimeout"]= false,
["ID"]= "82064",
["LastUpdate"]= "2016-06-10 11:59:11",
["Name"]= "WattCountRaw",
["Notifications"]= "false",
["PlanID"]= "0",
["PlanIDs"]= { 0 },
["Protected"]= false,
["ShowNotifications"]= true,
["SignalLevel"]= "-",
["SubType"]= "Counter Incremental",
["SwitchTypeVal"]= 0,
["Timers"]= "false",
["Type"]= "General",
["TypeImg"]= "counter",
["Unit"]= 1,
["Used"]= 1,
["ValueQuantity"]= "",
["ValueUnits"]= "",
["XOffset"]= "0",
["YOffset"]= "0",
["idx"]= "65"
},
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Ah, I see. I will have a look to see if I can make a specific property for this device. For now you can use the rawData attribute I think:
Code: Select all
-- hidden attribute which will show the rawData:
print(domoticz.devices['WattCountRaw']._sValues)
-- get the index from _sValues using the rawData attribute:
domoticz.devices['WattCountRaw'].rawData[1] -- or 2
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 121
- Joined: Sunday 11 October 2015 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6224
- Location: Holland
- Contact:
Re: dzVents 1.0 released
Thanks, I will do that.dannybloe wrote:Ah, I see. I will have a look to see if I can make a specific property for this device. For now you can use the rawData attribute I think:
Code: Select all
-- hidden attribute which will show the rawData: print(domoticz.devices['WattCountRaw']._sValues) -- get the index from _sValues using the rawData attribute: domoticz.devices['WattCountRaw'].rawData[1] -- or 2
I think it is good to retrieve all the send raw sensor data, it is not always clear how it is used in Domoticz, so rawData is also a good solution
Sometimes you want to manipulate it yourself in a nice script
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Yes indeed. But use device.rawData[xx] instead of device._sValues as the data is already split into nice usable chunks.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
I added counterToday and counterTotal attributes for counter devices (still in dev branch). This is a formatted value with unit unfortunately. Currently it is a real pain to get raw values out of Domoticz. Note that the values are as accurate as the latest http fetch.
Also fixed a bug (incorrect documentation) for updating counter devices from Lua.
Also fixed a bug (incorrect documentation) for updating counter devices from Lua.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 121
- Joined: Sunday 11 October 2015 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6224
- Location: Holland
- Contact:
Re: dzVents 1.0 released
I assume that I must get the counted pulses/per minute with still with rawdata as you describeddannybloe wrote:Note that the values are as accurate as the latest http fetch.
The http fetch is 30 min apart so i cannot use the totals in my script wich is supposed to run every minute.
I could make a workaround with the persistent data option, hmm to much ...
I think that I will wait with this script until Domoticz & dzVents have a direct interface.
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
You can easily increase the interval to every minute if you like. Or maybe a bit slower.
Yes, you can still use rawData[1]. I always try to never break anything when making changes
Yes, you can still use rawData[1]. I always try to never break anything when making changes
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 have a lot of log entries in the error tab of this type:
2016-06-16 13:22:10.470 Error: EventSystem: Warning!, lua script /home/daniel/domoticz/scripts/lua/script_time_main.lua has been running for more than 10 seconds
is that normal?
2016-06-16 13:22:10.470 Error: EventSystem: Warning!, lua script /home/daniel/domoticz/scripts/lua/script_time_main.lua has been running for more than 10 seconds
is that normal?
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: dzVents 1.0 released
Then there is script that is taking a lot of time. Or doesn't end. Check the logs. It should show you when a script starts and ends (if you have info messages enabled in dzVents_settings.lua).dhanjel wrote:I have a lot of log entries in the error tab of this type:
2016-06-16 13:22:10.470 Error: EventSystem: Warning!, lua script /home/daniel/domoticz/scripts/lua/script_time_main.lua has been running for more than 10 seconds
is that normal?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Who is online
Users browsing this forum: Google [Bot] and 1 guest