How to prevent automations overlapping?

Hello Forum!

My HA is doing great, but I came across one problem. I have automation that is checking temperature of my heating boiler. When it is above 64 deg.C. it will turn on yeelight with effect ‘Police’ to warn me about this. Now I’m thinking of revoking this alert which would be simple automation with lets say below: 60 conditions. However I also have other automations for this particular yeelight bulb. For example it will turn on when sun goes down, etc. Now, temperature of water rarely goes above 64, so my automation that would turn off light with alert would also still turning off this bulb whenever will be lit and water sensor below 64. Hope You get the problem :slight_smile:

Is there a way to somehow write some exclusion like "turn off when below 60 only when automation with above 64 was turned on no more than 5 minuts ago’ or something like this or any other aproach.

My current automation for alert.

  • id: ostrzegaj_temperatura_kotla
    alias: ‘Mrugaj lampa kiedy temperatura powyzej 64 stopni’
    hide_entity: True
    trigger:
    platform: numeric_state
    entity_id: sensor.temperatura_wody_w_kotle
    above: 64
    action:
    • service: light.turn_on
      data:
      entity_id: light.korytarz_parter
      effect: Police

You could set an input_boolean to true and in the second automation just add a condition and set it to false again.

Thank You, will test that!

or you can turn off the second automation at the beginning and turn it on again at the end. This is the way I use to.

action:

  • service: automation.turn_off
    entitiy_id: automation.second_automation
  • service: script.turn_on
    entity_id: script.do_something
  • service: automation.turn_on
    entitiy_id: automation.second_automation
1 Like

I can turn automation off from automation? Neat! So I guess automation that starts alert should also turn on automation for revoking it, then automation for revoking after turning off light should turn off itself?

yes, you can turn off automation (by automation.turn_off) and turn it on (by automation.turn_on). This includes the automation itself. I’ve got a automation that runs only one time after restart hass (Trigger Event/homeassistant_start won’t work for me) and than turn itself off. Another automation turns off/on multiple automations after switching an input_boolean on the frontend.

Sorry, I have to raise this topic again because I beginn to disbelief my complete development knowledge.
The situation: I’m controlling HUE-Scenes with an Input Select -so far ok

  • id: ‘2551000000004’
    alias: ‘Setze Wohnzimmerszene’
    trigger:
    • platform: state
      entity_id: input_select.livingroom_scene
      condition:
    • condition: template
      value_template: “{{ states.input_select.livingroom_scene.state != ‘manuell’ }}”
      action:
      • service: input_boolean.turn_on
        data:
        entity_id: input_boolean.autolightswitch_wz
      • service: variable.set_variable
        data_template:
        variable: manual_light_switch_wz
        value: ‘auto’
      • service: variable.set_variable
        data_template:
        variable: active_scene_wz
        value: “{{ states.input_select.livingroom_scene.state }}”
      • service: hue.hue_activate_scene
        data_template:
        group_name: Wohnzimmer
        scene_name: “{{ states.input_select.livingroom_scene.state }}”
      • service: timer.start
        entity_id: timer.timer_lightswitch_wz

That works.
But sometimes, somebody changes the light via alexa or via Hue app. Then I want to set the input_select to ‘Manual’
That is the task of this automation:

  • id: ‘2551000000005’
    alias: ‘Lichtschaltung manuell Wohnzimmer’
    trigger:
    • platform: state
      entity_id: light.wohnzimmer
      condition:
    • condition: state
      entity_id: input_boolean.autolightswitch_wz
      state: ‘off’
      action:
    • service: variable.set_variable
      data_template:
      variable: manual_light_switch_wz
      value: ‘manual’
    • service: variable.set_variable
      data_template:
      variable: active_scene_wz
      value: “manuell”
    • service: input_select.select_option
      data:
      entity_id: input_select.livingroom_scene
      option: “manuell”
      That works as well.
      In order to avoid, that this automation runs everytime I initiated as a first solution a variable and set it to 1 in the beginning of first automation. The condition avoids that the second automation runs.
      So far so good — but: As soon as I reset the variable in the end of the first automation, the second trigger fires.
      I tried then alternatively switching off the second automation, Input_booleans and a delay. Anytime, I reset the situation, the second automation is fired. A delay of 2 minutes fires the second automation exactly after 2 minutes :slightly_smiling_face:
      The last try was, to start a timer, in oder to leave the first automation. another automation resets the input_boolean when finished. The result: read above.
      Now, I have definately no idea. What is wrong?

Solved: It works without changing anything with the timer. I guess, that the timer finalizes the first automation and so that the second trigger starts and recognizes the boolean.