What am I missing here?

This is the automation that I’m using when I arrive at home… if I take out the condition statement no errors, when I put it back in I get an error…

Am I missing something very simple here? I’ve looked all over and find examples that look identical…

- alias:  16 - Arrival Home
  id: Getting home
  trigger:
    - platform: state
      entity_id: binary_sensor.front_door_motion_occupancy
      to: "on"
  condition:
    - platform: state
      entity_id: device_tracker.sm_f926u1
      to: "home"

error:

Invalid config for [automation]: [to] is an invalid option for [automation]. Check: automation->condition->0->to. (See /config/configuration.yaml, line 79).

I checked line 78 & 79…

binary_sensor: !include_dir_merge_list includes/binary_sensors/
sensor: !include_dir_merge_list includes/sensors/

Like I said works great until I put the condition statement in. I’ve checked my indents, spaces etc…can’t figure out why it’s throwing an error

Thanks all…

to: is not valid for state conditions. It’s state:

  condition:
    - platform: state
      entity_id: device_tracker.sm_f926u1
      state: "home"

See: https://www.home-assistant.io/docs/scripts/conditions/#state-condition

Based on the docs this should work and it’s not…

condition:
    condition: state   
    entity_id: device_tracker.sm_f926u1
    state: "home"
Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->state.
- alias:  16 - Arrival Home
  id: Getting home
  trigger:
    - platform: state
      entity_id: binary_sensor.front_door_motion_occupancy
      state: "on"

  condition:
    condition: state   
    entity_id: device_tracker.sm_f926u1
    state: "home"
  action:
    - service: tts.cloud_say
      entity_id: media_player.sonos_five
      data_template:
        message: >

Please post the full error.

Thank you but I kept at it…ALL the automations I’ve written and this one kicked my behind…ughhhh

Here it is…working.

- alias:  16 - Arrival Home
  id: Getting home
  trigger:
    - platform: state
      entity_id: binary_sensor.front_door_motion_occupancy
      from: "off"
      to: "on"
  condition:
    condition: state
    entity_id: device_tracker.sm_f926u1
    state: home
  action:
    - service: tts.cloud_say
      entity_id: media_player.sonos_five
      data_template:

Now I want to pick your brain… The automation works great now, Thank you but how would you
get this working so it only actually works once when you walk in the door and doesn’t work everytime you trip the sensor?

Just looking for a suggestion.

Thank you!

Turn on an input boolean in the actions.

Use it as a condition to prevent the action running unless the input boolean is off.

You’ll need another automation to to turn it off when you leave home. From my automations:

  condition:
  - condition: state
    entity_id: input_boolean.msg_played_flag_home
    state: 'off'
  - condition: state
    entity_id: input_boolean.dnd
    state: 'off'
  action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.msg_played_flag_home
1 Like

I think I got it.

Arrival automation:

- alias:  16 - Arrival Home
  id: Getting home
  trigger:
    - platform: state
      entity_id: binary_sensor.front_door_motion_occupancy
      from: "off"
      to: "on"
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: device_tracker.sm_f926u1
        state: home
      - condition: state
        entity_id: input_boolean.notify_home
        state: 'on'
  action:
    - service: tts.cloud_say
      entity_id: media_player.sonos_five
      data_template:
        message: >
            {{ ('Great to have you home name, is there anything I can do for you?',
            'Hello name.. what is thy bidding?','Hi name, the dog has been a terror all day.',
            'name, where have you been all day?'
            )|random | replace("name",  "John", "Master", "Johnnyboy")| random) }}
    - service: input_boolean.turn_off
      entity_id: input_boolean.notify_home

SO to trip that I added it in two places… one in my door lock to turn if ‘off’ and the other in my door unlock automation to turn it ‘on’, then back ‘off’ after it runs when I get home… [ Yeah I know it’s a mess with single and double quotes all over the place… gotta clean all that up but it should work].

I thought I had it… can you perhaps point to where I went wrong here… I’m getting this error:

Invalid config for [automation]: not a valid value for dictionary value @ data['action'][1]['entity_id']

This is what I have in the door lock/unlock automation and arrival automation…

- alias: 24 - Locking Door
  id: Locking Door

  trigger:
    - platform: state
      entity_id: device_tracker.sm_f926u1
      from: home
      to: not_home

  action:
    - service: lock.lock
      target:
        entity_id: lock.front_door_lock
    - service: input_boolean.turn_off
      target:
        entity_id: input_boolean.notify_home            
    - service: notify.mobile_app_sm_f926u1
      data:
        message: "TTS"
        title: "Locking the doors for you John"
        data:
          channel: alarm_stream_max
          ttl: 0
          priority: high

- alias: Unlocking Door
  id: Unlocking Door

  trigger:
    - platform: state
      entity_id: device_tracker.sm_f926u1
      from: not_home
      to: home


  action:
    - service: lock.unlock
      target:
        entity_id: lock.front_door_lock
    - service: input_boolean.turn_on
      target:
        entity_id: input_boolean.notify_home
    - service: notify.mobile_app_sm_f926u1
      data:
        message: "TTS"
        title: "You're home great! I'm Unlocking the Door for John."
        data:
          channel: alarm_stream_max
          ttl: 0
          priority: high

Arrival automation: from above message

OH never mind LOL Typo’s… killers…

I had this:

input_boolean.input_boolean.notify_home

Found it… Thanks for your time!!! :slight_smile: