This commit is contained in:
joBr99
2022-06-18 22:36:40 +02:00
3 changed files with 12 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ assignees: ''
This issue template is meant to REPORT BUGS/PROBLEMS ONLY This issue template is meant to REPORT BUGS/PROBLEMS ONLY
Please take a few minutes to complete the requested information below. Please take a few minutes to complete the requested information below.
Our ability to provide assistance is greatly hampered without it. The ability to provide assistance is greatly hampered without it.
DO NOT DELETE ANY TEXT from this template! Otherwise the issue will be auto-closed. DO NOT DELETE ANY TEXT from this template! Otherwise the issue will be auto-closed.
--> -->

View File

@@ -74,7 +74,7 @@ cover_mapping = {
"window": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"), "window": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"),
} }
def map_to_mdi_name(ha_type, state=None, device_class=None, cardType=None): def map_to_mdi_name(ha_type, state=None, device_class="_", cardType=None):
if ha_type == "weather": if ha_type == "weather":
return weather_mapping[state] if state in weather_mapping else "alert-circle-outline" return weather_mapping[state] if state in weather_mapping else "alert-circle-outline"
elif ha_type == "button": elif ha_type == "button":
@@ -96,6 +96,8 @@ def map_to_mdi_name(ha_type, state=None, device_class=None, cardType=None):
elif ha_type == "input_boolean": elif ha_type == "input_boolean":
return "check-circle-outline" if state == "on" else "close-circle-outline" return "check-circle-outline" if state == "on" else "close-circle-outline"
elif ha_type == "cover": elif ha_type == "cover":
if device_class is None:
device_class = "window"
if state == "closed": if state == "closed":
return cover_mapping[device_class][1] if device_class in cover_mapping else "alert-circle-outline" return cover_mapping[device_class][1] if device_class in cover_mapping else "alert-circle-outline"
else: else:
@@ -103,10 +105,10 @@ def map_to_mdi_name(ha_type, state=None, device_class=None, cardType=None):
elif ha_type == "lock": elif ha_type == "lock":
return "lock-open" if state == "unlocked" else "lock" return "lock-open" if state == "unlocked" else "lock"
elif ha_type == "sensor": elif ha_type == "sensor":
if state == "on": if state == "on" and device_class in sensor_mapping_on:
return sensor_mapping_on[device_class] if device_class in sensor_mapping_on else "alert-circle-outline" return sensor_mapping_on[device_class]
elif state == "off": elif state == "off" and device_class in sensor_mapping_off:
return sensor_mapping_off[device_class] if device_class in sensor_mapping_off else "alert-circle-outline" return sensor_mapping_off[device_class]
else: else:
return sensor_mapping[device_class] if device_class in sensor_mapping else "alert-circle-outline" return sensor_mapping[device_class] if device_class in sensor_mapping else "alert-circle-outline"
elif ha_type == "alarm-arm-fail": elif ha_type == "alarm-arm-fail":

View File

@@ -38,6 +38,8 @@ def get_translation(locale, lookupstr):
if res.startswith("error"): if res.startswith("error"):
path_frontend_file, path_backend_file = build_locale_filestring("en_US") path_frontend_file, path_backend_file = build_locale_filestring("en_US")
res = lookup(path_frontend_file, path_backend_file, lookupstr) res = lookup(path_frontend_file, path_backend_file, lookupstr)
if locale == "he_IL":
res = res[::-1]
return res return res
#print(get_translation("en_US", "frontend.state_attributes.climate.hvac_action.idle")) #print(get_translation("en_US", "frontend.state_attributes.climate.hvac_action.idle"))