Hi,
I have almost the same setup and couldn't get it to work as i wanted using blocky and switched to dzVents which is (in my opinion) much more powerfull and a lot less of a guessing game than Blocky scripts.
I've got a Humidity sensor, an Aeon Labs Multi 6 sensor (known as "TempHum" in Domoticz)
I've got a Fibaro FGS223 Double Relay (known as "Ventilatie-Q1" and "Ventilatie-Q2" in Domoticz) controlling a 3-position switch for ventilation (actually a warmth recovery device "Ecolution" that uses the heat in the extracted air to preheat radiator water) Setting 1 is lowest, setting 3 is highest.
I have the following user variables defined:
'Ventilatie-HumTriggerOn' this is an integer that hold the percentage value at which the ventilation is put into the highest setting (75%)
'Ventilatie-HumTriggerOff' this is an integer that holds the percentage value at which the ventilation is put into the medium setting (55%),
'Ventilatie-Setting' this is an integer that holds the most recent setting
Since the manual 3-position switch is also connected to the FGS223 the real actual setting of the ventilation system is sort of unkown that is why i force a known state when switching by going via the setting 1 (Domoticz will not send a on or off command if it thinks the switch is already in the requested position)
The system works for almost a year now like this and the only slight issue i have found is that when overall humidity is high (for example on a very rainy/humid/warm day) the humidity will not drop below the 'triggerOff' level and stay on. I have a manual way to deal with this it is to go into Domoticz user variables and manually set the 'triggerOff' to a higher level (and once the script switches off the high setting restore the 'triggerOff' value)
Anyway here is my dzVents script for the bathroom ventilation (slightly anonymized to remove actual e-mail addresses).
Code: Select all
-- Check the wiki for dzVents
-- remove what you don't need
return {
-- optional active section,
-- when left out the script is active
-- note that you still have to check this script
-- as active in the side panel
active = {
true
},
-- trigger
-- can be a combination:
on = {
-- device triggers
devices = {
-- scripts is executed if the device that was updated matches with one of these triggers
'TempHum',
},
-- timer riggers
timer = {
-- timer triggers.. if one matches with the current time then the script is executed
'every minute',
},
-- user variable triggers
variables = {
'Ventilatie-HumTriggerOn',
'Ventilatie-HumTriggerOff',
'Ventilatie-Setting',
},
},
-- custom logging level for this script
logging = {
level = domoticz.LOG_DEBUG, -- domoticz.LOG_INFO, domoticz.LOG_DEBUG, domoticz.LOG_ERROR or domoticz.LOG_FORCE
marker = "dzV_BadkamerHumVentilatie"
},
-- actual event code
-- the second parameter is depending on the trigger
-- when it is a device change, the second parameter is the device object
-- similar for variables, scenes and groups and httpResponses
-- inspect the type like: triggeredItem.isDevice
execute = function(domoticz, triggeredItem, info)
--[[
The domoticz object holds all information about your Domoticz system. E.g.:
local myDevice = domoticz.devices('myDevice')
local myVariable = domoticz.variables('myUserVariable')
local myGroup = domoticz.groups('myGroup')
local myScene = domoticz.scenes('myScene')
The device object is the device that was triggered due to the device in the 'on' section above.
]] --
domoticz.log(tostring(domoticz.devices('TempHum').humidity),domoticz.LOG_DEBUG)
-- BadkamerHumVentilatie aan
if ((domoticz.devices('TempHum').humidity > domoticz.variables('Ventilatie-HumTriggerOn').value) and (domoticz.variables('Ventilatie-Setting').value ~= 3)) then
domoticz.log("humidity > trigger and Setting ~= 3",domoticz.LOG_DEBUG)
domoticz.email('Humidity > Trigger', 'Ventilatie naar stand 3 want vochtigheid van ' .. domoticz.devices('TempHum').humidity .. '% is groter dan limiet van ' .. domoticz.variables('Ventilatie-HumTriggerOn').value .. '%', '[email protected]')
domoticz.devices('Ventilatie-Q1').switchOff()
domoticz.devices('Ventilatie-Q2').switchOff()
domoticz.log("Ventilatie stand 1 ; Q1 = off ; Q2 = off",domoticz.LOG_DEBUG)
domoticz.devices('Ventilatie-Q1').switchOff()
domoticz.devices('Ventilatie-Q2').switchOn()
domoticz.variables('Ventilatie-Setting').set(3)
domoticz.log("Ventilatie stand 3 ; Q1 = off ; Q2 = on",domoticz.LOG_DEBUG)
end
-- BadkamerHumVentilatie aan bevestiging
if ((domoticz.devices('TempHum').humidity > domoticz.variables('Ventilatie-HumTriggerOn').value) and (domoticz.variables('Ventilatie-Setting').value == 3)) then
domoticz.log("humidity > trigger and Setting == 3",domoticz.LOG_DEBUG)
domoticz.devices('Ventilatie-Q1').switchOff()
domoticz.devices('Ventilatie-Q2').switchOn()
end
-- BadkamerHumVentilatie uit
if ((domoticz.devices('TempHum').humidity < domoticz.variables('Ventilatie-HumTriggerOff').value) and (domoticz.variables('Ventilatie-Setting').value ~= 2)) then
domoticz.log("humidity < trigger and Setting ~= 2",domoticz.LOG_DEBUG)
domoticz.email('Humidity < Trigger', 'Ventilatie naar stand 2 want vochtigheid van ' .. domoticz.devices('TempHum').humidity .. '% is kleiner dan limiet van ' .. domoticz.variables('Ventilatie-HumTriggerOff').value .. '%', '[email protected]')
domoticz.devices('Ventilatie-Q1').switchOff()
domoticz.devices('Ventilatie-Q2').switchOff()
domoticz.log("Ventilatie stand 1 ; Q1 = off ; Q2 = off",domoticz.LOG_DEBUG)
domoticz.devices('Ventilatie-Q1').switchOn()
domoticz.devices('Ventilatie-Q2').switchOff()
domoticz.variables('Ventilatie-Setting').set(2)
domoticz.log("Ventilatie stand 2 ; Q1 = on ; Q2 = off",domoticz.LOG_DEBUG)
end
-- BadkamerHumVentilatie uit bevestiging
if ((domoticz.devices('TempHum').humidity < domoticz.variables('Ventilatie-HumTriggerOff').value) and (domoticz.variables('Ventilatie-Setting').value == 2)) then
domoticz.log("humidity < trigger and Setting == 2",domoticz.LOG_DEBUG)
domoticz.devices('Ventilatie-Q1').switchOn()
domoticz.devices('Ventilatie-Q2').switchOff()
end
end
}