Hello all - I think I need to use a “dictionary” to convert/translate to English
I have @stephan19’s card (above) working just fine but the data is in German. I want to change the “headline” at a minimum to English but NOT sure exactly where to put the ‘translate’ code.
I see @Maxi531 is using a template to set an image to a corresponding numerical value. I think this is doable trying to essentially do something similar.
I can grab the value but can’t correlate it.
This is my code:
{% set dwd_sensor = state_attr('sensor.dwd_weather_warnings_107336000_current_warning_level', 'warning_1_type') %} {%
set warn_lvl = {
11: "COASTAL WARNING - GUSTS",
12: "COASTAL WARNING - WIND",
13: "COASTAL WARNING - STORM",
14: "OCEAN WARNING - STRONG WIND",
15: "OCEAN WARNING - STORM",
16: "OCEAN WARNING - HEAVY STORM",
22: "FROST",
24: "SLICK",
31: "THUNDERSTORMS",
33: "STRONG THUNDERSTORM",
34: "STRONG THUNDERSTORM",
36: "STRONG THUNDERSTORM",
38: "STRONG THUNDERSTORM",
40: "SEVERE THUNDERSTORM with GALE-FORCE WINDS",
41: "SEVERE THUNDERSTORM with EXTREME GALE-FORCE WINDS",
42: "SEVERE THUNDERSTORM with HEAVY RAIN",
44: "SEVERE THUNDERSTORM with GALE GUSTS and HEAVY RAIN",
45: "SEVERE THUNDERSTORM with EXTREME GALE-FORCE WINDS and HEAVY RAIN",
46: "SEVERE THUNDERSTORM with HEAVY RAIN and HAIL",
48: "SEVERE THUNDERSTORM with GALE-FORCE GUSTS, HEAVY HEAVY RAIN and HAIL",
49: "SEVERE THUNDERSTORM with EXTREME GALE GUSTS, HEAVY RAIN and HAIL",
51: "WIND GUSTS",
52: "STORM GUSTS",
53: "HEAVY WIND GUSTS",
54: "GALE FORCE WINDS",
55: "GALE GUSTS",
56: "EXTREME GALE-FORCE WINDS",
57: "INLAND WATERWAY WARNING - STRONG WIND",
58: "INLAND WATERWAY WARNING - STORM",
59: "FOG",
61: "STRONG RAIN",
62: "HEAVY RAIN",
63: "PERSISTENT RAIN",
64: "HEAVY CONTINUOUS RAIN",
65: "EXTREMELY HEAVY CONTINUOUS RAIN",
66: "EXTREMELY HEAVY RAIN",
70: "LIGHT SNOWFALL",
71: "SNOW",
72: "HEAVY SNOWFALL",
73: "EXTREMELY HEAVY SNOWFALL",
74: "SNOWDRIFT",
75: "HEAVY SNOWDRIFT",
76: "EXTREMELY HEAVY SNOWDRIFT",
79: "",
82: "HARD FREEZE",
84: "SURFACE ICE",
85: "BLACK ICE",
87: "BLACK ICE",
88: "THAW",
89: "SEVERE THAW",
90: "THUNDERSTORMS",
91: "STRONG THUNDERSTORMS",
92: "HEAVY THUNDERSTORMS",
93: "EXTRME THUNDERSTORMS",
95: "SEVERE THUNDERSTORM with EXTREMELY HEAVY RAIN and HAIL",
96: "EXTREME THUNDERSTORM with GAIL-FORCE GUSTS, EXTREMELY HEAVY RAIN and HAIL",
98: "TEST-WARNUNG",
99: "TEST SEVERE WEATHER WARNING",
246: "UV-INDEX",
247: "HEAT",
248: "EXTREME HEAT"}
%}