Advertisement
Skeem

sensor.yaml

Aug 25th, 2021
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.18 KB | None | 0 0
  1.  
  2. - platform: template
  3.   sensors:
  4.     antalrodvin:
  5.       friendly_name: Antal rødvin
  6.       icon_template: mdi:bottle-wine
  7.       value_template: >-
  8.             {% set ns = namespace(count=0) %}
  9.             {% for state in states.sensor if 'cellar_tracker_type' in state.entity_id and 'red' in state.entity_id and not 'sparkling' in state.entity_id and not 'fortified' in state.entity_id and not 'dessert' in state.entity_id  %}
  10.             {% set ns.count = ns.count + state.state|int %}  
  11.             {% endfor %}
  12.             {{ ns.count }}
  13.  
  14. - platform: template
  15.   sensors:
  16.     antalhvidvin:
  17.       friendly_name: Antal hvidvin
  18.       icon_template: mdi:bottle-wine
  19.       value_template: >-
  20.             {% set ns = namespace(count=0) %}
  21.             {% for state in states.sensor if 'cellar_tracker_type' in state.entity_id and 'white' in state.entity_id and not 'sparkling' in state.entity_id and not 'fortified' in state.entity_id and not 'dessert' in state.entity_id  %}
  22.             {% set ns.count = ns.count + state.state|int %}  
  23.             {% endfor %}
  24.             {{ ns.count }}
  25.            
  26. - platform: template
  27.   sensors:
  28.     antalrosevin:
  29.       friendly_name: Antal rosévin
  30.       icon_template: mdi:bottle-wine
  31.       value_template: >-
  32.             {% set ns = namespace(count=0) %}
  33.             {% for state in states.sensor if 'cellar_tracker_type' in state.entity_id and 'ros' in state.entity_id and not 'sparkling' in state.entity_id and not 'fortified' in state.entity_id and not 'dessert' in state.entity_id  %}
  34.             {% set ns.count = ns.count + state.state|int %}  
  35.             {% endfor %}
  36.             {{ ns.count }}
  37.            
  38. - platform: template
  39.   sensors:
  40.     antalmousserende:
  41.       friendly_name: Antal mousserende vine
  42.       icon_template: mdi:bottle-wine
  43.       value_template: >-
  44.             {% set ns = namespace(count=0) %}
  45.             {% for state in states.sensor if 'cellar_tracker_type' in state.entity_id and 'sparkling' in state.entity_id %}
  46.             {% set ns.count = ns.count + state.state|int %}  
  47.             {% endfor %}
  48.             {{ ns.count }}
  49.  
  50. - platform: template
  51.   sensors:
  52.     antaldessert:
  53.       friendly_name: Antal dessertvine
  54.       icon_template: mdi:bottle-wine
  55.       value_template: >-
  56.             {% set ns = namespace(count=0) %}
  57.             {% for state in states.sensor if 'cellar_tracker_type' in state.entity_id and ('fortified' in state.entity_id or 'dessert' in state.entity_id) %}
  58.             {% set ns.count = ns.count + state.state|int %}  
  59.             {% endfor %}
  60.             {{ ns.count }}
  61.  
  62. - platform: template
  63.   sensors:
  64.     antalandre:
  65.       friendly_name: Antal andre
  66.       icon_template: mdi:bottle-wine
  67.       value_template: >-
  68.             {% set ns = namespace(count=0) %}
  69.             {% for state in states.sensor if 'cellar_tracker_type' in state.entity_id and not 'white' in state.entity_id and not 'ros' in state.entity_id and not 'red' in state.entity_id and not 'sparkling' in state.entity_id and not 'fortified' in state.entity_id and not 'dessert' in state.entity_id  %}
  70.             {% set ns.count = ns.count + state.state|int %}  
  71.             {% endfor %}
  72.             {{ ns.count }}
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement