Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Rozbite dla czytelności
- {{ {
- "a":"bardzo dobra",
- "b":"dobra",
- "c":"umiarkowana",
- "d": "dostateczna",
- "e":"zła",
- "f":"bardzo zła"
- }[[
- states("sensor.syngeos_pm10_grade") | replace("grade-",""),
- states("sensor.syngeos_pm2_5_grade") | replace("grade-","")
- ] | max] }}
- # W jednej linijce
- {{ {"a":"bardzo dobra", "b":"dobra", "c":"umiarkowana", "d": "dostateczna", "e":"zła", "f":"bardzo zła"}[[states("sensor.syngeos_pm10_grade") | replace("grade-",""),states("sensor.syngeos_pm2_5_grade") | replace("grade-","")] | max] }}
- # Wersja if-else
- {% set worse = [states("sensor.syngeos_pm10_grade"), states("sensor.syngeos_pm2_5_grade")] | max %}
- {% if worse == "grade-a" -%}
- bardzo dobra
- {% elif worse == "grade-b" -%}
- dobra
- {% elif worse == "grade-c" -%}
- umiarkowana
- {% elif worse == "grade-d" -%}
- dostateczna
- {% elif worse == "grade-e" -%}
- zła
- {% elif worse == "grade-f" -%}
- bardzo zła
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement