Hi,
I’m trying to use a light template to combine a shelly smart (switch.light_livingroom) switch and some ikea trädfri bulbs in the corresponding lamp within a light group (light.bulbs_spotlight_livingroom) to one light.
This is my code so far:
- platform: template
lights:
livingroom_spots:
friendly_name: "Wohnzimmer Deckenstrahler (unified)"
level_template: "{{ state_attr('light.bulbs_spotlight_livingroom', 'brightness')|int }}"
value_template: "{{ is_state('switch.light_livingroom', 'on') and is_state('light.bulbs_spotlight_livingroom', 'on')}}"
#temperature_template: "{{states('input_number.temperature_input') | int}}"
#color_template: "({{states('input_number.h_input') | int}}, {{states('input_number.s_input') | int}})"
color_template: "{{ state_attr('light.bulbs_spotlight_livingroom', 'hs_color') | float}}"
#effect_list_template: "{{ state_attr('light.bulbs_spotlight_livingroom', 'effect_list') }}"
turn_on:
- service: homeassistant.turn_on
target:
entity_id: switch.light_livingroom
- service: light.turn_on
target:
entity_id: light.bulbs_spotlight_livingroom
turn_off:
service: light.turn_off
target:
entity_id: light.bulbs_spotlight_livingroom
set_level:
- service: homeassistant.turn_on
target:
entity_id: switch.light_livingroom
- service: light.turn_on
target:
entity_id: light.bulbs_spotlight_livingroom
data_template:
brightness: "{{ brightness }}"
set_temperature:
service: light.turn_on
target:
entity_id: light.bulbs_spotlight_livingroom
data_template:
color_temp: "{{ color_temp }}"
data:
value: "{{ color_temp }}"
entity_id: input_number.temperature_input
set_color:
- service: light.turn_on
data_template:
hs_color:
- "{{ h }}"
- "{{ s }}"
entity_id: light.bulbs_spotlight_livingroom
# set_effect:
# - service: light.turn_on
# data_template:
# entity_id:
# - light.livingroom_bulb1
# - light.livingroom_bulb2
# - light.livingroom_bulb3
# effect: "{{ effect }}"
I have also a light card in my lovelace dashboard to control the lamp. Switching on and off works perfectly in all combinations of switch and lamp, also setting the brightness works very good. But unfortunately setting the light fails, simply nothing happens.
I’ve took the code from the example from HA guide and modified, maybe I’ve overseen something or do not really understand it. Any idea what is wrong