Advertisement
JLindvig

VLOOKUP

Jan 13th, 2020
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.80 KB | None | 0 0
  1. script:
  2.   vlookup:
  3.     alias: "VLOOKUP i HA"
  4.     sequence:
  5.       - service: input_select.select_option
  6.         data_template:
  7.           entity_id: "{{ result_list }}"
  8.           option: >-
  9.             {% for needle in state_attr(haystack, "options") %}
  10.               {% if needle == states(haystack) %}
  11.                 {{ state_attr(result_list, "options")[loop.index0] }}
  12.               {% endif %}
  13.             {%- endfor %}
  14.  
  15. automation:
  16.   - alias: "VLOOKUP - TEST"
  17.     trigger:
  18.       - platform: state
  19.         # Den liste hvor vi f.eks. filmtitler
  20.         entity_id: input_select.movie
  21.     action:
  22.       - service: script.vlookup
  23.         data:
  24.           haystack: "input_select.movie"
  25.           # Listen med f.eks. URL - returner element fra samme plads
  26.           result_list: "input_select.movie_url"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement