Condition Placement & Format

Hass newbie here.

I’m attempting to add time conditions to an automation trigger, but can’t get the format and/or placement of the conditions correct. Hopefully someone can help.

The code only works if I remove the condition lines, otherwise the automation doesn’t show up in Hass

- alias: 'Accent Lights: Color?'
  trigger:
    platform: event
    event_type: call_service
    event_data:
      service_data:
        entity_id: scene.accent_lights_on
      domain: scene
      service: turn_on
  condition:
    condition: and
    conditions:
      - condition: time
        after: 00:00:00
      - condition: time
        before: 15:30:00
  action:
    - service: scene.turn_on
      entity_id: scene.accent_lights_day

Try

- alias: 'Accent Lights: Color?'
  trigger:
    platform: event
    event_type: call_service
    event_data:
      service_data:
        entity_id: scene.accent_lights_on
      domain: scene
      service: turn_on
  condition:
    condition: time
        after: '00:00:00'
        before: '15:30:00'
  action:
    - service: scene.turn_on
      entity_id: scene.accent_lights_day

Thanks! That did the trick!

1 Like