@Mariusthvdb wrote:
HI,
cant find the changes in the script which support an empty/none entity_id.
Please let mask if this then is correct syntax (template at the bottom) in the case of no lights being ‘on’:sequence: service: light.turn_off data_template: entity_id: > {% set ns = namespace(group=[]) %} {% if is_state('group.daughter','not_home') %} {% set ns.group = expand(states.group.all_inside_lights) %} {% else %} {% set ns.group = expand(states.group.all_main_inside_lights) + expand(states.group.plafond_spots_woonkamer) %} {% endif %} {% set all_lights_on = ns.group|selectattr('state','eq','on')|map(attribute='entity_id')|list|join(',') %} {{all_lights_on if all_lights_on|list|length != 0 else none}} transition: 6
if I simply use
{{all_lights_on}}
I get an error:Slapen lighting: Error executing script. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data['entity_id']
if you help me find the pointer to the changes, thanks!
only found this https://github.com/home-assistant/core/pull/31427 so in the above script added ‘none’. Hope this is what was meant to be?
Posts: 2
Participants: 2