All Automations Firing Twice?

I’m running into an issue where the actions on my automations are firing twice. I’ve included an example below. It’s a minor annoyance right now as the only thing my automations do is send me a pushbullet notification. It’s going to become a bigger issue for some other automations I have planned though, so I’d apreciate anyone’s help!

`# Alert me if the laundry room door has been left open for five minutes

  • trigger:
    platform: state
    entity_id: binary_sensor.laundry_room_door
    state: ‘on’
    for:
    minutes: 5
    action:
    service: notify.house
    data:
    title: Door Alert
    message: The laundry room door is open, and has been for five minutes.`

I’ve tried calling the notify.house service directly, and can confirm it only sends a single notification when used in this way.

What happens if you replace state: 'on'

with to: 'on' ?

No change :frowning:. Here’s the logbook view of what happened:

I have another automation example that already uses from and to, and it also suffers from the double notification thing.

`# Alert Jason when Flo leaves work.

  • trigger:
    platform: state
    entity_id: device_tracker.flosphone_flo
    from: ‘work’
    to: ‘not_home’
    action:
    service: notify.house
    data:
    title: Location Update
    message: Flo has left work.`

I just had a thought. I have my automations defined in a file named automations.yaml. I’d guess that’s probably a pretty common convention.

In configuration.yaml I’m including that file by doing automation: !include automation.yaml

Should I be? Is automation.yaml automatically loaded, and then I’m loading it a second time manually?

Fixed it. Thanks @fanaticDavid for pointing me in the right direction.

Turns out I had to be even more explicit than you suggested:
from: 'off' to: 'on'

But that got it.

I have template condition but still I am seeing duplicate notifications though I don’t have from/to filter in trigger.

- alias: Ecobee thermostate status changed
  trigger:
    - platform: state
      entity_id: sensor.thermostat_downstairs_current_status, sensor.thermostat_upstairs_current_status
      state: 'cool'
  condition:
    - condition: template
      value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'
  action:
    - service: shell_command.run_ecobee_python_file
    - service: notify.notify_me

Just to cross reference this. This was adressed like a week ago in another thread already :wink:

1 Like

Glad my suggestion put you on the right track, and that you got it to work!

FYI: Yes, an include is necessary. HASS won’t pick up seperate YAML-files unless you’ve included them in your configuration.yaml file in some shape or form.

1 Like

I will try it by updating all my automation to be explicit using ‘from’ and ‘to’ all the times.
I thought condition should help though as I mentioned in my code above post as well below here.

  condition:
    - condition: template
      value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'

Thanks