Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Question

Guest muhmuh
Posted

Hello,

im looking for a HC3 Script which switch a Bathroom Fan on/off with dependency relative humindity.

I found a HC2 Script from kapitano1 (https://forum.siio.de/t/lua-taupunktlueftung-im-keller/5206)

My Lua skill is very low, so i tried to change the code to hc3 and add my ids.

The script will run correctly when humidInAbs - humidOutAbs > 1 but the switch off fan code is not correct.

And sorry for my english, but it is not my native language; i tried my best.

Can anyone correct it please?
Debug:
28.08.2020] [12:44:00] [DEBUG] [SCENE218]: - 28.08.2020 12:44:00 AußenTemp 21.59°C rel. Feuchtigkeit 57.0%
[28.08.2020] [12:44:00] [DEBUG] [SCENE218]: - 28.08.2020 12:44:00 absolute Luftfeuchtigkeit Außen 10.969697021231g/m³
[28.08.2020] [12:44:00] [DEBUG] [SCENE218]: - 28.08.2020 12:44:00 InnenTemp 25.4°C rel. Feuchtigkeit 51.0%
[28.08.2020] [12:44:00] [DEBUG] [SCENE218]: - 28.08.2020 12:44:00 absolute Luftfeuchtigkeit Innen 12.211619119493g/m³
[28.08.2020] [12:49:00] [ERROR] [SCENE218]:

Please login or register to see this code.

 

 

Recommended Posts

  • 0
Posted
2 minutes ago, ErikP said:

which script are you referring to here? Can you share?


That is a specific script for my home situation based on the absolute humidity algorithm of muhmuh. 

  • 0
Posted (edited)

These are the quickapp variables you need to define:

 

tOutside

hOutside

tInside (if not, the current room temperature sensor will be used)

hInside (if not, the current room humidity sensor will be used)

pressure (if not, then 1013 will be used)

switch (your fan) 

hygro_hysteresis_up (if not, then 1)

hygro_hysteresis_dn (if not, then 2)

 

if you use the buienradar weather air pressure child device, you need to change the code a bit. Here the response gets multiplied by 10 to go from kPa to Millibar. But the buienradar Weather is in hPA, so doesn’t need the * 10

 

 

function QuickApp:check()
    local pressure = 1013 -- Standard sea level pressure is 1013 hPa
    if pressureId then
        pressure = fibaro.getValue(pressureId, "value") * 10 -- kPa to Millibar
    end

 

 

 

 

Edited by SmartHomeEddy
  • 0
Posted
11 minutes ago, SmartHomeEddy said:


If you don’t add them in the quickapp variable, the default temperature and humidity sensor of the room where the quickapp is in, will be used.

 

local room = api.get("/rooms/" .. (fibaro.getRoomID(self.id) or 0))
    if room ~= nil then
        temperatureInsideId = room.defaultSensors.temperature
        humidiryInsideId = room.defaultSensors.humidity
    end

 

 

 

 

 

Ah ok, clear, thanks. Unfortunately that does not seem to work.

I got this back from console debug:
[WARNING] [QUICKAPP790]: Variable tInside not found[11.11.2022] [22:03:21] [WARNING] [QUICKAPP790]: Variable hInside not found

Though I have set default humidity and temperature sensor of that room...

  • 0
Posted (edited)

Yes, the code checks for the quickapp variable, if not, warns and uses the room defaults. So nothing to worry. Maybe the warning should be … not found, using default sensor … (id and name)


 

First here:

 

local room = api.get("/rooms/" .. (fibaro.getRoomID(self.id) or 0))
    if room ~= nil then
        temperatureInsideId = room.defaultSensors.temperature
        humidiryInsideId = room.defaultSensors.humidity
    end


 

and then here to check for the quickapp variable

 

local _temperatureInsideId = tonumber(self:getVariable("tInside"))
    if _temperatureInsideId then
        temperatureInsideId = _temperatureInsideId
    elseif not temperatureInsideId then
        self:warning("tInside is not configured")
        return
    end

 

    local _humidiryInsideId = tonumber(self:getVariable("hInside"))
    if _humidiryInsideId then
        humidiryInsideId = _humidiryInsideId
    elseif not humidiryInsideId then
        self:warning("hInside is not configured")
        return
    end
Edited by SmartHomeEddy
  • 0
Posted

This is the logic to turn the ventilation on or off

 

local currentState = false
    if switchId then
        currentState = fibaro.getValue(switchId, "value")
    end
    local diff = round(inside) - round(outside)
    local needVentilation  = nil

 

    local hygro_target_on = hygro_target + hygro_hysteresis_up
    local hygro_target_off = hygro_target - hygro_hysteresis_dn

 

    if (currentState == false and diff >= hygro_target_on) then
        needVentilation = true
    elseif (currentState == true and diff <= hygro_target_off) then
        needVentilation = false
    else
        -- hysteresis
    end

 

 

 

 

 

  • 0
Posted

@SmartHomeEddy, thanks, thought that var target the badroom hum sensor was ?. So that messed-up the calculation.

Will try to hardcode the var tInside and hInside because it seems my room defaults give an error. Thanks!

  • 0
Posted

You’re welcome. 
 

With absolute humidity it works great overhere for some years now. 

  • 0
Posted

i'd like to know, what brand sensor are you guys using.

 

I'm looking at this this one at the moment.

 

Please login or register to see this link.

  • 0
Posted

In the bathroom I use a Everspring ST814 temperature and humidity sensor. Looks ugly, works great, but no longer for sale. If someone knows where to still buy one, let me know, I will buy them all. 
 

In the living room I use a MCO Home CO2 sensor (next to CO2, also with temperature and humidity)

 

And also in the living room I use a DIY air quality sensor (like on 

Please login or register to see this link.

) with next to temperature and humidity, also pm1, pm2.5, pm4, pm10 (with the sensirion SPS30 sensor). 
 

All together they control my ventilation. 

 

  • Like 1
  • 0
Posted

Very nice, little expensive. I'll think i wil start with the aeotec for the bathroom.

 

But then again, i first have to build my little NRF905 transceiver :)

 

 

  • 0
Posted

The MCOhome CO2 sensor is around 125 euro. But CO2 measurements are maybe just as important as humidity. 
 

Aeotec also has fine products. 

  • 0
Posted
1 hour ago, ppeterr said:

i'd like to know, what brand sensor are you guys using.

 

I'm looking at this this one at the moment.

 

Please login or register to see this link.

I would recommend a powered sensor because of the refresh speed communication with HC. So I would say the aerq is not most suited for this purpose. I use the aeotec multisensor 6 which works fine and they also have a version 7 now but not sure what the difference is except the price ;-)

  • 0
Posted

That is what is nice of the Everspring sensor. It is battery powered (AA batteries) and has a threshold when to communicate. So if the humidity (or temperature) changes beyond that threshold, the HC3 gets it info. It doesn't communicate all the time, only when the measurements change. The batteries work more than a year. 

 

I don't know if the Aeotec has that functions. 

  • 0
Posted
45 minutes ago, ErikP said:

I would recommend a powered sensor because of the refresh speed communication with HC. So I would say the aerq is not most suited for this purpose. I use the aeotec multisensor 6 which works fine and they also have a version 7 now but not sure what the difference is except the price ;-)

 

Not sure if i understand you correctly, the aerq has a cell battery. 

And the 7 and 6 version are also battery powerd (or USB)

  • 0
Posted

Aeotec 7 has Zwave 700 chip

Aeotec 6 has Zwave plus chip

  • 0
Posted
4 hours ago, ppeterr said:

 

Not sure if i understand you correctly, the aerq has a cell battery. 

And the 7 and 6 version are also battery powerd (or USB)

Indeed so version 6 or 7 you should use in usb mode. When on battery and with aerq you have only battery mode. To conserve battery reports to console are not realtime. So in this use case not ideal because I guess you want the fan to kick in directly when needed....
Thanks Sjakie for pointing out the difference 

  • 0
Posted
22 minutes ago, ErikP said:

Indeed so version 6 or 7 you should use in usb mode. When on battery and with aerq you have only battery mode. To conserve battery reports to console are not realtime. So in this use case not ideal because I guess you want the fan to kick in directly when needed....
Thanks Sjakie for pointing out the difference 

 

Oke, not sure if thats good for my situation. I only have one power outlet next to

the sink in the bathroom. And i dont think its a good idea to put a adaptor there.

Also i dont have big delays with my other sensors, movement, lux, etc are almost instant.

 

  • 0
Posted

I placed my adapter in ceiling lamp >>>safe! with flat contra plug

  • 0
Posted
10 minutes ago, Sjakie said:

I placed my adapter in ceiling lamp >>>safe! with flat contra plug

 

Ah yeah, thats actually a nice solution. But i have 3 small spots, so not really space for that.

Maybe i can use the bathroom cupboard, that has some led lightning in there.

 

But then again, a am no electrician. Not a good idea :) ???

  • 0
Posted

with a small contra plug you don't need so much space

 

Please login or register to see this link.

 

connect brown and blue to contra plug

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...