Writing piston where condition is humidity going up and then down


#1

1) Give a description of the problem
Hi all. I have a humidity sensor that triggers certain light behavior when I shower. What I’m trying to do is trigger an action when the humidity goes up to say 75%. Then if humidity hits say 85-90%,(this would be variable) I want to trigger an action based on when it goes down and not waiting until it actually hits 75% again. I assume there is some way with variables. Any assistance is appreciated.

2) What is the expected behaviour?
(PUT YOUR INFO HERE)

3) What is happening/not happening?
(PUT YOUR INFO HERE)

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

I’m not exactly sure what you are seeking…

You want an action if humidity is between 85 and 90%?

Not sure what this means.


#3

to clarify, I turn the shower on and the humidity gradually goes up. I would like my lights to become bright. Once I’m done showering, the humidity stays so it takes a while for it to go down, which is when I would like to shut the lights off. So what I would like to do is turn the lights bright once humidity hits 75% and then turn them off once humidity starts coming down a certain percentage from it’s highest point, which could be anywhere from 85-90%. I didn’t know how to write a piston for this.


#4

You do not mention if you have a motion sensor in the bathroom. Turning off the light when the humidity reaches 85% might leave you standing in the dark.

Also, are you wanting the light to turn off when the humidity is <= 85% or a percentage of the highest level reached?


#5

I do have a motion sensor in the bathroom. With the shower curtain, this won’t detect motion when I’m in the shower, so I bought the humidity sensor.

Current setup is motion sensor turns the lights on to normal brightness. I tell Alexa “time to shower” and they go bright. I would like to automate that when the humidity rises.

I would also like the turn off to happen when the humidity starts declining at a percentage of the highest level reached.


#6

There are infinite ways to write a piston to control lights in a bathroom. There are several examples in this forum. Have you looked through some of them? I suspect most of them incorporate a motion sensor. I would hesitate to use humidity as the only condition to turn off the lights. But it can be done. I am not sure why you want a percentage of the highest humidity level. If you are turning the lights to bright at 75%, then why not dim them in stages from 95%, 90%, 85% etc? I am a fan of small, task specific pistons. So I would divide this scenario into at least two pistons. One to turn the lights on. And one to turn the lights down/off. Get those working and then possibly combine them later.


#7

Thank your for your responses. I definitely understand webcore and have the lights working with motion and humidity sensor. I am just trying to tweak now for my actual needs. This is why I was focused on the specifics I asked. Basically I just wasn’t sure if it was possible to set a high point for humidity and then trigger once it starts going down. Something along the lines of “if humidity becomes greater than 85% then check every minute until that variable decreases by 10% and then turn shower mode off.” I should’ve been more specific in my original post so apologies for that.

I am going to try using variables and see if I can figure it out.


#8

Is there an extractor fan in this scenario that decreases humidity or does it go down fast on its own? Also, does your humidity sensor report values often?


#9

I am thinking outloud here:

IF Humidity raises above 75%  <-- Trigger
Then 
   Turn on Lights Bright
END IF

IF Humidity changes           <-- Trigger
Then 
   Set variable {cur} = Humidity
   IF Humidity > {max}        <-- Condition rising
   Then
      Set variable {max} = Humidity  (only sets on the incline)
   END IF
END IF

IF Lights are Bright          <-- Condition 
Then
   IF {max} / {cur} > 1.11 (this equates to a +10% drop)
   Then
      Turn Lights to Normal
      Set variable {max} = 50 (to reset it for next time)
   END IF
END IF

Note: You will likely need to add a decimal in that last math equation to get the proper results. IE:
({max} * 1.0) / {cur} > 1.11


Something to consider:

If there is a line for the shower, it’s possible your Humidity might not drop below 75% in between people. This would prevent the second person from getting the “Bright lights” trigger.


#10

:clap:


#11

Thank you for the responses. I have to take a look at this but I think I’ve worked through it in a different way and seems to be working, though a little hard to tell.

If humidity is greater than 77% set “shower” to 1
If humidity rises to or above 85% set “shower” to 2
If humidity drops below 83% and “shower is set to 2 then set “shower” to 1
If humidity drops to or below 75 set shower to 0

So I am running a separate piston with motion triggers that reference these conditions to adjust the different levels (off, normal, bright)of lights. I prob need some type of notification to test if the variable is changing as needed.