I'm new to dzVents, have been using blockly but i want to go about using dzVents as i find it provides me with more flexibility but i'm stuck at trying to get my Ventilation to enable once the detected humidity passes a certain level (65%).
The average humidity on my bathroom is between 50-60 percent during winter time and between 30-50 percent during the summer so i was kind of hoping to enable my ventilation and set it to 100% if my humidity passes 65 percent.
the script i have at the moment will detect the current value of my humidity sensor and then use the value to enable the ventilation.
Or would it be better to detect a major increase of humidity from a certain current level? But on rainy days humidity seems to increase quite quick anyway.
The problem with the current script is that it will keep running and the logging comes back with the error:
Code: Select all
2021-03-16 11:34:51.045 Error: dzVents: Error: (3.0.2) ...e/pi/domoticz/scripts/dzVents/generated_scripts/test.lua:28: attempt to concatenate a nil value (local 'humidity')
Also, preferably i would want to prevent the ventilation from becoming active during the night even though it is quiet even at 100%.
Code: Select all
return {
on =
{
devices =
{
'BDKth',
'MV'
},
},
logging =
{
level = domoticz.LOG_DEBUG,
},
data =
{
currentState =
{
initial = '',
},
},
execute = function(dz, item)
local temperature = item.temperature
local humidity = item.humidity
dz.log('Device ' .. item.name .. '; temperature is '.. temperature .. '° C , humidity is ' ..humidity .. '.', dz.LOG_DEBUG)
if humidity > 65 then -- if humidity is higher than 50%
dz.devices('MV').setLevel(100).forMin(60) -- Set MV to 100% for 60 Minutes
elseif humidity < 64 then -- if humidity is lower than 50%
dz.devices('MV').setLevel(50) -- set to default 50%
end
end
}
Regards,
Dimitri.