mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-19 12:44:44 +01:00
add lock to pages.py
This commit is contained in:
@@ -769,7 +769,7 @@ translations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_translation(locale, input):
|
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:
|
if locale in translations:
|
||||||
return translations.get(locale).get(input, en_fallback_res)
|
return translations.get(locale).get(input, en_fallback_res)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ class LuiPagesGen(object):
|
|||||||
icon_id = get_icon_id_ha("script", overwrite=icon)
|
icon_id = get_icon_id_ha("script", overwrite=icon)
|
||||||
text = get_translation(self._locale,"run")
|
text = get_translation(self._locale,"run")
|
||||||
return f"~button~{entityId}~{icon_id}~17299~{name}~{text}"
|
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":
|
if entityType == "number":
|
||||||
icon_id = get_icon_id_ha("number", overwrite=icon)
|
icon_id = get_icon_id_ha("number", overwrite=icon)
|
||||||
min_v = entity.attributes.get("min", 0)
|
min_v = entity.attributes.get("min", 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user