Max_exceeded vs turning automation off

I have some automations that perform actions that could possibly retrigger the automation while it is still running. I have always dealt with that by turning off the automation (now with the stop_conditions parameter set) and then turning it back on after the action has completed.

     # turn off automation to prevent recursive call
      - service: automation.turn_off
        data:
          entity_id: automation.radio_morning_radio_finished
          stop_actions: false

      - service: input_boolean.turn_off
        entity_id: input_boolean.radio_morning_preset

      - service: automation.turn_on
        entity_id: automation.radio_morning_radio_finished

With the new automation modes this is no longer necessary when the automation mode is single as it just created a warning in the log, which is why I left that logic intact.

My question is with the new max_exceeded option, is there any point performance wise to continue turning automations like this off? Logically it seems that I could save a couple of service calls whenever this automation is called by taking that logic out and setting the max_exceeded parameter.

I’m probably nit picking here as I doubt there would be a noticeable difference either way.

good question and I’d like to know the answer.

I have an automation that takes the input from a motion sensor to turn on my lights in my garage. 15 minutes after motion stops they turn back off. The problem is that the motion sensor is a camera and when the lights turn off it senses that as motion & turns the lights back on…ad infinitum…So I turn the “turn on” automation off before I run the lights turn off service call. Then I turn the automation back on.

1 Like

Since nobody who knows spoke up I went ahead an made the switch in my config across the board. No noticeable difference really except I don’t get the constant automation initialized entries in the logs, so that’s a plus I guess. Seems like it’s probably the way to go. The max_exceeded option actually seems to be made for exactly this type of situation.

I’ll have to look into it on my end to see if I can make any difference. Right now the system works so I’m hesitant to “fix” it.

1 Like