Automation trigger time

I am trying to get a workday morning light automation to work but cant get the time trigger to work. I can activate the automation manually.

Here is my code:

  - id: Morgon ljus arbetsdagar
    alias: Morgon ljus arbetsdagar
    trigger:
      platform: time
      at: '05:45:00'
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: 'device_tracker.victor_c4a9ed9a821b453c8f61b87819bd1a64'
          state: 'home'
        - condition: state
          entity_id: 'binary_sensor.workday_sensor'
          state: 'on'
    action:
      - service: light.turn_on
        entity_id: light.kok_taklampa
        data_template:
          color_temp: 450
          brightness: 125
      - service: light.turn_on
        entity_id: light.hall_lampa
        data_template:
          color_temp: 450
          brightness: 125

Can you format your code per the blue box at the top of every post?

Are your conditions met at 5:45? the device tracker is home and the binary sensor is ‘on’

Double check your entity IDs and the states using the developer tools states tab. the difference between a state of ‘ON’ vs. ‘on’ has tripped up others in the past.

Yes my conditions are met at 5:45 even tried whith only the trigger and not the conditions but still no luck.

tried this one but still no luck. It works when i activate it manually but not on the trigger

- id: Morgon ljus arbetsdagar
  alias: Morgon ljus arbetsdagar
  trigger:
    - platform: time
      at: "22:30:00"
  action:
    - service: homeassistant.turn_on
      entity_id: light.hall_lampa

try…

- id: Morgon ljus arbetsdagar
  alias: Morgon ljus arbetsdagar
  trigger:
    - platform: time
      at: '22:30:00'
  action:
    - service: light.turn_on
      entity_id: light.hall_lampa

still no luck.

- id: Morgon ljus arbetsdagar
  alias: Morgon ljus arbetsdagar
  trigger:
    - platform: time
      at: '23:05:00'
  action:
    - service: light.turn_on
      entity_id: light.hall_lampa

You have no template so shouldn’t that be data instead of data_template?

      - service: light.turn_on
        entity_id: light.hall_lampa
        data_template:
          color_temp: 450
          brightness: 125

This thread talks about a time triggering problem that was due to incorrect timezone. Maybe it applies to your situation?

dont know the data/data_template part but the automation works when i trigger it manually

And as you pointed out it was a timezone problem i was 1 h off…

thank you so much

You’re welcome! Glad to hear it helped you resolve the problem.

From all examples I’ve seen, data_template is used when it has an actual template (Jinja2). I think what you have works because it doesn’t care if the template is missing. However, if it were the other way around, meaning it says data: but also contains a template, then that probably wouldn’t work.

1 Like