Is there a possibility to change the automation for input_number on a changed state to only trigger if input_number has been changed manually, not by an automation?
My problem is this:
I use an input_number component to set a temperature. I have an automation that publishes this value to e.g. “temp/set” in the event that input_number has been changed. My device then receives this value and publishes the temp to the topic “temp”. My other automation changes the state of input_number to the value received on the topic “temp”.
Works perfectly and shows the current value even if it is changed by another device etc.
But if an other devices changes the temp published to “temp”, my automation correctly changes the state of input_number. This however triggers the other automation which publishes the changed state to “temp/set”.
This results in always getting duplicate temp change requests on MQTT.
Is there a way to prevent the automation from being triggered, if the state change was made by another automation and by me using the frontend?
Here’s my configuration and automation:
configuration.yaml
You could create another mqqt topic and sensor called automatic_change. Your other devices would publish a set/active value to this topic before publishing to the temp topic.
Your slider moved automation could use the state of the automatic_change sensor as a condition. You would also have to publish a reset value to automatic_change topic in this automation.
yeah that would work but to be honest, I’d like to make homeassistant work as I expect it to work, not make a huge workaround on all my devices to achieve expected behaviour.
Not for nothing, but @tom_l’s solution isn’t really a work around. This is how home assistant has always worked. People without MQTT usually have to make an input_boolean and flag it when the automation is executing. Coding is however you can make it work, it’s never really a work around. And in every feedback loop case, this is always a problem with every code->device, and device->code platform. I run into this at work daily.
@kevinkk52 does have a point though. Much easier to add an extra flag for the home assistant side automation rather than having to re-flash all his remote devices.
The extra topic configuration seems like quite a big workaround…
In the 0.76 announcement I don’t really see how that helps me.
So obviously there is no real possibility yet. Would it be possible to disable the 2nd automation in the execution of the 1st and with a delay reactivate the 2nd automation so that it would not be triggered?
That’s perfect! Thanks a lot, did not think about that. Now it does not retrigger itself if another device changes the number. I had the sensor to that topic added already but did not think about that condition.
Adding that condition works perfectly: