How to tell if a state change is trigger manually or by automation

Hey guys, I’m currently working on an auto humidifier in my home. Here’s the setup:

  • a switch.humidifier
  • a sensor.humidity
  • an automation that turns off switch when humidity is above 60 and turn on when humidity is below 40

However the problem is, suppose now the humidity is 35 and I turned off humidifier, it’ll be turned on on the next read of humidity. This is because the automation is still enabled. That is to say, the system is still in auto mode.

So one solution is if I manually turned off the humidifier, the automation should also be turned off. But that brings the question, how does HA know if the turn off action is done manually by me, or by automation script when humidity is above 60?

Do you guys have any idea on that?

Thanks.

You need to bring the info somehow to HA. Easy way out would be to build totally separate device to manual on/off buttons. If possible. How do you turn it on and off via HA now?

The humidifier works in two modes, auto and manual.

In auto mode, it is completely controlled by the automation rule.
If the automation is turned off, i.e., in manual mode, then I can take control of it.

I mean what is the interface between HA and the humidier? Is it in wlan and you use some protocol to give it commands? Or do you just cut main powers?

But I still believe your only chance is to bring info to HA from your manual button (assuming it is on the humidier itself) and with this info disable the automation.

It’s an MQTT switch controlling the power. It has a button and the status is quite synced up with HA.

Looks like there is a misunderstanding between us on the word manually. What I want is, if I turn off the humidifier in HA web page or by pressing the button(they are the same), I want to turn off the automation too.

The difficulty is, HA doesn’t know whether it’s me or the automation that turned off the humidifier.

Aah okay, sorry for the misunderstanding!

Create an input boolean for manual control. When you turn off the humidier with that also disable the automations.

Then when you turn it back to auto mode enable the automations. And when you turn on the input boolean dont enable automations.

Or maybe it is better to add the input boolean as condition only. But maybe you get more ideas out of this :slight_smile:

1 Like