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

Using Item Select as in Array in Automations

$
0
0

@lonebaggie wrote:

Not sure if this has been documented anywhere, but I have been using Input select as Global variables lists (Arrays) in Automations.

Take the following input Select

Array:
    name : Array Test
    options:
      - Option A
      - Option B
      - Option C
      - Option D

You can convert this to a list in JInga2 with the following

{% set arraytest = state_attr("input_select.array","options") %}

You can extract an array element by using

`{% set obj = arraytest[1] %}` 
{{obj}}

This will return ‘Option B’ Jinga2 lists start at element 0

I use this to trigger actions from Alexa using a virtual bulb . The brightness level corresponds to an element in the item select.

see

Hope this is of some use

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 105620

Trending Articles



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