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

Returning a list from a template

$
0
0

@luma wrote:

I’m trying to figure out how to get a template to produce a list that can be consumed as a list by a service call. Specific case right now is to enumerate a list of scenes, and send that list to an input_select as a list of available options

Currently, this is what I have:

  - service: input_select.set_options
    data_template:
      entity_id: "input_select.hasp_plate01_page1button4scene"
      options: "[{% for item in states.scene %}'{{ item.entity_id }}'{% if not loop.last %}, {% endif %}{% endfor %}]"

That template renders as ["scene.daylight", "scene.lights_off", "scene.lights_on", "scene.night"] which, if pasted into the service call, works like expected. However, I’m pretty sure it’s just rendering as a long string and I think I need it to somehow be returning a list.

Is this possible?

Posts: 14

Participants: 6

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



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