Automation enable/disable based on entity state(s)

For future reference, if someone else is looking at translating this blueprint:

This is what I ended up with and it works perfectly:

- alias: Garage cam human > app notification
  description: ''
  trigger:
    platform: state
    entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection
    from: 'off'
    to: 'on'
  variables:
    snapshot_create_file_path: /config/www/tmp/snapshot_cam_garage_mainstream.jpg
    snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/config/www'',''/local'')
      }}'
  condition:
    alias: Alarm is NOT disarmed
    condition: not
    conditions:
    - condition: state
      entity_id: alarm_control_panel.home_alarm
      state: disarmed
  action:
  - delay: 0
  - service: camera.snapshot
    entity_id: camera.cam_garage_mainstream
    data:
      filename: '{{ snapshot_create_file_path }}'
  - service: notify.notify
    data:
      title: Garage camera persoon!
      message: Garage camera heeft een persoon gezien!
      data: '{{ {"image": "%s"} | format(snapshot_access_file_path) }}'

It was a bit challenging, but I’m glad I did it.
And I learned a lot about conditions and templates along the way.

1 Like