I created a template sensor that generates a list of rooms to be vacuumed.
{% if is_state_attr('sensor.tracker','home_zone', true) %}
{% set rooms = [] %}
{% if is_state('sensor.tracker','not home') or
states('sensor.before_alarm_time') | int(default=0) > 3600 and
states('sensor.before_alarm_time') | int(default=0) < 7200 and
is_state('binary_sensor.door_sensor_br_contact','off') %}
{% if (as_timestamp(state_attr('timer.vacuum_lr','finishes_at'), as_timestamp(now())) - as_timestamp(now())) | int < 43200 and
is_state('sensor.tracker','not home') or is_state('timer.vacuum_lr','idle') %}
{% set rooms = rooms + [16] %}
{% endif %}
{% endif %}
{% if is_state('sensor.tracker','not home') or
is_state('input_select.human_location','Living room') and
is_state('binary_sensor.door_sensor_br_contact','on') %}
{% if (as_timestamp(state_attr('timer.vacuum_br','finishes_at'), as_timestamp(now())) - as_timestamp(now())) | int < 43200 and
is_state('sensor.tracker','not home') or is_state('timer.vacuum_br','idle') %}
{% set rooms = rooms + [18] %}
{% endif %}
{% endif %}
{% if is_state('sensor.tracker','not home') or
is_state('input_select.human_location','Living room') %}
{% if (as_timestamp(state_attr('timer.vacuum_hall','finishes_at'), as_timestamp(now())) - as_timestamp(now())) | int < 43200 and
is_state('sensor.tracker','not home') or is_state('timer.vacuum_hall','idle') %}
{% set rooms = rooms + [17] %}
{% endif %}
{% endif %}
{{rooms}}
{% endif %}
However, I am not able to decode this data afterwards
I try:
{{ states('sensor.vacuum_cleaning_shedule_list') | count }}
that render 4 , when for example sourse sensor render [16].
Looks like it’s counting character counts instead of items
Also it is not clear to me how to check if there is a specific item in the list
Thanks