Bathroom fan "on" with humidty changes from current level

Newbie here, but with some understanding of webCoRE.

I am looking to basically create a piston to turn on a bathroom fan when the current “normal at that time” humidity level changes within a certain time frame.

IE: Let’s say on normal summer day the room resides at 50%

When the shower is turned on it quickly rises to 60% within a minute or two

So there is 10% increase in less than 2 minutes

IE: Let’s say on normal winter day the room resides at 35%

When shower is turned on it quickly rises to 45% within a minute or two

So again there is a 10% change within in less than 2 minutes

So looking for some piston design help that can see this event, and turn on the bathroom fan

My room is equipped with automated sensor and fan switch

I already have seen and reviewed many other pistons and smart apps for this. But these only work off of specific humidity levels for percent on / percent off. In fact I have one of these running very well at the moment. This it is not accurate enough for my liking. As the normal ambient humidity changes from high in summer to low in the winter, living in the north east
So would like to control the fan when there is a quick not normal increase in humidity
Thank you in advance for any support or help

You can start it off with two IFs but for now build the piston with the current ‘normal humidity level’ and add the condition of specific months only. Once you’re satisfied with the performance, duplicate it with the different levels of humidity for another set of months.

And if you’re like some people that go overboard with pistons, you can try consolidating it into one BIG statement down the road lol.

The following is just an example… others might build it differently.

  deviceName's humidity enters range  XX% to YY%
 $month is inside of range 10 to 12
     with fanDevice
       turn on
     with fanDevice
        turn off
end if

That would only trigger on the humidity being within a specific range, correct? I think the OP was asking about a rate change piston, which would be a little more complicated.

I think the only way you could do that is to run a piston every so many minutes and record the humidity.

Loop:  Every 5 minutes
Set variable current to device's humidity reading

If current-previous > 10
    then turn on fan

If Previous - current > 10
Then turn fan off.

Then Set previous = current

Those would be 4 separate functions within the same piston. Of course this means the fan would be on a minimum of 5 minutes. But it would also turn off when the humidity drops again. Also, if you have a slow creeping raise, from say 10 - 20 over an hour, it would not turn the fan on. So you wouldn’t have to worry about calendar functions.

This one runs every 30 seconds for testing only.

1 Like

Specific range and month condition.

This looks like it would be worth a try. I will try this this evening
I was also thinking an expression with argument.
Some thing else i was going to give a shot at.
IF Devices rises above
By more than 5% in less than 2min.
I’m just not sure how to write this

You can import the piston i wrote via the backup code. The piston you wrote will never fire because you’re using the current value to compare to current value +5, which is impossible to ever have happen. Also, make sure you only post green screenshots. they are anonymized.

Thank you, for the help. and advice
I will try the code

Ryan, I tested the piston you suggested.
And this works well and works off the results as I was hoping for.
My concern’s would be, at a 5min setting, it would take over 5min for the fan to turn on.
And with this piston looping over and over. Would there be problems with battery life on the sensor ?
And system resources for the hub or other ?
If so perhaps I can figure out how to install another trigger to turn on and off the every 30sec loop
Like only run the loop if bathroom light is in the on state

The approach I took was to compare against the average humidity of a couple other sensors in the house.

1 Like

Excellent approach.

That sounds like a great approach !
And I would love to try this.
I have two other sensors in other parts of the house I could do this with.

I am rather new at webcore. And need a bit of instruction on writing a piston to do this.
part. If bathroom sensor +5 is greater than, sensor 1 and sensor 2, added & divided value
I think this would be an expression code? but kind of green at this

Any help would be greatly appreciated.

So do you have something that reports average humidity or are you calculating that every month or week? Doesn’t it detect a jump in humidity when it rains if you have your windows open? I don’t think that approach would work in a temperate climate where you get 20-30% swings in relative humidity in day or two.

Nothing so complicated is needed for my use case. I just look at the the average of the current values in a few other rooms (when humidity reading increases) to decide if there is reason to turn on the fan:

1 Like

I also have power allowance configured to turn the fan off after a certain amount of time (regardless of why it was turned on), so don’t need to worry about turning off for this piston.

How are you going to get the average?

Did you see the piston snapshot in my post?

That just averages them to each other. Not over any period of time. Plus, this piston runs every time the humidity goes up. How is that less labor-intensive than the piston that I showed?
Also, what is. Livinroom motion: humitidy? Are you trying to use a device status in an expression? That won’t work. Nome of this will work.

I never claimed it did any average over time. I’m actually not interested in change over time… I am just interested in turning on the fan if the humidity in one location is rising and is higher than the (average) humidity around the house.

And how often does the humidity sensor poll for the humidity level? What about the other issues I brought up?

If by “less labor-intensive” you mean conserving computing time, I will just say that this isn’t something I care much about. The calculation is plenty fast for my needs here.

My reason for comparing against other sensors is to address the a similar issue as OP concern:

I am sure the piston you posted works fine for your needs, but it doesn’t address this problem. In my case, I was previously using a similar piston and found the fan turn on anytime it started to rain, which was not useful to me.

Yes. I am using the 4-in-1 z-wave sensors here. The expression is evaluated using the average of the current values of the humidity attribute of the two sensors. Why do you think this won’t work?

Here is the screenshot from webcore (Edit Condition) so you can see it a little better:

One sensor is at 41 and the other is 37. As you can see, the current expression value is 49, as expected (avg() = 39, +10 = 49).

The sensors I am using don’t use polling. They have configuration parameters that provide unsolicited status reports when the humidity changes by more than a configurable amount. I have this set to trigger on any change of more than 2%