Automation help needed

Good morning everyone,

I’m trying to setup my first automation with my hue motion sensor/SMTP notification and I can’t seem to get it working. If I run just the action, it sends an E-Mail with no problem. I can’t seem to get the trigger working. I’m guessing it has to do with the name of the states but I can’t verify that. Any and all help you’d be willing to provide would be appreciated. Here’s my automation:

- id: '1549945237553'
  alias: Test EMail
  trigger:
  - entity_id: binary_sensor.motion_kitchen
    from: Clear
    platform: state
    to: Detected
  action:
  - data:
      message: Intruder alert at apartment!!
      title: Intruder alert
    service: notify.eric_notifier

Trigger from ‘off’ to ‘on’. It only displays as detected/clear.

  1. You don’t need from.

2, Are you sure Detected is the correct state, including case, IE are you sure it isn’t detected and not Detected.

@tom_l
I thought that too but, when I change it to that, I get the following error when I run the “Check configuration”

Invalid config for [automation]: expected str for dictionary value @ data[‘trigger’][0][‘from’]. Got None
expected str for dictionary value @ data[‘trigger’][0][‘to’]. Got None. (See /config/configuration.yaml, line 109). Please check the docs at https://home-assistant.io/components/automation/

@nickrout
When I I remove the “from” field and change the “To” setting to “on”, I get this error:

Invalid config for [automation]: expected str for dictionary value @ data[‘trigger’][0][‘to’]. Got None. (See /config/configuration.yaml, line 109). Please check the docs at https://home-assistant.io/components/automation/

1 Like

You have to put off and on in quotes.

- id: '1549945237553'
  alias: Test EMail
  trigger:
  - entity_id: binary_sensor.motion_kitchen
    from: 'off'
    platform: state
    to: 'on'

off/on and false/true are reserved words that evaluate to 0/1

You are awesome! It worked. Thank you so much for the help.

I do have one more question for you though if you don’t mind. Is there some sort of a list that I could find that would show me the different entity trigger options?

There are quite a few here: