{% set entities = state_attr('sensor.home_inside_temperature_sensors', 'entity_id') %}
{% set values = entities | map('states') | map('float',0) | list %}
{% set z = zip(entities, values) | selectattr(1, 'gt', 16) | list %}
{{ z | map(attribute=0) | list }}
The result is a list containing the entity_id of all sensors (who are members of sensor.home_inside_temperature_sensors) whose state value is greater than 16.
Let me know if you need help to modify it to meet any other requirements you have.
NOTE
The reason why filtered_list fails to report anything is because of Jinja2’s scope rules. When you change a variable’s value inside a Jinja2 for-loop, that value remains local to the for-loop. In other words, that value doesn’t exist outside of the for-loop.
You would need to use namespace to ensure the variable’s value is preserved outside the for-loop.
{% set ns = namespace(filtered_list = []) %}
{% for item in temp_sensors %}
{% if (states(item) | float) > 16 %}
{% set ns.filtered = ns.filtered_list + [item] %}
{% endif %}
{% endfor %}
{{ ns.filtered_list }}
Or like this:
{% set ns = namespace(filtered_list = []) %}
{% for item in temp_sensors if (states(item) | float) > 16 %}
{% set ns.filtered = ns.filtered_list + [item] %}
{% endfor %}
{{ ns.filtered_list }}
Or you can forego the use of a for-loop and use zip as shown in my example.