@Seweryn_Zeman wrote:
I’m trying to create an array of elements to be set by input_boolean and used in script service call.
vacuum_zones: alias: 'Vacuum zones' sequence: - service: vacuum.send_command data_template: entity_id: vacuum.vacuum command: zoned_cleanup params: zone_ids: >- {% if is_state('input_boolean.vacuum_zone_corridor', 'on') %}'Corridor'{% endif %} {% if is_state('input_boolean.vacuum_zone_kitchen', 'on') %}'Kitchen'{% endif %} {% if is_state('input_boolean.vacuum_zone_saloon', 'on') %}'Saloon'{% endif %} {% if is_state('input_boolean.vacuum_zone_bathroom', 'on') %}'Bathroom'{% endif %} {% if is_state('input_boolean.vacuum_zone_office', 'on') %}'Office'{% endif %} {% if is_state('input_boolean.vacuum_zone_bedroom', 'on') %}'Bedroom'{% endif %}
I hope example above is self-explanatory. I’ve found similar
data_template
and tried to adjust it, but it gives no error in logs and also doesn’t start zoned cleanup.When i.e.
input_boolean.vacuum_zone_kitchen
andinput_boolean.vacuum_zone_bathroom
areon
I’d like to send such a service call:- service: vacuum.send_command data: entity_id: vacuum.vacuum command: zoned_cleanup params: zone_ids: ['Kitchen', 'Bathroom']
I believe YAML’s
- element
work same as[]
, because I tested example via Dev tools in UI.
Posts: 4
Participants: 2