Hello. At first sory for my english
I have a binary switch and group of lights “group.all_light_big_room”.
when I click on switch lights in group “group.all_light_big_room” change their “color_temp”
This should work for you. It returns a list of entities to the entity_id. You need to make sure you swap your data section for a data_template. Here’s what you should to to replace your current action in your automation.
action:
- data_template:
color_temp: '333'
entity_id: >-
{% set entities = states.group.all_light_big_room.attributes.entity_id %}
{% for entity in entities if states(entity) == 'on' %}
{{- entity }}
{% endfor %}
service: light.turn_on
sorry, but I have one problem with your code when I try it. It dosn’t work.
I have this string in LOG
> 2018-05-18 16:52:46 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: Entity ID light.big_room_lamp_1_2
> light.big_room_lamp_2_2
> light.yeelight_strip_7811dc691b05
> light.gateway_light_7811dcdedb99 is an invalid entity id for dictionary value @ data['entity_id']. Got 'light.big_room_lamp_1_2\nlight.big_room_lamp_2_2\nlight.yeelight_strip_7811dc691b05\nlight.gateway_light_7811dcdedb99'
I think the problem is in format of data in template:
{% set entities = states.group.all_light_big_room.attributes.entity_id %}
{% for entity in entities if states(entity) == 'on' %}
{{- entity }}
{% endfor %}
When I try it in “Templates Developer Tools” it look like this: