Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Imitate available variables:
  2. {% set my_test_json = {
  3. "temperature": 25,
  4. "unit": "°C"
  5. } %}
  6.  
  7. The temperature is {{ my_test_json.temperature }} {{ my_test_json.unit }}.
  8.  
  9. {% if is_state("device_tracker.paulus", "home") and
  10. is_state("device_tracker.anne_therese", "home") -%}
  11. You are both home, you silly
  12. {%- else -%}
  13. Anne Therese is at {{ states("device_tracker.anne_therese") }}
  14. Paulus is at {{ states("device_tracker.paulus") }}
  15. {%- endif %}
  16.  
  17. For loop example:
  18. {% for state in states.sensor -%}
  19. {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
  20. {{ state.name | lower }} is {{state.state_with_unit}}
  21. {%- endfor %}.
  22.  
  23. {{ now() }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement