Time on your hands and fancy a Rule Machine challenge?

In a nut shell: Having started a fan using HE triggered by the amount of humid air in a bathroom, how do you, while the fan is running untill the air is dry again, make the fan stop if the time passes 22:00 in the evening, regardless of if the humidity is below the stop-the-fan threshold value?

In the laundry room and in the adjacent bathroom with a shower I have installed Aeotec humidity sensors. Both rooms are connected to air extractor pipes ending in one pipe on the roof where there is a roof fan installed to extract moist air. The roof fan is controlled by a speed controller which as of today has got a new Sonoff breaker installed to turn it off using HE. I n each room I will also install a zigbee remote to manually start or stop the fan.

I have started to create a rule in Rule Machine which I would like to have the following properties:

  • Using global variables the Rule should be aware of if if wither button or the rule it self changes (not yet implemented in the rule below)
  • The fan should start automatically if the humidity is above 40
  • The fan should only start if the time of day is between 09 and 22
  • The fan should stay on untill the humididty is below 35
  • If the humididty for some reason has not sunk below 35 in 1,5h, turn the fan off
  • If during the time the fan is working, the time passes 22 before the humitidty is below 35, turn of the fan anyway

Thank you for your patients having read this far! :slight_smile:

My thinking is to log if the rule is running and then control the behaviour while it is running. This will result in a number of checks and then a sort of loop while the fan is working and the humidty dropping.

The issue?

I cannot think of a solution for how to check the time while the fan is working if the time should pass 22 before the humidity has reached below 35?

Any ideas on how to solve that?

If you have any other comments regarding the rule, all comments are always welcome. Please find the rul in its current half baked work in progress state below.

Thank you for you time and for any suggestions!

Full disclosure, I didn’t have time to read your whole post, but it seems like there might be a simpler solution...

Actions:
Turn Fan ON.
Wait for conditions, humidity less than target OR time after 22:00 (90 minute timeout)
Turn fan OFF.

I'll take a closer look later if i have time.

3 Likes

Hi Dylan,
Ah, no worries, sorry for a lengthy description :slight_smile:

Thanks again Dylan. As I am a bit of a noob I am having trouble with the:

Wait for conditions, humidity less than target OR time after 22:00 (90 minute timeout)

This is what I have come up with so far, with out the OR time after 22:00 which I don't see how to squeeze in there?

There is a lot going on with your current rule. Personally, I would simplify it to something like the following:

Required Expression:
Time between 09 and 22

Trigger:
Humidity is greater than 40
or
Button 1 pushed (or whatever button number you use on the remote)

Actions:
If Humidity is greater than 40, log Global Variable to Humidity
Else, log Global Variable to button
End-If
Turn on Fan
Wait for Event, Humidity is below 35 or Time is 22 (timeout of 1 hour and 30 minutes)
Turn off Fan

When you add your first wait event, there is a button that says "add another wait event" which is what you would do to get the OR. The timeout is at the very bottom before you confirm the wait.

2 Likes

Thank you for taking the time to share your knowledge JB10, it is much much appreciated! I think I have enough to go on to continue a bit further.

I satarted to make some changes as per your advice...

...and noticed this option.


Could that be an alternative way to accomplish the Wait for event ?

Again, many thanks!

Cheers,

:smile: You win imaginary gold stars! Thank you @Tree.Log !

This hit the spot I think!

image
Again, many thanks!

2 Likes

No. That wouldn't work for your scenario. The And stays focuses on the Humidity level. Basically, it would wait for the Humidity level to be less than 40 and stays that way for a minute. It would not help with the timeout that everyone has suggested.

You'll also want to add a third wait for event. You'll want to add Button 2 (or whatever Off button you will be using) as that will also help the rule move forward.

Finally, I would also add the On/Off Buttons to Button Controller and have them be specific to On and Off of the fan. This will serve as a secondary backup to adjusting the fan that happens outside of this rule.

2 Likes


Just helping with ideas. Using something to compare with here. Will eliminate coming on with just one setting.

1 Like

Ah, thanks for explaining. I wanted to take the chance to ask while we were talking to learn som more :slight_smile: Thanks for explaining so well.

Thruthfully I have not yet bought the buttons as I was unsure which ones to choose. At this time I am leaning towards two Aqara Wireless Mini Switch T1 buttons or using Schneider Wiser Wireless switch using HA. I will get those tomorrow at which point I will revisit your post to try and se if I can get the second wait and button controllers right.

Thank you!

Thanks @Johnnyvaneddie ! Much appreciated!

I used a humidity sensor and a very simple rule in the small bathroom of our old house, and in that house it worked perfectly. I even used a sensor located downstairs for reference humidity so when we had those humid Toronto Summer days, the fan didn't kick on unless the humidity raised a certain amount above the reference humidity.

Now I live on Vancouver Island, and those humid Summer days are a thing of my past, thank goodness. So I figured, a single humidity sensor in our relatively small ensuite bathroom would work just fine. It didn't. The fan would run and never shut off. Tried adding a reference humidity sensor just in case that was the cause, but it still wouldn't work consistently. My teenage son would leave the walls dripping becuase of his long showers with no fan on. I even tried using a combination of motion sensor in the shower, combined with the pressure change measured by my Flo water shut-off, and that only worked sometimes.

Finally, after mildew spots started appearing on the ceiling, I replaced the extraction fan with one quiet and efficient enough that I wouldn't care if it ran longer than actually needed, and changed my rule so that anytime someone steps into the shower, the fan turns ON and stays ON for 15 minutes after the motion sensor has been inactive for 5 minutes.

Bingo! No more dripping walls after my son drains the water heater, and no more worrying if the fan will turn ON or not, it's just always ON when we shower, and OFF 20 minutes after we're done. As a failsafe, I have instructed my family that if they don't see the light pulsing on the Inovelli LZW36 Fan/Light switch, they are to double-press the Flic button in the shower to manually turn the fan on.

3 Likes

I was going to post an example, but others beat me to it. Let us know how this works out for you.

1 Like

Thank you Dylan, I much appreciated you reaching out.

This is my bathroom fan rule, would be pretty easy to stop it after 10pm.



2 Likes

For some reason the previous owner of the house I live in, who also opted for a large roof fan as the solution for a shower fan, decided the laundry room was the right place for the motor controller to the fan. I also have teenage kids and for them to go into the laundry room and turn on the fan before taking a shower has so far proven to be a stretch target with a too high ambition. I am hoping automating the fan will sort this out. I like the teenage foolproofness of your setup :slight_smile: To start with, I am aiming for a reasonably accurate rule with a failsafe button in each room to turn the fan on or off. I will be testing this out in the near future.

Thank you for the tip on the Inovelli LZW36 Fan/Light switch. Have you connected that in such a way that you can alter the fan speed as well? I settled for an on/off for now as I am unsure of motor controllers that will work in Europe.

When I had the electrician over I decided, apart from installing a smart switch with the motor controller for the roof fan, to also equip the radiators in two bedrooms with smart switches. Out of curiosity I, perhaps not wisely, decided to go for different smart switches for the purpose of testing them out. I went with

  • Aeotec Nano Switch
  • Namron Smart Switch (Sunricher)
  • Sonoff ZBMINI Extreme

The Aeotec and Sonoff connected with ease while the Namron/Sunricher with some persuation

Likewise, the plan is to try at least two different buttons. The trial of these will then determine the setup for the rest of the house. The first two will be:

  • Aqara T1 Mini Wireless Switch
  • Schneider Electrics Wiser Exxact 1- rocker (WDE002906)

By the way, it was funny when you mentioned that you live on Vancouver Island. My first thought was perhaps we then have a similar sort of climate? Surely a city like Vancouver must be on the same latitude as Stockholm where I live, I thought. Much to my surprise I discovered that Vancouver is on par with Paris and Toronto virtually on the same level as Rome or Barcelona. Stockholm is apparently roughly in the southern parts of Yukon and the Northwest Territories. But the climates may not be so far off anyway. It looks like we get colder temperatures in the winter, but could rival your temperatures on a good summer’s day.

1 Like

Thanks @Jamesboag304 ! Much appreciated!

No. The reasons I ended up using the LZW36 were circumstantial. We previously has an old Broan fan in place, which worked fine with a non-smart 30 minute Lutron timer, which wasn't really designed for bathroom fans, but worked fine with the small load. I had it wired in parallel with an Insteon micro switch for control from Hubitat. It made the Lutron timer inoperable when the micro switch closed, but no big deal.

When I replaced the extraction fan with a Panasonic DC fan, the load was now too low for that particular Lutron timer. The fan is wonderful, and it was not going to be displaced by a $30 timer, nor did I particularly want to spend $90 on the Lutron 60 minute neutral equiped version that is designed for extraction fans. I've had Leviton in the past, and they have inexpensive neutral equiped versions, but I don't like the look as much.

I opted for using the LZW36, since I had an extra I wasn't using, but I'm not using it with the canopy module. I'm using it as a fancy button controller. For my situation, this worked out well. We also had an existing fixture for a heat lamp in the bathroom that the previous owner had removed the bulb, put in an LED and wired it together with the shower lights. So while I was in the attic replacing the fan and ducting, I rewired the heat lamp fixture to be separate from the shower lights. I have it controlled by an Insteon micro dimmer. The Panasonic fan does have multiple speeds, but they're set by a switch under the cover. The intent is you set the minimal level for your room size and leave it there. Since our bathroom is small, I was able to leave it at the lowest setting, which means the fan only generates 0.3 sones. Love it!

It took me some time and serveral RM rules to do what I wanted, but I'm using the speed buttons on the LZW36 to adjust the fan time in 4 steps (5 min, 10 min, 15 min and 20 min). I'm using the indicator to represent the time. I chose flashing Red for 5 min, flashing Violet for 10 min, flashing Cyan for 15 min and solid Cyan for 20 min. As the time counts down, it switches to the color so you have an idea of time remaining and the current time setting when you turn the fan ON. When the fan is turned on automatically via the motion sensor in the shower stall, or via the button in the shower, the fan light on the LZW36 pulses Cyan. I found that once the shower door steamed up, this was the easiest to still recognize so we could confirm the fan is running. Otherwise, it's so quiet that you cannot tell it's on over the sound from the shower.

For the heat lamp, I'm just using flashing Red on the light button, and it automatically turns off after 5 min. The light level buttons are not in use.

Mountains and the ocean make such a difference in the weather. I've never been to Stockholm, Paris or Barcelona, but I have been to Rome in the Summer many years ago. I don't remember it being humid, but I do remember it being very hot. It was one of those 40˚ C plus Summers where many elderly died due to the extreme heat with no air conditioning. Toronto is a sweat box in Summer, typically in July and August. Hate it. Where I live now, Summer (at least since we've live here) has been around 30-35˚ C and dry, with very pleasent nights at around 17-20˚ C and I love it, but forest fires have been a concern. This being an El Niño year, it is going to make it a nail bitter for sure. We have had very little snow pack this Winter. I was able to ski only twice and the base was small, with very few runs open. There are concerns that this will likely translate to more fires, a more serious drought than we experienced last year, and possible power issue since the rivers will be low and we're 98% reliant on hydo-electric power here.

Love the ambition of this project :slight_smile: How did you go about to do the timer controlling the lights?

Yes, the climate seems to be changing. We actually had the first resemblance to a proper winter here for years. At least in the sense that the snow settled in late autumn and stayed to the end of February. Usually, for the last fifteen or so years, it melts away a few times and temperatures vary a lot. A continuous snowy winter meant we got the opportunity to do some cross-country skiing here this year. The slopes in the northern parts of Sweden are still pretty safe regarding availability of snow. Less so in the alps apparently, which is slightly worrying.

Energy is on the verge of becoming an issue here as well in the winter time. Sweden has gone with closing nuclear power to be replaced by windfarms, which has turned out to be somewhat of a mistake. In consideration of all other things happening in the world, I feel we have reached the comfort levels of excitment for now. Hope things turn for the better soon.

1 Like

Sorry for a lengthy question! (You don't have to read all of it to get the issue)

I did a test today with the revised rule for the shower fan and noticed that there is some unwanted woodoo going on here that I am not sure I fully understand :slight_smile:

In a nut shell: The fan never stops

The rule as it looks now:

The wait is set up as follows:

I started the shower for a bit at 16:03 getting the humididty up to about 60% to trigger the rule. Log file from the rule.

With the Wait for event I wanted the rule to stop at at leaset one of these events.

  • Stop at a humidity <= 40 (should have occured at 16:48)
  • An hour after start (Should ahve occured at 17:03)
  • At 17:15 if the required expression should impact a rule that has already started? (Should then have occured at 17:15)
  • At 18:00 as set in the Wait clause (Should have happened at 18:00)

None of those things happened. Presently, at 19:47, the fan is still on.

What am I not seing here?

All thoughs and ideas are as always appreciated!

Log file for the humidity sensor:

Things I have comtemplated:

  • In the documentation regarding the Wait statement, it says the wait will be stopped if the rule is re-triggered. I did some other tests before where the rule was re-triggered but did this last test without the rule being re-tiggered to eliminate that.

  • I have also added an If statement to check if the rule has been triggered, and if it has, it should exit. But I am not sure what behaviour to expect here? Will the exit command in the retriggered instance of the rule have an effect on the triggered instance, or are there never more than one instance of the rule engaged at any one time?

  • I am not sure I interprete the documetnation correctly. When checking the 'All of these?' option it referes to the conditions, i.e. the humidity (?) but in the documentation it is talking about refering to the event, which I guess could be the Wait events? If the option referes to the Wait events it is obvious why it doesn't work, but again, the practical effect seems to be with the sensor conditions, not the events.

  • Not sure how Rule Machine arrives at the numbers it fills out in the rule screenshot. It seems Rule Machine takes numbers from differtent points in time or replaces some with a new value at the time you look at the rule? For example, according to the rule log, the rule never triggered at 17:54 as stated in the screenshot.

Thanks for your thoughts @Tree.Log !

The reason for using a hub variable here is that I use it in other rules as well, i.e. the rules governing the two buttons that can also controll the fan. This so that they are all 'aware' of what the others are doing. And the reason for not adding the buttons to this rule is because I want to be able to turn on the fan for other reasons than humidity (think kids baking :roll_eyes: ). But I guess I could re-think that.

1 Like