Error using time in automation

HI all,

I keep getting this error since I created a new automation routine:

Invalid config for [automation]: [before] is an invalid option for [automation]. Check: automation->trigger->0->before. (See /home/pi/.homeassistant/configuration.yaml:466)

This breaks all automation on the server until I comment it out.

This the section I added:

automation 3:
    platform: time
    after: "6:50"
    before: "23:59"
    platform: state
    entity_id: group.presence
    state: 'home'
    service: scene.turn_on
    entity_id: scene.kitchen_bright

I’m not sure what’s wrong. Any ideas?

Try switching " to ’ around the times.

Just tried that. Same result.

Maybe your missing the alias?

- alias: 'Automatic Night Time'
    platform: time
    after: '22:00:00'
    - platform: state
      entity_id: light.linear_unknown_type4754_id3038_level_5
      state: 'on'
    service: homeassistant.turn_on
    entity_id: light.linear_unknown_type4754_id3038_level_5
      brightness: 10

I think you must make an automation to start your scene and one to stop your scene.

I don’t think i need an alias as I don’t use it for my other working sections of automation.

I tried formatting the time with seconds as well, eg. ‘23:59:00’. It’s still not working.

for the service try homeassistant.turn_on. That should turn anything on regardless of what it is.

Also I’m not sure if it’s required but you don’t have the brightness identified.

As the error message says:
[before] is an invalid option for [automation]

It does not make sense to have before as a trigger parameter.
If you want your automation to trigger at 6:50, just remove the line with “before: …”

What if in invert the trigger and the condition?

It will trigger when present but the condition only being during the set timeframe.

That’s what it was. It makes sense a time range can’t be a trigger but rather a condition.

Thanks for all your help guys!

BTW, this should be changed to

  condition: state

due to recent changes in HA. When I was debugging a problem in my automations and looking through the logs, HA notified me of the change.