Automating my WTW (ventilation unit)  [SOLVED]

Moderator: leecollings

rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Automating my WTW (ventilation unit)

Post by rrozema »

Attachments didn't work correctly on this first post. The full story is in the next reply, here is the latest version of the script

Code: Select all

local FAN_NAME_HIGH = 'Ventilatie: Hoog'
local FAN_NAME_MIDDLE = 'Ventilatie: Midden'

local KEUKEN_SENSOR_NAME = 'Keuken'
local BADKAMER_SENSOR_NAME = 'Badkamer'
local WASHOK_SENSOR_NAME = 'Washok'
local CO_SENSOR_NAME = 'CO Sensor'
local BUITEN_SENSOR_NAME = 'Buiten'

local HUMIDITY_SETTING_DEVICE_NAME = 'Humidity setting'

local QUIET_SWITCH_NAME = 'Slaaptijd'
local WC_AFZUIGING_SWITCH_NAME = 'WC Afzuiging'
local NIEMAND_THUIS_SWITCH_NAME = 'Niemand thuis'

return {
--    active = true ,
    on = {
--        devices = { '*' },
        devices = { 
            BADKAMER_SENSOR_NAME,
            KEUKEN_SENSOR_NAME,
            WASHOK_SENSOR_NAME,
            BUITEN_SENSOR_NAME,
            HUMIDITY_SETTING_DEVICE_NAME,
            QUIET_SWITCH_NAME,
            WC_AFZUIGING_SWITCH_NAME,
            NIEMAND_THUIS_SWITCH_NAME,
            CO_SENSOR_NAME
        }
--        variables = { ... },
--        timer = { 'every minute' }
--        security = { ... }
    },
--    logging = {
--        level = domoticz.LOG_INFO
----        level = domoticz.LOG_DEBUG
--    },  
    data = { 
            humidityTarget = {initial = 60},
            humidityBinnen = {initial = 0},
            humidityBuiten = {initial = 0},
            tempBuiten = {initial = 0},
            tempBinnen = {initial = 0},
            manual = {initial = false},
            CODetected = {initial = false},
            quiet_time = {initial = false},
            niemand_thuis = {initial = false},
            wc_afzuiging = {initial = false}
        },
    execute = function(domoticz, device, triggerInfo)
        if (domoticz.EVENT_TYPE_TIMER == triggerInfo.type) then
            domoticz.log( 'timer event: '..tostring(triggerInfo.trigger)..'.')
            
        elseif (domoticz.EVENT_TYPE_DEVICE == triggerInfo.type) then
            domoticz.log( 'device event: '..device.name..', deviceType: '..device.deviceType..'.')
            if (device.name == BUITEN_SENSOR_NAME) then
                if (domoticz.data.humidityBuiten ~= device.humidity) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.humidityBuiten)..' -> '..tostring(device.humidity)..'.', domoticz.LOG_FORCE)
                    domoticz.data.humidityBuiten = device.humidity
                end
                if (domoticz.data.tempBuiten ~= device.temperature) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.tempBuiten)..' -> '..tostring(device.temperature)..'.', domoticz.LOG_FORCE)
                    domoticz.data.tempBuiten = device.temperature
                end
            elseif (device.name == CO_SENSOR_NAME) then
                if ((device.state == 'On' and domoticz.data.CODetected ~= true) or (device.state == 'Off' and domoticz.data.CODetected ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.CODetected)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.CODetected = (device.state == 'On')
                end
            elseif (device.name == QUIET_SWITCH_NAME) then
                if ((device.state == 'On' and domoticz.data.quiet_time ~= true) or (device.state == 'Off' and domoticz.data.quiet_time ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.quiet_time)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.quiet_time = (device.state == 'On')
                end
            elseif (device.name == NIEMAND_THUIS_SWITCH_NAME) then
                if ((device.state == 'On' and domoticz.data.niemand_thuis ~= true) or (device.state == 'Off' and domoticz.data.niemand_thuis ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.niemand_thuis)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.niemand_thuis = (device.state == 'On')
                end
            elseif (device.name == WC_AFZUIGING_SWITCH_NAME) then
                if ((device.state == 'On' and domoticz.data.wc_afzuiging ~= true) or (device.state == 'Off' and domoticz.data.wc_afzuiging ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.wc_afzuiging)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.wc_afzuiging = (device.state == 'On')
                end
            elseif (device.name == HUMIDITY_SETTING_DEVICE_NAME) then
                if (device.level ~= domoticz.data.humidityTarget) then
                    -- My humidity sensors won't indicate higher than 90%, so I don't allow
                    -- a setting higher than 90% either or the fans will never stop.
                    domoticz.data.humidityTarget = math.min(device.level, 90)
                    if (device.level ~= domoticz.data.humidityTarget) then
                        domoticz.log(device.name..': '..tostring(device.level)..' -> '..tostring(domoticz.data.humidityTarget)..'.')
                        device.switchSelector(domoticz.data.humidityTarget)
                    end
                end
                domoticz.log(device.name..': '..tostring(domoticz.data.manual)..' -> '..tostring(device.state == 'On')..'.')
                if ((device.state == 'On' and domoticz.data.manual ~= false) or (device.state == 'Off' and domoticz.data.manual ~= true)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.manual)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.manual = (device.state ~= 'On')
                end
            elseif (device.name == KEUKEN_SENSOR_NAME or device.name == BADKAMER_SENSOR_NAME or device.name == WASHOK_SENSOR_NAME) then
                local sensors = domoticz.devices().filter({ KEUKEN_SENSOR_NAME, BADKAMER_SENSOR_NAME, WASHOK_SENSOR_NAME})
                local max_humidity = sensors.reduce(
                        function(acc, device)
                            if (device.timedOut ~= true) then -- device.lastUpdate.hoursAgo <= 4) then
                                if (acc == nil or device.humidity > acc) then
                                    acc = device.humidity
                                end
                            end
                            return acc -- always return the accumulator
                        end, 
                        nil) -- nil is the initial value for the accumulator
                if (max_humidity ~= nil) then
                    if (domoticz.data.humidityBinnen ~= max_humidity) then
                        domoticz.log(device.name..': max humidity '..tostring(domoticz.data.humidityBinnen)..' -> '..tostring(max_humidity)..'.', domoticz.LOG_INFO)
                        domoticz.data.humidityBinnen = max_humidity
                    end
                end
                local max_temperature = sensors.reduce(
                        function(acc, device)
                            if (device.timedOut ~= true) then --device.lastUpdate.hoursAgo <= 4) then
                                if (acc == nil or (math.floor(device.temperature * 10 + 0.05)) / 10 > acc) then
                                    acc = math.floor(device.temperature * 10 + 0.05) / 10
                                end
                            end
                            return acc -- always return the accumulator
                        end, 
                        nil) -- nil is the initial value for the accumulator
                if (max_temperature ~= nil) then
                    if (domoticz.data.tempBinnen ~= max_temperature) then
                        domoticz.log(device.name..': max temperature '..tostring(domoticz.data.tempBinnen)..' -> '..tostring(max_temperature)..'.', domoticz.LOG_INFO)
                        domoticz.data.tempBinnen = max_temperature
                    end
                end
            end
        
            local measured_humidity = domoticz.data.humidityBinnen
            local target_humidity = math.max(domoticz.data.humidityTarget, domoticz.data.humidityBuiten - 20)

            domoticz.log('Max humidity '..tostring(domoticz.data.humidityBinnen)..', setpoint: '..tostring( domoticz.data.humidityTarget)..', buiten: '..tostring( domoticz.data.humidityBuiten)..', target: '..tostring(target_humidity)..'.', domoticz.LOG_FORCE)


            if (domoticz.data.CODetected == true or domoticz.data.manual ~= true) then
                local fan_middle
                local fan_high
                
                if (domoticz.data.CODetected == true) then
                    domoticz.log('CO detected!', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'On'
                elseif (measured_humidity >= 90 and domoticz.data.quiet_time ~= true) then
                    domoticz.log('humidity >= 90%', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'On'
                elseif (measured_humidity > target_humidity + 3 
                                                                            -- If the humidity is more than 3% over the target, set 
                                                                            -- ventilation to "high".
                        and domoticz.data.quiet_time ~= true                -- But, during the night I don't want the fans to go
                                                                            -- howling, even if it's wet.
--                        and (math.abs(domoticz.data.tempBinnen - measured_humidity) >= 2
--                            or measured_humidity > domoticz.data.humidityBuiten)) then
--                                                                            -- And, if there is hardly no temperature difference between 
--                                                                            -- inside and outside, my WTW will not have any condensation, 
--                                                                            -- so no water will be extracted from the incoming air. It is 
--                                                                            -- a waste of energy to replace large volumes of inside air 
--                                                                            -- by outside air unless that outside air is dryer than the
--                                                                            -- inside air.
                        ) then
                    domoticz.log('Humidity more than 3% over target', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'On'
                elseif (measured_humidity > target_humidity or domoticz.data.wc_afzuiging == true) then
                    domoticz.log('Humidity over target', domoticz.LOG_FORCE)
                    fan_middle = 'On'
--                    if (domoticz.data.niemand_thuis) then
--                        fan_high = 'On'
--                    else
                        fan_high = 'Off'
--                    end
                else
--                    domoticz.log('Humidity at or under target', domoticz.LOG_FORCE)
                    fan_middle = 'Off'
                    fan_high = 'Off'
                end
                
                local device_middle = domoticz.devices(FAN_NAME_MIDDLE)
                if (device_middle.state ~= fan_middle) then
                    domoticz.log('Fan '..device_middle.name..': '..tostring(device_middle.state)..' -> '..tostring(fan_middle)..'.', domoticz.LOG_INFO)
                    if (fan_middle == 'On') then
                        device_middle.switchOn()
                    else
                        device_middle.switchOff()
                    end
                end
                local device_high = domoticz.devices(FAN_NAME_HIGH)
                if (device_high.state ~= fan_high) then
                    domoticz.log('Fan '..device_high.name..': '..tostring(device_high.state)..' -> '..tostring(fan_high)..'.', domoticz.LOG_INFO)
                    if (fan_high == 'On') then
                        device_high.switchOn()
                    else
                        device_high.switchOff()
                    end
                end
--            else
--                domoticz.log('Fans are on manual control.')
            end
        elseif (domoticz.EVENT_TYPE_VARIABLE == triggerInfo.type) then
                domoticz.log( 'variable event: '..tostring(triggerInfo.trigger)..'.')
        elseif (domoticz.EVENT_TYPE_SECURITY == triggerInfo.type) then
            domoticz.log( 'security event: '..tostring(triggerInfo.trigger)..'.')
        end
    end
}
Last edited by rrozema on Thursday 13 September 2018 14:50, edited 3 times in total.
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Automating my WTW (ventilation unit)

Post by rrozema »

rrozema wrote: Sunday 03 June 2018 23:29 My home has a forced ventilation system (Dutch: WTW-unit or Warmte-Terug-Win-unit), keeping fresh air circulating in my entire house while keeping the heat in. The unit was regulated by a switch with 3 locations similar to this:
c3-i-3-standenschakelaar-inbouw.jpg
c3-i-3-standenschakelaar-inbouw.jpg (8.74 KiB) Viewed 6919 times
. That switch was however in the kitchen so it was never switched to 3 when someone went for a shower, and if it was, it was never put back to 1 afterwards or much to soon because of the loud noise. The result: mold and stains in my bathroom and condensed windows all over the house.

My take at this problem: automate the thing!

Components (I provide links to most items at robbshop.nl because they provide so many useful examples, including the one that initiated my project. I am not affiliated to them) : Later additions: Modifications to the ventilation:
My Fender WHR 930 Basic has 3 speeds: low, medium and high, represented by 1, 2 and 3 on the switch. Advice is to never switch the system completely off, but instead leave it at 1. When cooking, showering or for whatever reason you need more air flow, switch it to 2 or even 3. So I connected 1 to mains permanently and used the double relay to switch 2 and 3 on and off. What I did was to remove the switch from the kitchen and put a plate in front of the hole left in the wall, making sure the wires were connected such that I still had 220V in the wall socket upstairs. The connector is called a perilex-connector. This type of connector was originally designated for high power devices like for example electric cooking plates. It is also often used for ventilation units like mine. I found that different ventilation brands have different wiring for the connector, so if you've got a different brand be careful to connect the wires correctly! I found this very informative image at https://www.ventilatieland.nl/blog/22/p ... latie.html (the article is very helpful, but it's in Dutch), the picture should be clear even if you don't master the language:
perilex-aansluitschema-ventilatieland_15670010083326.jpg
perilex-aansluitschema-ventilatieland_15670010083326.jpg (83.88 KiB) Viewed 6919 times
. I put the Fibaro double relay inside the WTW unit, in the area that receives the cables. So all I needed was the blue and brown wires from the perilex connector and connect the terminals of the double relay to the 2 and 3 labeled terminals of the unit.

Humidity sensors:
I put one Everspring ST814 in my bathroom and another in the kitchen. Put the batteries in, paired them in domoticz with my home's z-wave network and ready. Not much more to it, really.

Connecting it all together:
I first copied bits of scripts found all over the internet, mostly in LUA, later I did a full rewrite in dzVents. This is when I really got carried away and added all sorts of features that made the script look rather impressive at first, but that's just because it does so much :-). I do not have earlier (simpler) versions of the script any more, so I am going to give you what I've got right now and tell you what it does later on:

Code: Select all

local FAN_NAME_HIGH = 'Ventilatie: Hoog'
local FAN_NAME_MIDDLE = 'Ventilatie: Midden'

local KEUKEN_SENSOR_NAME = 'Keuken'
local BADKAMER_SENSOR_NAME = 'Badkamer'
local WASHOK_SENSOR_NAME = 'Washok'
local CO_SENSOR_NAME = 'CO Sensor'
local BUITNE_SENSOR_NAME = 'Buiten'

local HUMIDITY_SETTING_DEVICE_NAME = 'Humidity setting'

local QUIET_SWITCH_NAME = 'Slaaptijd'
local WC_AFZUIGING_SWITCH_NAME = 'WC Afzuiging'
local NIEMAND_THUIS_SWITCH_NAME = 'Niemand thuis'

return {
    on = {
        devices = { 
            BADKAMER_SENSOR_NAME,
            KEUKEN_SENSOR_NAME,
            WASHOK_SENSOR_NAME,
            BUITEN_SENSOR_NAME,
            HUMIDITY_SETTING_DEVICE_NAME,
            QUIET_SWITCH_NAME,
            WC_AFZUIGING_SWITCH_NAME,
            NIEMAND_THUIS_SWITCH_NAME,
            CO_SENSOR_NAME
        }
    },
    data = { 
            humidityTarget = {initial = 60},
            humidityBinnen = {initial = 0},
            humidityBuiten = {initial = 0},
            tempBuiten = {initial = 0},
            tempBinnen = {initial = 0},
            manual = {initial = false},
            CODetected = {initial = false},
            quiet_time = {initial = false},
            niemand_thuis = {initial = false},
            wc_afzuiging = {initial = false}
        },
    execute = function(domoticz, device, triggerInfo)
        if (domoticz.EVENT_TYPE_TIMER == triggerInfo.type) then
            domoticz.log( 'timer event: '..tostring(triggerInfo.trigger)..'.')
            
        elseif (domoticz.EVENT_TYPE_DEVICE == triggerInfo.type) then
            domoticz.log( 'device event: '..device.name..', deviceType: '..device.deviceType..'.')
            if (device.name == BUITEN_SENSOR_NAME) then
                if (domoticz.data.humidityBuiten ~= device.humidity) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.humidityBuiten)..' -> '..tostring(device.humidity)..'.', domoticz.LOG_FORCE)
                    domoticz.data.humidityBuiten = device.humidity
                end
                if (domoticz.data.tempBuiten ~= device.temperature) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.tempBuiten)..' -> '..tostring(device.temperature)..'.', domoticz.LOG_FORCE)
                    domoticz.data.tempBuiten = device.temperature
                end
            elseif (device.name == CO_SENSOR_NAME) then
                if ((device.state == 'On' and domoticz.data.CODetected ~= true) or (device.state == 'Off' and domoticz.data.CODetected ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.CODetected)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.CODetected = (device.state == 'On')
                end
            elseif (device.name == QUIET_SWITCH_NAME) then
                if ((device.state == 'On' and domoticz.data.quiet_time ~= true) or (device.state == 'Off' and domoticz.data.quiet_time ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.quiet_time)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.quiet_time = (device.state == 'On')
                end
            elseif (device.name == NIEMAND_THUIS_SWITCH_NAME) then
                if ((device.state == 'On' and domoticz.data.niemand_thuis ~= true) or (device.state == 'Off' and domoticz.data.niemand_thuis ~= false)) 
then
                    domoticz.log(device.name..': '..tostring(domoticz.data.niemand_thuis)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.niemand_thuis = (device.state == 'On')
                end
            elseif (device.name == WC_AFZUIGING_SWITCH_NAME) then
                if ((device.state == 'On' and domoticz.data.wc_afzuiging ~= true) or (device.state == 'Off' and domoticz.data.wc_afzuiging ~= false)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.wc_afzuiging)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.wc_afzuiging = (device.state == 'On')
                end
            elseif (device.name == HUMIDITY_SETTING_DEVICE_NAME) then
                if (device.level ~= domoticz.data.humidityTarget) then
                    -- My humidity sensors won't indicate higher than 90%, so I don't allow
                    -- a setting higher than 90% either or the fans will never stop.
                    domoticz.data.humidityTarget = math.min(device.level, 90)
                    if (device.level ~= domoticz.data.humidityTarget) then
                        domoticz.log(device.name..': '..tostring(device.level)..' -> '..tostring(domoticz.data.humidityTarget)..'.')
                        device.switchSelector(domoticz.data.humidityTarget)
                    end
                end
                domoticz.log(device.name..': '..tostring(domoticz.data.manual)..' -> '..tostring(device.state == 'On')..'.')
                if ((device.state == 'On' and domoticz.data.manual ~= false) or (device.state == 'Off' and domoticz.data.manual ~= true)) then
                    domoticz.log(device.name..': '..tostring(domoticz.data.manual)..' -> '..tostring(device.state == 'On')..'.')
                    domoticz.data.manual = (device.state ~= 'On')
                end
            elseif (device.name == KEUKEN_SENSOR_NAME or device.name == BADKAMER_SENSOR_NAME or device.name == WASHOK_SENSOR_NAME) then
                local sensors = domoticz.devices().filter({ KEUKEN_SENSOR_NAME, BADKAMER_SENSOR_NAME, WASHOK_SENSOR_NAME})
                local max_humidity = sensors.reduce(
                        function(acc, device)
                            if (acc == nil or device.humidity > acc) then
                                acc = device.humidity
                            end
                            return acc -- always return the accumulator
                        end, 
                        nil) -- nil is the initial value for the accumulator
                if (max_humidity ~= nil) then
                    if (domoticz.data.humidityBinnen ~= max_humidity) then
                        domoticz.log(device.name..': max humidity '..tostring(domoticz.data.humidityBinnen)..' -> '..tostring(max_humidity)..'.', domoticz.LOG_INFO)
                        domoticz.data.humidityBinnen = max_humidity
                    end
                end
                local max_temperature = sensors.reduce(
                        function(acc, device)
                            if (acc == nil or (math.floor(device.temperature * 10 + 0.05)) / 10 > acc) then
                                acc = math.floor(device.temperature * 10 + 0.05) / 10
                            end
                            return acc -- always return the accumulator
                        end, 
                        nil) -- nil is the initial value for the accumulator
                if (max_temperature ~= nil) then
                    if (domoticz.data.tempBinnen ~= max_temperature) then
                        domoticz.log(device.name..': max temperature '..tostring(domoticz.data.tempBinnen)..' -> '..tostring(max_temperature)..'.', domoticz.LOG_INFO)
                        domoticz.data.tempBinnen = max_temperature
                    end
                end
            end


            if (domoticz.data.CODetected == true or domoticz.data.manual ~= true) then
                local fan_middle
                local fan_high
                
                if (domoticz.data.CODetected == true) then
--                    domoticz.log('CO detected!', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'On'
                elseif (domoticz.data.humidityBinnen >= 90 and domoticz.data.quiet_time ~= true) then
--                    domoticz.log('humidity >= 90%', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'On'
                elseif (domoticz.data.humidityBinnen > domoticz.data.humidityTarget + 3 
                                                                            -- If the humidity is more than 3% over the target, set 
                                                                            -- ventilation to "high".
                        and domoticz.data.quiet_time ~= true                -- But, during the night I don't want the fans to go
                                                                            -- howling, even if it's wet.
                        and (math.abs(domoticz.data.tempBinnen - domoticz.data.tempBuiten) >= 2
                            or domoticz.data.humidityBinnen > domoticz.data.humidityBuiten)) then
                                                                            -- And, if there is hardly no temperature difference between 
                                                                            -- inside and outside, my WTW will not have any condensation, 
                                                                            -- so no water will be extracted from the incoming air. It is 
                                                                            -- a waste of energy to replace large volumes of inside air 
                                                                            -- by outside air unless that outside air is dryer than the
                                                                            -- inside air.
--                    domoticz.log('Humidity more than 3% over target', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'On'
                elseif (domoticz.data.humidityBinnen > domoticz.data.humidityTarget or domoticz.data.wc_afzuiging == true) then
--                    domoticz.log('Humidity over target', domoticz.LOG_FORCE)
                    fan_middle = 'On'
                    fan_high = 'Off'
                else
--                    domoticz.log('Humidity at or under target', domoticz.LOG_FORCE)
                    fan_middle = 'Off'
                    fan_high = 'Off'
                end
                
                local device_middle = domoticz.devices(FAN_NAME_MIDDLE)
                if (device_middle.state ~= fan_middle) then
                    domoticz.log('Fan '..device_middle.name..': '..tostring(device_middle.state)..' -> '..tostring(fan_middle)..'.', domoticz.LOG_INFO)
                    if (fan_middle == 'On') then
                        device_middle.switchOn()
                    else
                        device_middle.switchOff()
                    end
                end
                local device_high = domoticz.devices(FAN_NAME_HIGH)
                if (device_high.state ~= fan_high) then
                    domoticz.log('Fan '..device_high.name..': '..tostring(device_high.state)..' -> '..tostring(fan_high)..'.', domoticz.LOG_INFO)
                    if (fan_high == 'On') then
                        device_high.switchOn()
                    else
                        device_high.switchOff()
                    end
                end
            end
        elseif (domoticz.EVENT_TYPE_VARIABLE == triggerInfo.type) then
                domoticz.log( 'variable event: '..tostring(triggerInfo.trigger)..'.')
        elseif (domoticz.EVENT_TYPE_SECURITY == triggerInfo.type) then
            domoticz.log( 'security event: '..tostring(triggerInfo.trigger)..'.')
        end
    end
}

Features:
  • a user controllable switch for desired humidity
  • automatically set ventilation to 2 if any of the sensors indicates a humidity over the desired value
  • auttomatically set ventilation to 3 if any of the sensors indicates a humidity of more than 3% over the desired value
  • a sleep timer that prevents going to 3 during night time
  • upon CO detection set fans to full power for fresh air
  • set to 2 for some time when the light in the restroom goes on
  • manual override from Domoticz
  • Uses device triggers only, so no constantly polling the network. Only responding to changes in the environment.
I've used several dummy switches to make controlling the ventilation easy. A dimmer switch 'Humidity setting' can be used to set the desired humidity percentage. I try yo keep mine at 60%. The same switch can be used to set the ventilation to manual control by clicking the icon. I've used another script to automatically set it back to automatic after 4 hours in case we forget to do it ourselves. Next I have 2 more normal dummy switches: 1 'Slaaptijd' to indicate night time, preventing the ventilation to go to 3 -high to keep the noise down during the night, and another 'WC afzuiging' that is switched on when the light in the rest room goes on and resets after 5 minutes. This last one switches the ventilation to 2 if it was off.
Ventilatie buttons.JPG
Ventilatie buttons.JPG (67.94 KiB) Viewed 6919 times
I hope you like my solution. In my house it makes for better living conditions: when I first started running it the relative humidity could not go under 80%, now that it has been running for a longer period, much of the water has been removed from my house and I most of the times get it back to 60% within 1,5 to 2 hours after someone has taken a shower. Even though my WTW does a great job removing water from the air, this is only a side effect of it's operation. It was not designed as a de-humidifier. It needs a temperature difference between the inside air and the inside air to have this effect. If the outside air is almost the same temperature as the inside air, the humidity will almost not go down and the fans will remain at full power all day. This is why I have the manual override in place: during summer time I either set the percentage higher or I switch to manual operation. My wife likes to have the windows and doors open in summer anyway. ;-)

I know this solution is far to specific to be used as-is by any one else. But I hope someone likes the ideas in it and can use it to build their system the way they like it.


Considerations:
*1 - Zehnder also sells a remote controlled WTW unit, which -as I later found out- is regulated by 0-10 volt internally. Qubino's Flush Dimmer 0-10V would have been perfect companion to that device, making an even more advanced -semi analog controlled- system possible. If only I had known this before, I had spent the extra 100 euro or so for this remote controlled unit.
*2 - The Everspring ST814 was recommended by Robbshop.nl for their ventilation project. Their project was however for a single measuring device only, where mine has multiple inputs throughout the house. As a result I can't use the upper and lower settings that robbshop selected it for. In hindsight I would have bought other devices. These are bulky/ugly, plus one of my 2 devices drains it's batteries very fast (3xAA need to be replaced every 2 weeks or so). This one device must be defective as the other still runs on its original set of batteries after at least 6 months now, however the shop I ordered it at has closed since... So I replaced it with an Aeotec multi sensor 6, which works almost just as fine and has additional sensors like motion.
Ventilatie buttons.JPG
Ventilatie buttons.JPG (67.94 KiB) Viewed 6919 times
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Automating my WTW (ventilation unit)

Post by dannybloe »

Nice to see this coded in dzVents!
I wondered though... back in the days, when I tried to control humidity in the bathroom (before I had Domoticz and sensors) I bought a hygrostat that was controlling my ventilator and I had to program levels of humidity for which the vents went on and off. Turned out this was a nightmare and I found myself adjusting these values several times a week because the general environmental humidity just changes due to weather changes. When it rained outside it never reached the lower level and the ventilator kept turning. So then I moved to Domoticz and wrote a script that detected humidity rises and turns the vents on until the level was the same a before the rise. So if someone takes a shower there is quick rise that was detected, the vents went on and it went on until the level was like just before the rise. Works perfectly and up till this day I have such a script running and it almost always manages to get rid of extra unwanted humidity. So, when I saw your setting for an exact humidity level my immediate reaction was: this is not going to work well.

Or am I missing something here?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Automating my WTW (ventilation unit)

Post by rrozema »

You are right, when you only move air you will be taking in more water when outside humidity is higher than inside humidity. But, a WTW-unit is not just moving air. It has a 'warmte-wisselaar' ('heat exchanger' ???) internally, basically a set of aluminum plates that on one side the incoming cold air is pushed through and on the other end the outgoing warm air is pushed through. The idea is to create a heat transfer from the outgoing air to the incoming air. By heating the incoming air, relative humidity goes down and we get 'dryer' air in the house. On the outgoing end water condenses and goes into a drain. So in winter, when there is sufficient temperature difference, it works excellently. During summer however inside temperature is often close to the outside temperature and I have to set my goal a little less sharp. In this case I just move the slide a little. So far I've managed to keep it at 63% the last few hot days whereas I've kept it at 60% during winter.

I have been playing with the idea of somehow using the dewpoint instead of the relative humidity. My feeling is this should give a more reliable result. But I haven't managed to experiment with that yet, mostly because I need to investigate further a) how to determine the dewpoint and b) what calculations are needed for it. In my script is still a remainder of an early attempt at getting the temperature involved in the regulating too. It doesn't work well yet, but I'll keep on experimenting, that's the fun part of all this :-)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Automating my WTW (ventilation unit)

Post by dannybloe »

Ah, thanks for the explanation. I'll probably get something similar in my house next year.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Automating my WTW (ventilation unit)

Post by rrozema »

I would love to add an actual de-humidifier to my system, but I'm a bit afraid of the energy costs, next to the initial costs. The initial costs are pretty high already if you want something that actually can dry a significant amount of air like that which is moved through my entire house... Maybe if I win a big price in the lottery :-)
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Automating my WTW (ventilation unit)

Post by rrozema »

For dannybloe, here's a graph of my bathroom temperature (yellow) and humidity (green). I have children and a wife that all get up and take a shower at different times. This results in multiple spikes in humidity in my bathroom. The wtw unit is thus often on. But -provided everyone pulls the water of the floor and puts their wet towels in the washbin- it gets most of the humidity out of the bathroom pretty quick every time.
humidity badkamer.JPG
humidity badkamer.JPG (35.81 KiB) Viewed 6822 times
SzuR
Posts: 11
Joined: Monday 26 February 2018 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Automating my WTW (ventilation unit)

Post by SzuR »

May thanks for the scrip. I have same one unit with same one crapy 3 state switch. I was unable ti connect through Rs232. so I decided to make only 3 ssr switch and later if i have time make my own electronic for it. It's quite simple setup two fans with pwm input, fan diagnostic, bypass relay and ntc thermometers. But lots and lots of things to do...
If i understand correctly there is a dummy switch for stage 2 and 3? I would like to add some more conditions (like fireplace starting and additional kitchen went) maybe outside your script. My scrip knowledge i 0

Wysłane z mojego D6503 przy użyciu Tapatalka

rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Automating my WTW (ventilation unit)

Post by rrozema »

Even though I've included the z-wave double switch in the wtw unit (in the plastic covering on top, not inside the metal casing as to not reduce z-wave wireless range of the switch), I have only modified the 220V wiring, not the WTW unit itself. I wanted to be able to return to the original situation without having to buy a new WTW-unit :-).

I had a look at the mains cable going from the WTW unit into the Perilex wall-outlet and saw that both N and L were fed into the WTW unit. For my Zehnder WTW-unit, these are on pins "N" and "L3" in the perilex connector (see picture in my first posts). So I removed the switch in the kitchen and put a plate on the wall box to cover the hole. Then I removed the front plate(s) of the WTW unit and disconnected all wires from the WTW unit coming in from the perilex plug. I re-used only the wires coming from N and L (most likely blue and brown), the other wires are no longer needed. I covered them with tape them for safety (even though I know for sure I disconnected the other ends). The wires coming from N and L I connected to the terminal of the WTW unit, such that the unit will always run at low speed, then I used some additional short pieces of wire to feed the same blue and brown wires into the z-wave switch and connected another wire between the L1 on the switch and medium-speed terminal on the WTW, and the last between the high-speed terminal of the WTW unit. When it is plugged in, the unit runs at low speed, and I set it to medium and/or high speed using the double z-wave switch. It doesn't matter if the unit is set to 1, 2, and 3 all at the same time, the unit will simply run at the highest speed select. In my case it will always run at 1 or 1 & 2 or 1 & 2 & 3. This is by choice because this way it is easier to see in the logs in Domoticz when the unit was running at 1, 2 or 3.
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Automating my WTW (ventilation unit)

Post by sincze »

Nicely done.
I will be porting this solution (now Mysensors) to ESPEasy when I receive the parts from my dear friend Ali E.
Brinks Renovent
Brinks Renovent
Renovent.jpeg (160.68 KiB) Viewed 6559 times
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Automating my WTW (ventilation unit)

Post by jake »

sincze wrote:Nicely done.
I will be porting this solution (now Mysensors) to ESPEasy when I receive the parts from my dear friend Ali E.
Renovent.jpeg
Can you please share your shopping list at Uncle Alie?
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Automating my WTW (ventilation unit)

Post by sincze »

jake wrote: Thursday 28 June 2018 20:14
sincze wrote:Nicely done.
I will be porting this solution (now Mysensors) to ESPEasy when I receive the parts from my dear friend Ali E.
Renovent.jpeg
Can you please share your shopping list at Uncle Alie?
As we have the same uncle and both seem to like Domoticz I certainly will.
Renovent-Ali.JPG
Renovent-Ali.JPG (26.62 KiB) Viewed 6549 times
Based on the original Idea: https://forum.mysensors.org/topic/7180/ ... -systems/3

I'll take the ESP and allow it to control the Brinks from setting '1' to '3' as usually I never use ' 2' .
As this is a nice shield and doesn't cost that much.... It is worth a shot. Flashing it with ESP Easy and have it control the relais.
Interesting would be as well if I could add the Brinks filter warning to the ESP as well. That would need at least a buckconverter to drop the voltage to 3,3v input for the ESP. Zenernode.. possible but have not tested that yet..
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
SzuR
Posts: 11
Joined: Monday 26 February 2018 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Automating my WTW (ventilation unit)

Post by SzuR »

I didn't test 1&2&3 together. I was based od schematic and manuals. I made simple 3way switch and power on in box for now and when moved in final location it will be 3 ssr. I still don't like that i have manually changed speed winter/summer but for now It must be that way. Image

Wysłane z mojego D6503 przy użyciu Tapatalka

SzuR
Posts: 11
Joined: Monday 26 February 2018 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Automating my WTW (ventilation unit)

Post by SzuR »

I found something for those who want wifi solution for 2 speedsn
ESP8266 ESP-01S 5V WiFi Relay Module Things Smart Home Remote Control Switch for Arduino Phone APP ESP01S Wireless WIFI Module
http://s.aliexpress.com/2AvARZV3?fromSns=Copy to Clipboard



Wysłane z mojego D6503 przy użyciu Tapatalka

rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Automating my WTW (ventilation unit)

Post by rrozema »

The solution has been in use for almost half a year now and since my first posting I've made some more adjustments. The latest version of my script is in my opening post.

What I've added/changed:
  • target humidity varies with outside humidity: I use the humidity from a nearby weather station to determine the outside humidity. You can use any device for my solution, as long as it is available in Domoticz. My script automatically adjusts the target humidity when the outside humidity is more than 20% higher than the humidity set by the slider. This avoids that the fans will remain on forever if the air taken in from the outside contains to much moist for my WTW to get rid of. For example -assuming a humidity of 60 is set using the slider- if the outside humidity goes up to 82%, the target humidity used to control the fans will automatically go to 82 - 20 = 62%. The slider will still be at 60%, but the fans will stop when 62% is reached. When the outside humidity goes below 80% again, the target will stay at 60%.
  • dead device detection: if one of the humidity devices runs out of battery power, this device is automatically disregarded for determining the inside humidity. (On of my devices has a problem that makes that it runs out of battery power every 2 weeks or so, this way the system doesn't behave incorrectly even if I forget to replace the batteries for a while)
  • hysteresis to 3%: if humidity is more than 3% over the target humidity, the high fan is enabled, below that only the medium fan is enabled. It is more comfortable to have the fans run a bit longer on medium than to have them run at high speed to get the humidity down as fast as possible.
SzuR
Posts: 11
Joined: Monday 26 February 2018 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Automating my WTW (ventilation unit)

Post by SzuR »

Great work
I was wondering about this problem. And now I have solution. Thanks again

Wysłane z mojego D6503 przy użyciu Tapatalka

beer78
Posts: 4
Joined: Monday 03 December 2018 15:17
Target OS: -
Domoticz version:
Contact:

Re: Automating my WTW (ventilation unit)

Post by beer78 »

Hi there,

I'm trying to add the solution of robbshop as well , but can't Figure out how the humidity sensor timeout is working i'm using the Aeotec multi sensor 6, And try to change the parameters 3, but thats the time to activevate another device and parameter 2000. But the humidity only changes every hour.

Do I Have to change the default parameters in domoticz with this lua script or is the script automatically checking the humidity every x minutes?
my setup is only one Aeotec multi sensor 6 sensor to activate the itho ventilation (max)
Remelco
Posts: 15
Joined: Sunday 16 December 2018 12:45
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Contact:

Re: Automating my WTW (ventilation unit)

Post by Remelco »

Ik wil een WTW Renovent 250 gaan schakelen met een Kaku ACM 3500-3
Helaas lukt het mij niet om een foto toe te voegen.
De WTW heeft geen perilex stekker maar een perilex printplaat. De huidige 3 standen schakelaar is met 4 draden aangesloten op de printplaat. ( gedaan door 2 kabeltjes, nu dus 2 keer blauw en 2x rood draad)
Op het aansluitblokje van de printplaat in de WTW staat P 1 2 3. De draden vanuit de 3 standenschakelaar (code P, T1, T2, T3) zijn ook zo aangesloten P op P, T1 op 1, T2 op 2 en T3 op 3.

Vraag is nu hoe sluit ik de Kaku ACM 3500-3 aan?
Deze krijgt een eigen voeding, dit zit rechts op het apparaat.
Ik denk dat de aansluiting als volg moet zijn: Uitgang L1 op printplaat 1 (N1 blauw op printplaat P?)
Uitgang L2 op printplaat 2 (N2 niet gebruiken)
Uitgang L3 op printplaat 3 (N2 niet gebruiken)
Kan de huidige 3 standenschakelaar aangesloten blijven? En dan parallel gebruikt worden.
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Automating my WTW (ventilation unit)

Post by sincze »

Remelco wrote: Monday 17 December 2018 11:05 Ik wil een WTW Renovent 250 gaan schakelen met een Kaku ACM 3500-3
Helaas lukt het mij niet om een foto toe te voegen.
De WTW heeft geen perilex stekker maar een perilex printplaat. De huidige 3 standen schakelaar is met 4 draden aangesloten op de printplaat. ( gedaan door 2 kabeltjes, nu dus 2 keer blauw en 2x rood draad)
Op het aansluitblokje van de printplaat in de WTW staat P 1 2 3. De draden vanuit de 3 standenschakelaar (code P, T1, T2, T3) zijn ook zo aangesloten P op P, T1 op 1, T2 op 2 en T3 op 3.

Vraag is nu hoe sluit ik de Kaku ACM 3500-3 aan?
Deze krijgt een eigen voeding, dit zit rechts op het apparaat.
Ik denk dat de aansluiting als volg moet zijn: Uitgang L1 op printplaat 1 (N1 blauw op printplaat P?)
Uitgang L2 op printplaat 2 (N2 niet gebruiken)
Uitgang L3 op printplaat 3 (N2 niet gebruiken)
Kan de huidige 3 standenschakelaar aangesloten blijven? En dan parallel gebruikt worden.
Ziet het er een beetje uit zoals deze cheatsheet?
https://forum.mysensors.org/post/83233

Oh ja ik zie idd een probleem met het uploaden van images: "Sorry, the board attachment quota has been reached."
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Remelco
Posts: 15
Joined: Sunday 16 December 2018 12:45
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Contact:

Re: Automating my WTW (ventilation unit)

Post by Remelco »

Hallo Sincze,

het lijkt er wel op. Het is een Brink WTW van bouwjaar 2000.
Foto's lukt niet (pm naar jou ook niet) maar misschien verduidelijkt onderstaande.

Aansluiting perilexprint in de WTW Renovent HR-CF 250

Perilexprint - aangesloten op 3 standenschakelaar
P op P
1 ,, T 1
2 ,, T2
3 ,, T 3

Moet ACM 3500-3 als volgt aangesloten worden?

Perilexprint - aangesloten op uitgang ACM 3500
P Op ACM3500 N 1
1 ,, L 1
2 ,, L 2
3 ,, L 3

En kunnen de draden vanuit de ACM bij de bestaande aansluiting van de 3 standenschakelaar in de perilexprint gestoken worden, zodat de schakelaar ook gebruikt kan blijven worden.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest