Keep from automation firing at Startup

New user to HA and I am having a small issue with an automation firing every time I restart HA. I have a z-wave sensor on my garage door to notify me when it has opened and also when it has closed. Every time I restart it, it fires and sends me an email that my garage door is closed, even though that device did not fire that message.

Is it the way that I configured my automation section and if so, is there a way that I can get around it?

Here’s the section from my yaml file:

‘’'yaml
automation:

  • alias: GarageDoorClosed
    trigger:
    platform: state
    entity_id: binary_sensor.ecolink_garage_door_sensor_sensor_8
    state: ‘off’
    action:
    service: notify.mypushbullet
    data:
    title: ‘Garage Door Closed’
    message: ‘Garage Door has been closed’
    ‘’’

You can make the rule more specific by using to: and from: instead of only state:.

trigger:
platform: state
entity_id: binary_sensor.ecolink_garage_door_sensor_sensor_8
from: 'on'
to: 'off'

That way it will only trigger when it first was ‘on’.

P.S. When posting code, use three backticks (` left of the 1 on your keyboard), ‘yaml’ and then paste your code. End with another three backticks. Like this:

‘’‘yaml
blablablacode
‘’’

That way your indentation will be kept. For a single line just put a backtick in front and at the end: ‘blablacodebla’

1 Like

That did it!!!

Thanks for the help and quick response!!

1 Like