Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95419

Help to filter entities in data_template

$
0
0

@Oligarch wrote:

I get two variables (room and appliance) from DialogFlow. They are specified in template only for testing. Template works fine, but I wonder if there is any other way of filtering. I don’t like the output of {{entities}} is string, not an array. But I do not know how to do otherwise.

data_template:
  entity_id: >
    {% set room = ['kitchen','bedroom'] %}
    {% set appliance = 'livolo' %}
    {% set type = { 'livolo':'switch', 'neoclimaartvogue': 'climate', 'broadlinksp3sboiler':'switch' } %}
    {% set entities = type[appliance]+'.'+appliance+'_' +room | join(type[appliance]+'.'+appliance+'_')  %}
    {{ states | selectattr('entity_id', 'in', entities)
              | map(attribute='entity_id')
              | join(', ') }}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>