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

Posted

Hi all Fibaro developers and fanatics,

 

I can do quit a bit with LUA scene's and other Fibaro hardware tricks but I'm still struggling with a (very) simple solution for controlling the Humidity in my bathroom.

I've seen quit some solutions that are working by triggers like door open/closed, lights on/off, comparing the humidity with the values of Netatmo and so on.

 

What I'm looking for is a solution like:

A scene that is responsive to the humidity changes in my bathroom and not depends on humidity elsewhere in the house or outside.

I have one humidity sensor (AEON MS-6) in my bathroom. I want a scene that checks the humidity, let's say every 2 minutes, and checks if there is an increase or decrease of, let's say 5%,

and turns the ventilation On or Off.

 

Can someone give me a hint / example of such a code?

 

Thanks in advance!

 

TRicky

Recommended Posts

  • 0
  • Inquirer
  • Posted

    I must be a bit silly o.O but I keep on thinking: Why a comparison with other rooms and face potential differences in measurements / offsets and different temperatures of rooms?

    I still think the most simple way is compare the RH value with the value measured a minute ago (as a example).

    At a sudden increase of the RH the ventilation starts and when the first measured value is reached again the ventilation stops.

     

    Just a system that reacts to the Delta RH changes within a certain time period.

    • 0
    Posted
    8 minutes ago, TRicky said:

    I must be a bit silly o.O but I keep on thinking: Why a comparison with other rooms and face potential differences in measurements / offsets and different temperatures of rooms?

    I still think the most simple way is compare the RH value with the value measured a minute ago (as a example).

    At a sudden increase of the RH the ventilation starts and when the first measured value is reached again the ventilation stops.

     

    Just a system that reacts to the Delta RH changes within a certain time period.

     

    @TRicky

    I must be in the same camp (or perhaps a simpler one :-) ) as I just compare it against a set threshold and trigger based on that ....works fine for me...

    • 0
  • Inquirer
  • Posted

    @AutoFrank, sorry but that's too simple for me. When the overall humidity in my home changes the ventilation might start without a 'shower'-cause.

    That's the same as my current ventilator works. I have to set it at a certain humidity where it will start. But when the overall / outside humidity rises it can start without a cause.

    That's why I focus on 'sudden' changes in humidity...... 

    • 0
    Posted
    46 minutes ago, TRicky said:

    @AutoFrank, sorry but that's too simple for me. When the overall humidity in my home changes the ventilation might start without a 'shower'-cause.

    That's the same as my current ventilator works. I have to set it at a certain humidity where it will start. But when the overall / outside humidity rises it can start without a cause.

    That's why I focus on 'sudden' changes in humidity...... 

     

    @TRicky

    makes sense now

     

    thanks

    _f

    • 0
    Posted
    7 hours ago, TRicky said:

    @AutoFrank, sorry but that's too simple for me. When the overall humidity in my home changes the ventilation might start without a 'shower'-cause.

    That's the same as my current ventilator works. I have to set it at a certain humidity where it will start. But when the overall / outside humidity rises it can start without a cause.

    That's why I focus on 'sudden' changes in humidity...... 

    @TRicky I like your thinking. 

    Any chance in sharing that bath room extractor scene , its the way I want to go.

    Thanks Jamie

    • 0
    Posted
    10 hours ago, TRicky said:

    I must be a bit silly o.O but I keep on thinking: Why a comparison with other rooms and face potential differences in measurements / offsets and different temperatures of rooms?

    I still think the most simple way is compare the RH value with the value measured a minute ago (as a example).

    At a sudden increase of the RH the ventilation starts and when the first measured value is reached again the ventilation stops.

     

    Just a system that reacts to the Delta RH changes within a certain time period.

     

    That would also be fine for me, and I did think about doing it that way, only reason I didn't do it that was is because I don't like to use globals when avoidable so I figured I would try it this way first. Seems to work very well so far.

     

    • 0
  • Inquirer
  • Posted (edited)

    I found an interesting script for this. It's in LUA but written for Domoticz.

    Perhaps someone (with more LUA skills than me) is able to re-write it for Fibaro.

     

    The full article can be found here: 

    Please login or register to see this link.

     

    The script is:

    Please login or register to see this code.

    Edited by TRicky
    • 0
  • Inquirer
  • Posted

    Hmmmmm.....

     

    I was hoping that some LUA expert would pick this up and convert it to a Fibaro LUA script.

    Would be great to get some help on this one because I'm still struggling with my bathroom humidity control

     

    • 0
    Posted (edited)

    Some time ago I wrote the scene which does exactly what is expected. Somehow I did not noticed this post earlier and I did not share my stuff earlier.

     

    The  scene is working in the loop.

    If the humidity raises with certain value within the defined time it starts the defined devices. In my case Bathroom FAN, Radiator (for drying towels) and HEATING MIRROR.

    NOTE: this scene just starts the devices. Turn off in my case is done by timers of the GEA scene (see the French forum).

     

     

     

     

     

     

     

    --[[

    %% properties

    %% autostart

    %% globals

    --]]

    -- Scene starts up the devices (FAN), (MIRROR HEATING)
    -- if the air humidity (HUMIDITY SENSOR)
    -- will rise with the value defined by THRESHOLD [%]
    -- within the time defined by MEASUREMENT INTERVAL

     

     

    -- HUMIDITY SENSOR
    local sensorID = 1163

    -- MIRROR HEATING
    local lustroID = 233

    -- FAN
    local wiatrakID = 227

    -- RADIATOR
    local grzejnikID = 229

    -- THRESHOLD
    local prog = 2

    -- MEASUREMENT INTERVAL
    local interwalpomiaru = 60

    -- PAUSE AFTER DEVICES ARE STARTED (600 s.)
    local pauza = 600


    -- BEGINING OF THE ALGOTRITHM - FIRST HUMIDITY MEASUREMENT
    local wilgotnosc = tonumber(fibaro:getValue(sensorID, "value"))
    fibaro:debug("Pomiar wilgotności przed rozpoczęciem pętli = "..tostring(wilgotnosc).." %" )


    -- START OF THE LOOP
    while true do
    -----------------------------------------------------------------------------

    if fibaro:countScenes() > 1
       then
       --fibaro:debug("Scene Instance : "..fibaro:countScenes())
       --fibaro:debug("END OF THE SCENE- INSTANCE 2 --------------------------")
       fibaro:abort()
       end
    -----------------------------------------------------------------------------

    fibaro:debug('<b style="color:green;">START OF THE LOOP -----------------------------------------</b style>')
    local wilgotnosc = tonumber(fibaro:getValue(sensorID, "value"))
    fibaro:debug("First humidity measuremet = "..tostring(wilgotnosc).." %" )

    fibaro:sleep(interwalpomiaru*1000)
     
    local wilgotnosc1 = tonumber(fibaro:getValue(sensorID, "value"))
    local zmianawilgotnosci = (wilgotnosc1 - wilgotnosc)


    --this is for protection if there is false humidity reading ( > 20 % )
    if zmianawilgotnosci > 20
       then
       fibaro:debug("Humidity after "  ..tostring(interwalpomiaru).. " sek. = "..tostring(wilgotnosc1).." %" );
       fibaro:debug('<b style="color:green;">END OF THE SCENE ---- FALSE HUMIDITY MEASUREMENT</b style>');
       fibaro:debug(" ");
       else
        
       fibaro:debug("Humidity after "  ..tostring(interwalpomiaru).. " sek. = "..tostring(wilgotnosc1).." %" );
       fibaro:debug("Change of the humidity within " ..tostring(interwalpomiaru).. " sek. = "..tostring(zmianawilgotnosci).." %" );
     
       if (zmianawilgotnosci >= prog)
         then
         fibaro:call(wiatrakID, "turnOn")
         fibaro:debug('<b style="color:red;">ACTION: FAN is ON</b style>');
         fibaro:call(lustroID, "turnOn")
         fibaro:debug('<b style="color:red;">ACTION: MIRROR HEATING is ON</b style>');
         fibaro:call(grzejnikID, "turnOn")
         fibaro:debug('<b style="color:red;">ACTION: RADIATOR is ON</b style>');
       
         local i = 0  
         while i < pauza*1000
           do   
           i = i + 5000    
           fibaro:debug("PAUSE.. "  ..tostring(pauza).. " sek. COUNTER = "..tostring(i*0.001).." / "..tostring(pauza).." sek." );    
            
           fibaro:sleep(5*1000)
           end  
              
         end  
        
       fibaro:debug('<b style="color:green;">END OF THE LOOP ---------------------------------------</b style>');
       fibaro:debug(" ");
       --fibaro:sleep(1*1000)
       end  
     
    -- END OF THE LOOP
    end

     

    Edited by gucio1234
    • 0
  • Inquirer
  • Posted (edited)

    Hi @gucio1234,

     

    Thanks for your post. I already did a translation of your script from Polish to English so I can understand it better.

    Now I'm curious for your solution for turning off the fan, mirror heating and radiator.

    I'm not familiar to GEA sadly enough o.O Would you mind giving me a glimpse of it?

     

    TRicky

     

    Translated version deleted ;)

    Edited by TRicky
    • 0
    Posted

    @TRicky,

     

    I translated only comments and debugs because I did not want to make any mistake within the code (especially I am after whole busy weekend of the server room rebuilt at my job).

     

    You can find the GEA to download here :

     

    Please login or register to see this link.

     

    and some more on it here :

     

    Please login or register to see this link.

     

     

     

    And here is my user's section of GEA ( you can compare  the IDs of the devices in my "humidity" scene and in "GEA") :

     

     

    -- Ajouter ici les événements à exécuter / Add here events to schedule
    -- Une liste d'exemples est disponible dans un fichier annexe samples.lua / A samples list is available in another file called samples.lua
    function setEvents()


    GEA.add(227, 10*60, "BATHROOM - FAN was ON for more than 10 minutes, TURN OFF", {{"turnOff"}})
    GEA.add(233, 10*60, "BATHROOM - MIRROR HEATING was ON for more than 10 minutes, TURN OFF", {{"turnOff"}})
    GEA.add(229, 60*60, "BATHROOM - RADIATOR was on for more than 60 minutes, TURN OFF", {{"turnOff"}})

     end

     

     

     

    • 0
  • Inquirer
  • Posted

    Thanks @gucio1234,

     

    Looks like I have some studying to do......

    And I also have to upgrade my French a bit ;)

     

    But thanks again for helping me to get any further on this!

    And have a good night after working that long at your job!

     

    TRicky

    • 0
    Posted

    @TRicky,

     

    You have ready made solution.

     

    1. Download GEA scene and run it on your HC2

     

    2. Run my scene for humidity check (adjust devices IDs, humidity threshold, interval between measurements)

     

    3. Add conditions into GEA  :

     

    GEA.add(229, 60*60, "BATHROOM - RADIATOR was on for more than 60 minutes, TURN OFF", {{"turnOff"}})

     

    means :

     

    If device with ID 229 is turned ON for 60*60 seconds  (60 minutes) then turn it OFF and print DEBUG message "BATHROOM - RADIATOR was on for more than 60 minutes, TURN OFF"

    • 0
    Posted

    @TRicky,

     

    You made a translation but did you tested it in your system before placing the translated code here ?

    I see at least one problem.

     

    My name of selected (I did not check whole script) local variables were defined with one word and you translated them to two words - which is not gonna work.  Tha was why I avoided to touch the code of the script, I just translated debugs and comments.

     

    NAMES OF THE VARIABLES IN ORIGINAL SCRIPTS                             CORRESPONDING NAMES IN TRICKY's TRANSLATION

     

    zmianawilgotnosci                                                                                       Delta Humidity

    interwalpomiaru                                                                                           Measurement Interval

     

    ... there may be some more, but I did not compare the scripts to every detail

     

     

    As you translation would not work as the scene to be used in the HC2 I would suggest that you delete it to avoid confusion.

     

     

     

     

    Second thing is I do not understand why the script in my post became crossed out and I cannot edit it.

    It looks like Forum changed it somehow (maybe when TRicky copied this and pasted for translation ... ??) Any idea .. ?

     

     

     

     

    • 0
    Posted (edited)

    Just thought I'd add my humidity control script in here as well for others to pick at if interested.

     

    I've got two bathrooms and a laundry each with an Aeon 6-in-1 and a central fan with a Fib Dimmer 2 attached.

     

    I'm not using HomeTable.

     

    Please login or register to see this code.

     

    Edited by Tor Magnus
    • Like 1
    • 0
  • Inquirer
  • Posted

    Hi @Tor Magnus,

     

    Thnx for your post!!!

    This is the solution I was looking for!

    I adjusted it to my situation and it's running well.

    The only item I have is that I use 2 AEON MS5's in the surrounding rooms and a AEON MS6 in my bathroom.

    The MS5's and  the MS6  report different humidity values so I need a offset to get them on the same level.

     

    One other issue is that, when looking at the debugs, one debug gives humidity values with no decimals and the next one gives a value with 12 decimals.

    That's kind of strange......

     

    But thanks a bunch for the script!

     

    TRicky

     

    Please login or register to see this attachment.

    • 0
    Posted (edited)

    Re rounding. The reason I'm rounding the last debug line is so that it's not wrapping the line. I think I've commented out the debug for the individual devices on my box. 

     

    Replace the device line with the following to round to 2 decimals:

    Please login or register to see this code.

    You might also want to play around with the threshold values to optimise the system in your case.

     

    I'm presuming that you're using the deviceModifier variable to offset the values? (It's what it's for. :))

    Edited by Tor Magnus

    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...