Advertisement
JLindvig

Glance creator

Oct 19th, 2020
2,316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.58 KB | None | 0 0
  1. {%- set main_group = "group.alle_rum" %}
  2.  
  3. {%- macro glance(group) %}
  4.         type: glance
  5.         show_state: false
  6.         entities:
  7.          {%- for light in expand(group) %}
  8.             {{- entity(light.entity_id, group) }}
  9.           {%- endfor -%}
  10. {% endmacro %}
  11.  
  12. {%- macro entity(light, group) %}
  13.           - entity: {{ light }}
  14.             tap_action:
  15.               action: toggle
  16.             hold_action:
  17.              {{ open_slider(group) }}
  18. {%- endmacro %}
  19.  
  20. {%- macro open_slider(group) -%}
  21.               action: call-service
  22.               service: browser_mod.popup
  23.               service_data:
  24.                 title: Indstilling af lys
  25.                 style:
  26.                   border-radius: 20px
  27.                   --ha-card-border-radius: 20px
  28.                 card:
  29.                   type: entities
  30.                   title: {{ state_attr(group,'friendly_name') }}
  31.                   show_header_toggle: true
  32.                   entities:
  33.                  {%- for light in expand(group) %}
  34.                     - type: custom:slider-entity-row
  35.                       entity: {{ light.entity_id }}
  36.                       toggle: true
  37.                   {%- endfor %}
  38.                 deviceID:
  39.                  - this
  40. {%- endmacro %}
  41.  
  42. type: custom:stack-in-card
  43. cards:
  44.   - type: entities
  45.     entities:
  46.      - input_select.room_light
  47.   - type: custom:state-switch
  48.     entity: input_select.room_light
  49.     states:
  50.    {% for group in state_attr(main_group, 'entity_id') %}
  51.       {{ state_attr(group,'friendly_name') }}:
  52.      {{- glance(group) }}
  53.     {% endfor %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement