Maybe someone can help me find out why this automation doesn’t do what I want it to do.
What I want:
Check if humidity is above 50% for 1min and if between 10-16h start the dehumidifie for 1h.
If during that period the humidity is still above 50% reset the 1h timer, so it doesn’t trigger on/off, as the compressor always need some time to restart which i want to eliminate.
I tried TRIGGER = state as well, but it won’t help. I want the automation to continously check humidity, and not be triggered only if humidity is/was above 50%.
At a guess (which is why Hellis81 is asking), the humidity sensor shows the measured humidity in its state, not in an attribute. If I’m right, you need to remove the attribute: humidity line in your automation, and reload.
This automation will only trigger if the humidity transitions from below 50% to above 50% then stays there for 1 minute. It won’t do the timer reset thing that you’re hoping it will. Let’s get the first bit working, then we can have a look at that.
But how would I make it watch the number all the time? It may be an issue only now as it’s harder to trace, but may be worthful to know for later automations.
The attribute line is already removed. Sorry. Didn’t mention that.
I let it run 1h for a reason. I don’t need EXACTLY 50% (as this changes all the time anyway). The humidifier has a “setpoint = 50%” as well, but what this makes is turning the compressor on/off all the time, which causes power surge which my battery inverter has troubles with. I like 500W power usage straight for one hour minimum if it starts at 10:00. And if at 10:13 humidity is still >50% then it should run til 11:13. And so on. It will start to go up after that anyway. But eventually it will be at 42% humidity at 11:13, so it will start at like 13:00 again, and not turn on again at 11:14.
So what’s the correct trigger for continous monitoring a value? Or should i go node-red route?
Are you sure about this?
Our does occasionally start up with just the fan to move the air around in the room and get a better reading, but it doesn’t start the compressor.
So you want it to start every full hour if it’s above 50%?
I generally find these automations dumb, but a time pattern trigger of every hour and condition > 50%.
Not sure I understand the logic with this part here.
It started at 10:00, and because it was above 50% at 10:13, then it should continue to 11:13?
So what if it’s still above 50% at 10:20?
This part just doesn’t make sense to me.
I have a suggestion.
What if we do this time pattern trigger every hour, and if the humidity is above 50% then we start the dehumidifier.
If it’s below then we turn it off.
That means it can at a minimum run for 1 hour and it will only turn off if it’s below 50%
Automation 1: Trigger on humidity going above 50% for one minute, start the dehumidifier.
Automation 2: Trigger on humidity being below 50% for one hour, turn off the dehumidifier.
I want it to check if humidity is above 50% between 10:00-16:00, as this is the time my solar system produces power most certainly.
Second: If it starts it should run for 1h at least and not cylce on/off all the time. If during this 1h the humidity is measured again, and it’s still over 50% it should run for 1h more.
Example:
09:55 60% → nothing
10:01 60% → on for one hour till 11:01
10:05 59% → still over 50%, add one hour. On until 11:05
11:05 49% → off
11:40 51% → on until 12:40
Should be easy doable once i find out how I can run automations on “state_changed” like in node-red.
State changes → sensor value is checked against a given value and that’s it.
No it’s not the fan. It’s the compressor as it toggle between zero W and full power.
I don’t want it to start every full hour. I want to CONSTANTLY monitor humiditiy changes and if humidity is above 50% it should turn on the humidifier for one hour. And if during this hour it still is above 50% it should add one more hour from time of measurement.
Sorry. Maybe I didn’t read it correctly what @Troon wrote. Yes. This could work.
But I hate having to have two automations to do one thing. I’d really like to get my brain understand how this can be done in one automation.
And still it does not solve the issue if humidity is like 60% and NEVER goes below 50%. In that case it will never be triggered. Correct?
One little issue with this is that it could fail if you restart HA at 9:59:59 or a few seconds before this.
We could add a homeassistat start event as a trigger with condition of time and humidity.
This is part of the game of writing decent automations — trying to raise yourself above the level of the first idea you have as to how it should work and look instead at what you want it to do, freeing yourself to consider simpler, more efficient implementations. My previous post does indeed (with the exception of the 10:00 complication) sum up what you want, but isn’t how you initially conceived it.
As a basic rule, if you find yourself checking something “often” rather than waiting for something to happen, you’re probably doing it wrong.
I think the solution @Hellis81 gave wraps it up well. I’d probably implement it as a separate “on” and “off” automation as per my description, with the 10:00 and restart triggers added as appropriate — but that’s just personal choice.
Good luck, and if @Hellis81’s solution works for you, please mark it as the Solution (the tick box).