add lock to pages.py

This commit is contained in:
joBr99
2022-05-06 09:03:40 +02:00
parent cc1a1261d4
commit bd913bd7b2
2 changed files with 5 additions and 1 deletions

View File

@@ -769,7 +769,7 @@ translations = {
}
def get_translation(locale, input):
en_fallback_res = translations.get("en_US").get(input, input)
en_fallback_res = translations.get("en").get(input, input)
if locale in translations:
return translations.get(locale).get(input, en_fallback_res)
else:

View File

@@ -171,6 +171,10 @@ class LuiPagesGen(object):
icon_id = get_icon_id_ha("script", overwrite=icon)
text = get_translation(self._locale,"run")
return f"~button~{entityId}~{icon_id}~17299~{name}~{text}"
if entityType == "lock":
icon_id = get_icon_id_ha("lock", state=entity.state, overwrite=icon)
text = get_translation(self._locale,"lock") if entity.state == "unlocked" else get_translation(self._locale,"lock")
return f"~button~{entityId}~{icon_id}~17299~{name}~{text}"
if entityType == "number":
icon_id = get_icon_id_ha("number", overwrite=icon)
min_v = entity.attributes.get("min", 0)