From blocky to dzVents [Solved]
Moderator: leecollings
- gielie
- Posts: 290
- Joined: Tuesday 12 January 2016 11:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest β
- Location: The Netherlands (Alkmaar)
- Contact:
From blocky to dzVents
Hi all,
i have a blocky running which id like to change to dzvents, im a terrible coder, i tried something but this doesnt work.
Can someone help me out with translating my blocky to dzvents?
So what i want is my ventilation based on presence and time, when everybody is away/at night fan off, during the day or i 1 person at home, fan on.
thanks a lot
i have a blocky running which id like to change to dzvents, im a terrible coder, i tried something but this doesnt work.
Can someone help me out with translating my blocky to dzvents?
So what i want is my ventilation based on presence and time, when everybody is away/at night fan off, during the day or i 1 person at home, fan on.
thanks a lot
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: From blocky to dzVents
Please don't post images as a link but attach them as an img file. The link to the image was not visible when your server could not be reached.
Can you test this ?
Code: Select all
local JolandaPresence = 'Life360-Jolanda Presence' -- Please check the names on missing or extra spaces I might have copied them wrong
local MachielPresence = 'Life360-Machiel Presence'
return
{
on =
{
timer = {'at 07:00', 'at 22:30'},
devices = { JolandaPresence, MachielPresence },
},
execute = function(dz, item)
local fan = dz.devices('Ventilatie stand 2')
local bothAway = ( dz.devices(JolandaPresence).state ~= 'On' ) and ( dz.devices(MachielPresence).state ~= 'On' )
if dz.time.matchesRule('at 22:30-07:00') or bothAway then
fan.switchOff().checkFirst()
else
fan.switchOn().checkFirst()
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 11
- Joined: Tuesday 26 November 2019 21:53
- Target OS: Windows
- Domoticz version:
- Contact:
Re: From blocky to dzVents
Hello
excuse my english, but i need some help converting blockly script to dzVents
This is starting the heating, where I have a timer set directly on the switch "Kotel" and starts when I change the value on "Thermostat", which I have as a set point.
Thanks for the help
excuse my english, but i need some help converting blockly script to dzVents
This is starting the heating, where I have a timer set directly on the switch "Kotel" and starts when I change the value on "Thermostat", which I have as a set point.
Thanks for the help
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: From blocky to dzVents
Not sure I completely understand but can you try this ?
Code: Select all
return
{
on = { timer = { 'every 5 minutes' },
devices = { 'Termostat', 'Obyvak-u-TV' }},
logging = { level = domoticz.LOG_DEBUG }, -- change to LOG_ERROR if script works as expected
execute = function(dz, item)
_G.logMarker = _G.moduleLabel
local hysteresis = 0.2
local boiler = dz.devices('Kotel')
local temperature = dz.utils.round(dz.devices('Obyvak-u-TV').temperature,1)
local setpoint = dz.utils.round(dz.devices('Termostat').setPoint,1)
dz.log('Boiler state: ' .. boiler.state,dz.LOG_DEBUG)
dz.log('Measured temperature: ' .. temperature,dz.LOG_DEBUG)
dz.log('Setpoint: ' .. setpoint,dz.LOG_DEBUG)
if setpoint < ( temperature - hysteresis ) and boiler.state == 'On' then
boiler.switchOff()
dz.log('Switching boiler off',dz.LOG_DEBUG)
elseif setpoint > ( temperature + hysteresis ) and boiler.state == 'Off' then
boiler.switchOn()
dz.log('Switching boiler on',dz.LOG_DEBUG)
else
dz.log('No action needed',dz.LOG_DEBUG)
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 11
- Joined: Tuesday 26 November 2019 21:53
- Target OS: Windows
- Domoticz version:
- Contact:
Re: From blocky to dzVents
Thanks for answering, I did it according to this procedure: https://www.youtube.com/watch?v=Ga8mSQ-XCbc
Picture of my Thermostat timer setting and Log.
I would like the script to run only when the current "Thermostat" value changes
I want to convert it to dzVents because I can't find the boot value in Blockly "device.changed"
Picture of my Thermostat timer setting and Log.
I would like the script to run only when the current "Thermostat" value changes
I want to convert it to dzVents because I can't find the boot value in Blockly "device.changed"
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: From blocky to dzVents
Sorry but I don't understand a word from what is said there.MarloCZ wrote: ↑Wednesday 27 November 2019 6:52 Thanks for answering, I did it according to this procedure: https://www.youtube.com/watch?v=Ga8mSQ-XCbc
I changed the script accordingly.I would like the script to run only when the current "Thermostat" value changes/quote]
Code: Select all
return
{
on = { devices = { 'Termostat', 'Obyvak-u-TV' }},
logging = { level = domoticz.LOG_DEBUG }, -- change to LOG_ERROR if script works as expected
execute = function(dz, item)
_G.logMarker = _G.moduleLabel
local boiler = dz.devices('Kotel')
local temperature = dz.utils.round(dz.devices('Obyvak-u-TV').temperature,1)
local setpoint = dz.utils.round(dz.devices('Termostat').setPoint,1)
dz.log('Boiler state: ' .. boiler.state,dz.LOG_DEBUG)
dz.log('Measured temperature: ' .. temperature,dz.LOG_DEBUG)
dz.log('Setpoint: ' .. setpoint,dz.LOG_DEBUG)
if setpoint < temperature and boiler.state == 'On' then
boiler.switchOff()
dz.log('Switching boiler off',dz.LOG_DEBUG)
elseif setpoint > temperature and boiler.state == 'Off' then
boiler.switchOn()
dz.log('Switching boiler on',dz.LOG_DEBUG)
else
dz.log('No action needed',dz.LOG_DEBUG)
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 11
- Joined: Tuesday 26 November 2019 21:53
- Target OS: Windows
- Domoticz version:
- Contact:
Re: From blocky to dzVents
Thank you very much, the script works. Sending log.

-
- Posts: 11
- Joined: Tuesday 26 November 2019 21:53
- Target OS: Windows
- Domoticz version:
- Contact:
Re: From blocky to dzVents
I have one more request.
Is there any way to run the script only when the "Thermostat" value changes?
Something like that ?
return
{
on = { devices.changed = { 'Termostat' }},
Thx.
Is there any way to run the script only when the "Thermostat" value changes?
Something like that ?
return
{
on = { devices.changed = { 'Termostat' }},
Thx.
- gielie
- Posts: 290
- Joined: Tuesday 12 January 2016 11:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest β
- Location: The Netherlands (Alkmaar)
- Contact:
Re: From blocky to dzVents [Solved]
I used your script and it works like a charm, Thanks a lot.waaren wrote: ↑Thursday 21 November 2019 11:52Please don't post images as a link but attach them as an img file. The link to the image was not visible when your server could not be reached.
Can you test this ?
Code: Select all
local JolandaPresence = 'Life360-Jolanda Presence' -- Please check the names on missing or extra spaces I might have copied them wrong local MachielPresence = 'Life360-Machiel Presence' return { on = { timer = {'at 07:00', 'at 22:30'}, devices = { JolandaPresence, MachielPresence }, }, execute = function(dz, item) local fan = dz.devices('Ventilatie stand 2') local bothAway = ( dz.devices(JolandaPresence).state ~= 'On' ) and ( dz.devices(MachielPresence).state ~= 'On' ) if dz.time.matchesRule('at 22:30-07:00') or bothAway then fan.switchOff().checkFirst() else fan.switchOn().checkFirst() end end }
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
Who is online
Users browsing this forum: No registered users and 1 guest