Automation not triggered

This is one of my first automations, but it’s NOT triggered also if the config check tells me it’s ok… Can somebody tell me why doesn’t work as expected?

- alias: Movimento al buio Accendi Luci salotto
  initial_state: true
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0001a98a62
    to: 'on'
  - condition: numeric_state
    entity_id: sensor.illumination_7811dcb25b7c
    below: 120
  - condition: time
    after: 00:01:00
#    before: 07:00:00
  - condition: sun
    before: sunrise
  - condition: sun
    after: sunrise
  - service: light.turn_on
    entity_id: light.gateway_light_7811dcb25b7c
      brightness: 50
      color: gold
  - service: light.xiaomi_miio_set_scene
    entity_id: light.philips_salotto
      scene: 4
  - delay: 00:01:00
  - service: light.turn_off
    - light.gateway_light_7811dcb25b7c
    - light.philips_salotto

Are you seeing an error in home_assitant.log? I’m not sure you’ve got the condition block structured properly.

This is what i get:

Invalid service data for media_player.play_media: Entity ID is an invalid entity id for dictionary value @ data[‘entity_id’]. Got ‘’

There’s not a play_media service call in the automation you pasted above. But you’ll need to resolve your configuration before things will work correctly.

You can get a list of valid media_player entities by using the states dev tool. It’s a button at the bottom of the left bar. Looks like <>

this is my script…and i think it’s correct:

your script doesn’t appear to relate to your question above?
Also I’ve never seen more than 1 entity listed for one action:

  - service: light.turn_off
    - light.gateway_light_7811dcb25b7c
    - light.philips_salotto

Now I might be wrong, but might be worth trying this instead:

  - service: light.turn_off
    - light.gateway_light_7811dcb25b7c
    - light.philips_salotto

If that makes no difference, I’d try a simpler automation with just one trigger and one action. See if that works. If it does, add elements 1 by 1 to see when it fails.
It will be easier to help you then

You haven’t been looking very hard then :stuck_out_tongue_winking_eye:, that’s standard practice.


Remove the conditions, check the automation is on, check that the binary sensor is actually turning from off to on, if the automation still doesn’t fire post the error message :+1:

Thanks, I got so used to listing every action with a service and not stumbled upon such a syntax when browsing the community. You learn every day I guess :slight_smile:
and I just noticed I did not add the service bit in my previous answer. Guess I need to stick to 1 post at a time instead of replying left, right and center :slight_smile:

1 Like