Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [MAX STYLE]
- {% set rain =
- [
- {'state': 'rainy', 'value': 1},
- {'state': 'lightning-rainy', 'value': 1},
- {'state': 'pouring', 'value': 0.5},
- {'state': 'snowy', 'value': 1},
- {'state': 'snowy-rainy', 'value': 1},
- {'state': 'exceptional', 'value': 2},
- {'state': 'default', 'value': 0}
- ]
- %}
- {% set weather = states('weather.casa') if (rain | selectattr('state', 'eq', states('weather.casa')) | list | count) > 0 else 'default' %}
- {{ rain | selectattr('state', 'eq', weather) | map(attribute='value') | first | float(0)}}
- [DEBUG]
- weather.casa = {{ states('weather.casa') }}
- variabile weather = {{ weather }}
- [VITO STYLE]
- {% if is_state('weather.casa', 'rainy') %}
- 1.0
- {% elif is_state('weather.casa', 'lightning-rainy') %}
- 1.0
- {% elif is_state('weather.casa', 'pouring') %}
- 0.5
- {% elif is_state('weather.casa', 'snowy') %}
- 1.0
- {% elif is_state('weather.casa', 'snowy-rainy') %}
- 1.0
- {% elif is_state('weather.casa', 'exceptional') %}
- 2.0
- {% else %}
- 0.0
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement