How to implement three 'input number' which all depend on each other without a loop/cascade effect

I need three separate Input Number helpers; IN1, IN2 and IN3. The values for these are all related (via a simple computation). What I would like is:

  • If someone changes the value of IN1, then IN2 and IN3 are updated to reflect that.
  • Similarly if someone updates IN2, then IN1 and IN3 are updated to reflect that
  • And if someone updated IN3 then IN1 and IN2 are updated to reflect that.

Th problem its if I use a simple automation based on a change to the value (or state) of IN1 and use it to update the values of IN2 and IN3 then the corresponding automations for IN2 and IN3 trigger and I end up in a cascade of everything updating everything else.

What is the best way to implement what I need while avoiding this behaviour?

If all the logic is implemented in a single automation, you can make it a mode: single automation with a 1s delay at the end.

Then it won’t immediately retrigger itself.

To build a bit off what karwosts is saying, it sounds like right now you have the three things in three automations. To move them into one, you would have a trigger for IN1, another trigger for IN2, and a third trigger for IN3. You can name them all, then in the automation you would use a CHOOSE action so that what gets updated depends on which trigger runs. Then put a pause of 1 second at the end and, as karwosts said, set it to single mode. Then when the automation tries to trigger again from the updates to the input helpers, it will stop and log a warning.

You can also use trigger information to determine if the number helper was changed in the UI versus by an automation and use this as a condition to stop the automation in the latter case. This might be nice if you don’t want warnings in your logs for what would be a “normal” use case for your automation.

It’s also possible to disable that warning for single mode as well.

https://www.home-assistant.io/docs/automation/modes/#example-throttled-automation

Thank you everyone, I have it working nicely now - single automation, choose based on trigger id, short delay (2 seconds) at the end. Works a treat!