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
silvrr
December 5, 2018, 8:58pm
2
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
silvrr
December 5, 2018, 9:50pm
4
hicling:
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
hicling
December 5, 2018, 10:09pm
5
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
123
(Taras)
December 5, 2018, 10:23pm
6
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?
Problems with automation below. It appears to never trigger. Iâm using 0.78.0 on Docker instalationâŚ
If I use any other trigger such as State it will work fine ( but I need Time ). What is my glaring mistake?
- id: weekday_morning_lights
alias: Weekday Morning Lights
hide_entity: false
initial_state: true
trigger:
platform: time
at: '07:00:00'
condition:
- condition: state
entity_id: script.weekday_morning_sequence
state: 'off'
action:
- service: script.turâŚ
hicling
December 5, 2018, 10:46pm
7
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
123
(Taras)
December 5, 2018, 10:50pm
8
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