Unexpected automation triggering after HA core update

Hi,

I get unexpected notifications from an automation, after I update Home Assistent Core during the restart.

In that automation, I am monitoring the state of my 230V plugs. If they get turned off (manually or by another automation), I receive a Telegram message.
I get Telegram messages for each of the plugs one by one, after I have updated HA during the restart. From that point of view it seems, that the plugs get turned off and back on again, which would be absolutely unwanted.

Is that an expected behaviour?

I watched one sample plug during that update process and it looked, that the state wasn’t switched at any time.

I also noticed, that I do get a notification for especially one plug intermittedly, but I wasn’t able to trace down the causing event. I’d be more than happy, if one could help me on to find the triggering event for future troubleshooting.

Thanks guys :slight_smile:

Show your automation. My guess is, during a restart they are shortly ‘unknown’ or ‘unavailable’ whee the integration reloads, and your automation does not count for that.

Sure, this is the yaml, though I usually create automations with the WYSIWYG editor.

alias: Steckdose Ausgeschaltet Benachrichtigung
description: >-
  Sendet eine Telegram-Nachricht, wenn eine beliebige Steckdose ausgeschaltet
  wird.
triggers:
  - entity_id:
      - switch.x01_steckdose_heizung
      - switch.x02_steckdose_gefrierschrank
      - switch.x03_steckdose_waschmaschine
      - switch.x04_steckdose_trockner
      - switch.x05_steckdose_aussenkuhlschrank
      - switch.x06_steckdose_gerat
      - switch.x07_steckdose_eha
      - switch.x08_steckdose_lufter
    to: "off"
    trigger: state
actions:
  - data:
      message: Die Steckdose '{{ trigger.to_state.name }}' wurde ausgeschaltet.
    action: notify.telegram
mode: parallel

Try with

alias: Steckdose Ausgeschaltet Benachrichtigung
description: >-
  Sendet eine Telegram-Nachricht, wenn eine beliebige Steckdose ausgeschaltet
  wird.
triggers:
  - entity_id:
      - switch.x01_steckdose_heizung
      - switch.x02_steckdose_gefrierschrank
      - switch.x03_steckdose_waschmaschine
      - switch.x04_steckdose_trockner
      - switch.x05_steckdose_aussenkuhlschrank
      - switch.x06_steckdose_gerat
      - switch.x07_steckdose_eha
      - switch.x08_steckdose_lufter
    to: "off"
    not_from:
      - unknown
      - unavailable
    trigger: state
actions:
  - data:
      message: Die Steckdose '{{ trigger.to_state.name }}' wurde ausgeschaltet.
    action: notify.telegram
mode: parallel

Hm, @francisp, first thanks a lot for your idea. I copy/pasted the new lines into my yaml. Saved and restarted HA. The notifications didn’t show up.
To cross-check, I removed the additional lines and restarted the same way. Now the notifications don’t show up either anymore.
Does that make any sense?

Really interesting, I just tested again with a restart of HA, with the automation mentioned above without the “not_from” lines and the notifications do not show up again.

I have another automation, where the very last message is always fired, after restarting HA.

alias: Zeitmessung durch Regensensor
triggers:
  - entity_id: binary_sensor.sensor_regen_und_sonne_rain
    to: "on"
    id: start
    trigger: state
  - entity_id: binary_sensor.sensor_regen_und_sonne_rain
    to: "off"
    id: stop
    trigger: state
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: start
        sequence:
          - data:
              entity_id: input_datetime.gemessene_zeit
              datetime: "{{ now().isoformat() }}"
            action: input_datetime.set_datetime
          - data:
              message: 🌧️ Regen erkannt — Rollo Bad schliessen!
            action: notify.telegram
      - conditions:
          - condition: trigger
            id: stop
        sequence:
          - variables:
              start_time: "{{ states('input_datetime.gemessene_zeit') }}"
              end_time: "{{ now() }}"
              duration: |
                {{ (as_timestamp(end_time) - as_timestamp(start_time)) | int }}
          - data:
              message: >
                🌤️ Regen vorbei — Rollo Bad öffnen!   Dauer: {{ duration //
                3600 }}h {{ (duration % 3600 // 60) }}m {{ (duration % 60) }}s
            action: notify.telegram

I don’t know where to put the “not_from” part in since I am yet only familiar with the UI, could someone help?

Thanks in advance.

I hope I found the solution. I tried to put the “not_from” part under the “triggers” section. I tested by restarting HA and the unwanted notification did not appear again.

alias: Zeitmessung durch Regensensor
triggers:
  - entity_id: binary_sensor.sensor_regen_und_sonne_rain
    to: "on"
    id: start
    trigger: state
  - entity_id: binary_sensor.sensor_regen_und_sonne_rain
    to: "off"
    id: stop
    trigger: state
    not_from:
      - unknown
      - unavailable
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: start
        sequence:
          - data:
              entity_id: input_datetime.gemessene_zeit
              datetime: "{{ now().isoformat() }}"
            action: input_datetime.set_datetime
          - data:
              message: 🌧️ Regen erkannt — Rollo Bad schliessen!
            action: notify.telegram
      - conditions:
          - condition: trigger
            id: stop
        sequence:
          - variables:
              start_time: "{{ states('input_datetime.gemessene_zeit') }}"
              end_time: "{{ now() }}"
              duration: |
                {{ (as_timestamp(end_time) - as_timestamp(start_time)) | int }}
          - data:
              message: >
                🌤️ Regen vorbei — Rollo Bad öffnen!   Dauer: {{ duration //
                3600 }}h {{ (duration % 3600 // 60) }}m {{ (duration % 60) }}s
            action: notify.telegram