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


  • 0

Fan - Humidity Control Scene


petergebruers

Question

A while ago, I joined a discussion about controlling a bathroom fan (not a whole house ventilation), by means of a single humidity sensor.

This inspired me to clean up my running code and share it with you.

 

VERY IMPORTANT! Only use this script with an Aeotec MultiSensor 6 aka MS6 aka "the square one". I have extensively tested several "MultiSensors" and only MS6 meets its specifications! The older, round MultiSensor and MultiSensor Gen5 have very bad temperature & humidity response (up to 12 percent-point deviation) so they are not good. If I ever find the time, I'll post a calibration procedure and test results of several sensor. I also tested several DIY sensors on a Z-Uno and they can be used as well... but not the old MS!

 

 

This script uses one, and only one humidity sensor. Because I am convinced, that this is all you need. You can device clever scripts, based on several sensors or weather stations or weather forecast... But in the end this adds complexity and you'll have a hard time convincing me multi-sensor works better!

 

If you want to learn more about my motivation to script it in this particular way, please read:

 

 

In fact, before I talk about the control scene, I'd like to share script to monitor your setup.

 

It is a script which filters your event log, and puts fan and humidity data in your debug window. The log script enables you to check if the control script runs as expected.

 

The Lua code demonstrates: filtering the event log, sorting data,  and outputting data as html or plain text.

 

The log output looks similar to this:

 

Please login or register to see this attachment.

 

Since I took that screenshot I decided it was nicer to reverse the order. If you look at the script you'll see that's only a matter of changing > to <

 

You might notice the fan device has a value... This script can control a fan connected to a dimmer or a switch and the scene automatically detects the difference. I recommend a dimmer only for small fans; < 30 W. For Dimmer 2: set parameter 30 = 0 to force "leading edge control".

 

Features:

  • You can test this script by selecting one dimmer in your house as the "sensor" and another one as the "fan".
  • You can set a parameter to speed up al timers (e.g. turn "minutes" into "seconds") to easy debugging.
  • Requires only one humidity sensor.
  • Can control a fan on a switch or a dimmer. Uses undocumented code, but I guess this is pretty safe to use.
  • Contains lots of comments and lots of debugging.
  • Debugging is easily removed, check comments.
  • Limits fan runtime and does retries.
  • Uses autostart, script recovers from reboot.

 

This scene has not been tested by anyone else, so please run it, check it and share what think, so I can improve it!

 

Note: if you do not have a means to dry your air, which you probably do not have, the control of humidity depends on outdoor conditions. I live in Belgium... According to www.weatheronline.co.uk "The climate of Belgium can be classified as Cfb Climate; a warm temperated humid climate with the warmest month lower than 22°C over average and four or more months above 10°C over average."

 

Please login or register to see this attachment.

 

Please login or register to see this attachment.

 

Edited by petergebruers
  • Like 2
Link to comment
Share on other sites

Recommended Posts

  • 0

hi peter,

 

this is my mech fan: 

Please login or register to see this link.

 

 

and this is the complete setup incl a fibaro rgbw module: 

Please login or register to see this link.

 

 

can't make it any nicer for you ;-) 

 

ps. sorry about the dutch articles. 

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 1 hour ago, emielstroeve said:

    hi peter,

     

    this is my mech fan: 

    Please login or register to see this link.

     

     

    and this is the complete setup incl a fibaro rgbw module: 

    Please login or register to see this link.

     

     

    can't make it any nicer for you ;-) 

     

    ps. sorry about the dutch articles. 

     

     

    Thanks! Nice setup. I'll translate for non-dutch capable people.

     

    For me, it does not qualify as a bathroom fan. :-) However, you bring up an interesting topic: modern houses should have forced ventilation. This comes, by and large, as a central unit. Typically, they are set to run continuously, with a manual speed control. Or, more advanced, controlled by adding sensors and timers... So you decided to add the sensors yourself and use the HC to control the speed. I see why you need two sensors: one to monitor air control and one to check humidity.

     

    Your fan has a DC motor and according to the first link it comes with 3 speed control out of the box. List price: 250 EUR (fan unit only).

     

    Then you added the item described in the second article:

     

    Please login or register to see this link.

     

    List price 35 EUR.

     

    So with that setup you get continuous control of fan speed, which is nice...

     

    I have no ambition to modify my script, to support such a setup... sorry about that. I can only test it on a simple bathroom fan... 

     

    I do appreciate the time and effort you put into answering my questions! I bet you have helped other people!

    Link to comment
    Share on other sites

    • 0

     Right now cold, hitter working and I have humility values(see pictures): outside 79.3%, living room 36% and bathroom  38%(nobody takes shower) 

     In the summer time, hitter off and I have humility values(approximately): outside 70%(no rain), living room 65% and bathroom 60%(towel dryer work all the time).

     What setting you can recommend to use your program?

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 46 minutes ago, IKCN said:

     Right now cold, hitter working and I have humility values(see pictures): outside 79.3%, living room 36% and bathroom  38%(nobody takes shower) 

     In the summer time, hitter off and I have humility values(approximately): outside 70%(no rain), living room 65% and bathroom 60%(towel dryer work all the time).

     What setting you can recommend to use your program? (...)

     

    Am I correctly assuming you are going to control an extraction fan, and fresh air is coming from the house?

     

    Just try the defaults.

     

    For humidity this is:

     

    local humidityUpperLimit = 75
    local humidityLowerLimit = 70

     

    Then use my logging script from post #1 to check if everything is OK.

     

    Please check if these parameters do what you want. It is a personal preference, I like the delay at the start but some don't...

     

    -- delayMinutes delays the start of the fan, when humidity first exceeds
    -- its threshold. This avoids turning on the fan while you are in the
    -- shower. Can be set to 0.
    local delayMinutes = 20

     

    -- fanRunMinutes limits the maximum amount of time the fan can run
    -- without interruption. The assumption is, if the fresh air is humed,
    -- the fan could run forever. Used with fanSleepMinutes to determine an
    -- on/off regime. Note: stopping and starting this scene resets this timer.
    local fanRunMinutes = 2*60

     

    -- fanSleepMinutes determines how long the fan should stay off, after
    -- fanRunMinutes was exceeded. The assumption is, weather conditions will
    -- have changed after several hours, so it is worth trying again.
    local fanSleepMinutes = 4*60

    Link to comment
    Share on other sites

    • 0
    5 minutes ago, petergebruers said:

     

    Am I correctly assuming you are going to control an extraction fan, and fresh air is coming from the house?

     

    Just try the defaults.

     

    For humidity this is:

     

    local humidityUpperLimit = 75
    local humidityLowerLimit = 70

     

    Then use my logging script from post #1 to check if everything is OK.

     

    Please check if these parameters do what you want. It is a personal preference, I like the delay at the start but some don't...

     

    -- delayMinutes delays the start of the fan, when humidity first exceeds
    -- its threshold. This avoids turning on the fan while you are in the
    -- shower. Can be set to 0.
    local delayMinutes = 20

     

    -- fanRunMinutes limits the maximum amount of time the fan can run
    -- without interruption. The assumption is, if the fresh air is humed,
    -- the fan could run forever. Used with fanSleepMinutes to determine an
    -- on/off regime. Note: stopping and starting this scene resets this timer.
    local fanRunMinutes = 2*60

     

    -- fanSleepMinutes determines how long the fan should stay off, after
    -- fanRunMinutes was exceeded. The assumption is, weather conditions will
    -- have changed after several hours, so it is worth trying again.
    local fanSleepMinutes = 4*60

     

    So, fan going to stop running when humidity level 70%?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 minutes ago, IKCN said:

     

    So, fan going to stop running when humidity level 70%?

     

    Yes. Starts at 75, stops at 70. I suspect there is a another, hidden question behind your question... What is your fear, angst, uncertainty or doubt?

    Link to comment
    Share on other sites

    • 0
    8 minutes ago, petergebruers said:

     

    Yes. Starts at 75, stops at 70. I suspect there is a another, hidden question behind your question... What is your fear, angst, uncertainty or doubt?

     

    I hardly believe that humidity values should be dynamic and you make it static. I try to understand your point of view. So you think that humidity level 70=bathroom dry.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 37 minutes ago, IKCN said:

     

    I hardly believe that humidity values should be dynamic and you make it static. I try to understand your point of view. So you think that humidity level 70=bathroom dry.

     

    By "I hardly believe that humidity values should be dynamic" you probably mean: "I TRULY believe that humidity values should be dynamic"? Because the way you wrote it, it means "I cannot believe ..." which does not agree with the rest of your post.  If you think "levels must be dynamic,,I value your opinion, but I disagree. No, they do not have to be dynamic, to control humidity level. It depends on your goal, and how you define "control".  Yes, I do believe that 75% is OK. Feel free to lower it by 5 or 10 % , it will work for you because you have fresh, dry air...

     

    If your goal is to keep humidity *as low as possible, always*, this script is simply not for you, please do not use it.  When I find the time, I'll rewrite post #1 to summarize everything that has been said and my motivation behind the script. I fully understand that my current introduction is lacking... For now, can I point you to some of my previous posts?

     

     

    This user does not have a bathroom fan. Instead, he uses a central fan aka "Whole-house ventilation" system, so this changes the goal too:

     

    If after reading through this topic - and especially the posts above, do you still think something needs to be added to the discussion? Please do so, I am always interested! But please keep in mind, I am never going to adapt this scene to include data from other sensors. The goal of this script is to control humidity, with one sensor only.

     

    So, after reading this post, what do you think? Are you ging to try my scene or do you want another one, with dynamic limits?

    Edited by petergebruers
    Link to comment
    Share on other sites

    • 0

    So I'm back after a while, I had another important project (and no, I wasn't in jail lol)

    Regarding this humidity topic:

    I tested the script of @petergebruers and compared it with my own (and @Tor Magnus) script.

    I have to say that my scripts works better in real life. Sorry @petergebruers

    My biggest comment / problem in all the Humidity scripts remains: Why does everyone sticks to fixed humidity percentages?

    If the outside (=overall) humidity changes then all all inside humidity values change also. And the inside temperatures are also off a great influence.

     

    My opinion still is: The fan should react to 'sudden' change in humidity in the bathroom or in comparison to the rooms next to the bathroom.

    When the regulation of the fan is 'restricted' to a fixed value (like 75%) and the outside humidity changes to 50 or even 99% your scene will not respond as it should.

     

     

     

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 16 minutes ago, TRicky said:

    I have to say that my scripts works better in real life. Sorry @petergebruers

     

    Please define "better". All people who disagree until now seem to have this goal: keep the humidity as low as possible at all times.

     

    That is not my goal. My goal is to keep humidity under control, so your mirror doesn't get wet and water does not drip from the wall.

     

    I also try to do that with only one sensor...

     

    I have tested both scripts, and my script or your script achieve my goal... Do you disagree with me? In that case, I would like to investigate why we get different results. Either here or via PM.

    Link to comment
    Share on other sites

    • 0
    20 minutes ago, petergebruers said:

     

    Please define "better". All people who disagree until now seem to have this goal: keep the humidity as low as possible at all times.

     

    That is not my goal. My goal is to keep humidity under control, so your mirror doesn't get wet and water does not drip from the wall.

     

    I also try to do that with only one sensor...

     

    I have tested both scripts, and my script or your script achieve my goal... Do you disagree with me? In that case, I would like to investigate why we get different results. Either here or via PM.

    Im using this scene in 4 bathrooms and it is achieving that exact goal.

    In my experience cold bathroom surfaces and  a lack of venting into the room stopping  the fan from moving air are more of a issue.

    condensation is the real test on the scenes performance

    Edited by Jamie mccrostie
    Link to comment
    Share on other sites

    • 0
    6 minutes ago, petergebruers said:

     

    Please define "better". All people who disagree until now seem to have this goal: keep the humidity as low as possible at all times.

     

    That is not my goal. My goal is to keep humidity under control, so your mirror doesn't get wet and water does not drip from the wall.

     

    I also try to do that with only one sensor...

     

    I have tested both scripts, and my script or your script achieve my goal... Do you disagree with me? In that case, I would like to investigate why we get different results. Either here or via PM.

    Hi @petergebruers, I all already predicted over here you would respond soon ;)

    With your  script it happened that my fan was working without cause or wasn't working while I was taking a shower.

    Sadly I didn't saved the data.....

     

    But my main issue remains: forget about fixed values and just look at 'sudden' changes in the humidity (like your 'spikes' item, but also there was an threshold)

    My scene works great but the only issue I have is that I compare the humidity  of the bathroom (measured by MS6) with 3 other rooms (measured by MS4). There are some differences in the measured values. And every now and then I have to make a correction.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 14 minutes ago, Jamie mccrostie said:

    Im using this scene in 4 bathrooms and it is achieving that exact goal.

    In my experience cold bathroom surfaces and  a lack of venting into the room stopping  the fan from moving air are more of a issue.

     

    Thanks.

     

    4 minutes ago, TRicky said:

    With your  script it happened that my fan was working without cause or wasn't working while I was taking a shower.

    Sadly I didn't saved the data.....

     

    Thank you for elaborating.

     

    I'd be a surprised if it ran without cause... I think we do not share the same definition of "cause", that might explain things. Relative humidity of 75% gives you about 5 degrees margin before water condenses. With dynamic limits, that number will be lower, but you start extraction sooner. Does it make a lot of difference? I think: meh. BTW that number depends on temperature and on no other variable... You do not have to test my script, but if you do, some data would help to understand what you mean by "without cause".

     

    If you want the fan to start when you take a shower... your goal is completely different. Maybe you like cooler, dryer air, when you take a shower? Another user told me that was one of his goals. Fair enough! By default I added a 20 minute delay, you could set that to 0. But I won't be triggered until you reach 75% so it still does not meet your goal.

     

    I think your goal is... to keep it air as dry as possible under all conditions... correct?

     

    I think you like your script... because it does what you want it to do.

    I think I like my script... because it does what I want it to do. ;-)

     

    I do not *dislike* your script. I even had a similar thing running on my HC... It is different. You need more than one sensor. And the averaging might be a problem, see below.

     

    1 hour ago, TRicky said:

    My scene works great but the only issue I have is that I compare the humidity  of the bathroom (measured by MS6) with 3 other rooms (measured by MS4). There are some differences in the measured values. And every now and then I have to make a correction.

     

    There can be several explanations, why you still need to tune it... The MS6 has a more accurate and faster sensor. Your older MS might be ageing, expect them to drift 5-10% over 5 years. I have tried to find firm date, but I get the impression it is highly variable. Exposing them to extremes seems to kill accuracy, but that is probably not happening indoors (but could happen outdoors). Lastly, it might be simply because relative humidity strongly depends on temperature. Roughly, vapour pressure doubles for every 10 degrees C. So if it is 100 % at 10 degrees C outside, heating that air to 20 C will reduce relative humidity to 50%. This explains why it is possible to reduce humidity in your bathroom in the Netherlands at this time of the year, even when it is raining. If you have two sensors at a different temperature (I'd say > 3 C) then averaging introduces errors. You could try to estimate absolute water vapour contents, then estimate how these different types of air mix at the entry of your bathroom. Seems rather academic to me (look up "Tetens equation" if you want the math). Is temperature difference a possible explanation for your "need to correct" issue? Have ever tried to use only the sensor closest to your bathroom as a reference point?

     

    Maybe it is not important after all. I've been toying with HA for about 5 years now, and I think it is the first real discussion I've seen here. Controlling a fan probably isn't exiting, or at least it is not as rewarding as automating your lights! As I said in another topic: 20 years ago, people connected their bathroom fan to the light switch. Then fixed controllers came to the market, with a knob to set humidity (probably around 65 %). A now we write code on a HA system. :-)

    Link to comment
    Share on other sites

    • 0
    On 10/19/2017 at 4:58 PM, petergebruers said:

    A while ago, I joined a discussion about controlling a bathroom fan (not a whole house ventilation), by means of a single humidity sensor.

    This inspired me to clean up my running code and share it with you.

     

    VERY IMPORTANT! Only use this script with an Aeotec MultiSensor 6 aka MS6 aka "the square one". I have extensively tested several "MultiSensors" and only MS6 meets its specifications! The older, round MultiSensor and MultiSensor Gen5 have very bad temperature & humidity response (up to 12 percent-point deviation) so they are not good. If I ever find the time, I'll post a calibration procedure and test results of several sensor. I also tested several DIY sensors on a Z-Uno and they can be used as well... but not the old MS!

     

     

    This script uses one, and only one humidity sensor. Because I am convinced, that this is all you need. You can device clever scripts, based on several sensors or weather stations or weather forecast... But in the end this adds complexity and you'll have a hard time convincing me multi-sensor works better!

     

    If you want to learn more about my motivation to script it in this particular way, please read:

     

     

    In fact, before I talk about the control scene, I'd like to share script to monitor your setup.

     

    It is a script which filters your event log, and puts fan and humidity data in your debug window. The log script enables you to check if the control script runs as expected.

     

    The Lua code demonstrates: filtering the event log, sorting data,  and outputting data as html or plain text.

     

    The log output looks similar to this:

     

    Please login or register to see this attachment.

     

    Since I took that screenshot I decided it was nicer to reverse the order. If you look at the script you'll see that's only a matter of changing > to <

     

    You might notice the fan device has a value... This script can control a fan connected to a dimmer or a switch and the scene automatically detects the difference. I recommend a dimmer only for small fans; < 30 W. For Dimmer 2: set parameter 30 = 0 to force "leading edge control".

     

    Features:

    • You can test this script by selecting one dimmer in your house as the "sensor" and another one as the "fan".
    • You can set a parameter to speed up al timers (e.g. turn "minutes" into "seconds") to easy debugging.
    • Requires only one humidity sensor.
    • Can control a fan on a switch or a dimmer. Uses undocumented code, but I guess this is pretty safe to use.
    • Contains lots of comments and lots of debugging.
    • Debugging is easily removed, check comments.
    • Limits fan runtime and does retries.
    • Uses autostart, script recovers from reboot.

     

    This scene has not been tested by anyone else, so please run it, check it and share what think, so I can improve it!

     

    Note: if you do not have a means to dry your air, which you probably do not have, the control of humidity depends on outdoor conditions. I live in Belgium... According to www.weatheronline.co.uk "The climate of Belgium can be classified as Cfb Climate; a warm temperated humid climate with the warmest month lower than 22°C over average and four or more months above 10°C over average."

     

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

     

    Excellent job!!!

    Thank you so much.

     

    Gianluca

    Link to comment
    Share on other sites

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