I’m very new to HomeAssistant and I’m having trouble getting my head around the scripting engine.
I’ve got my WALLC-s wall swtich working and have got it to switch on a Philips Hue light, but I’d like it to be able te determine the light color depending on the time of day.
What I have now is the following:
automation:
alias: Switch test
trigger:
platform: event
event_type: zwave.scene_activated
event_data:
entity_id: zwaveme_zme_wcd2_double_paddle_wall_controller_7
scene_id: 11
action:
service: light.turn_on
entity_id: light.livingroom
But I’d like to add the folliwng to action: Where Get_XY_Color is a function (template?)
xy_color = {Get_XY_Color}
This is what I have in mind, but I have no idea how to do this in HA. Maybe I need to implement it in a totally different way, hopefully someone can help
# Sun below horizon set lights to soft warm
- alias: 'Set Relax theme for Hue lights'
trigger:
platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 0
action:
- set:
xy_color = 0.5134,0.4149
# Sun high, set lights to 'daylight color' (Concentrate theme)
- alias: 'Set Concentrate theme for Hue lights'
trigger:
platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
above: 30
action:
- set:
xy_color = 0.3693,0.3695