mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-22 23:44:25 +01:00
added script as item
This commit is contained in:
@@ -46,7 +46,8 @@ icons = [
|
|||||||
"shield-lock",
|
"shield-lock",
|
||||||
"shield-airplane",
|
"shield-airplane",
|
||||||
"bell-ring",
|
"bell-ring",
|
||||||
"ray-vertex"
|
"ray-vertex",
|
||||||
|
"script-text"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,3 +49,4 @@ ID | MD Icon Name | Icon
|
|||||||
42 | shield-airplane | 
|
42 | shield-airplane | 
|
||||||
43 | bell-ring | 
|
43 | bell-ring | 
|
||||||
44 | ray-vertex | 
|
44 | ray-vertex | 
|
||||||
|
45 | script-text | 
|
||||||
|
|||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -178,6 +178,8 @@ class LuiController(object):
|
|||||||
self._pages_gen.render_page(self._current_page)
|
self._pages_gen.render_page(self._current_page)
|
||||||
elif entity_id.startswith('scene'):
|
elif entity_id.startswith('scene'):
|
||||||
self._ha_api.get_entity(entity_id).call_service("turn_on")
|
self._ha_api.get_entity(entity_id).call_service("turn_on")
|
||||||
|
elif entity_id.startswith('script'):
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("turn_on")
|
||||||
elif entity_id.startswith('light') or entity_id.startswith('switch') or entity_id.startswith('input_boolean'):
|
elif entity_id.startswith('light') or entity_id.startswith('switch') or entity_id.startswith('input_boolean'):
|
||||||
self._ha_api.get_entity(entity_id).call_service("toggle")
|
self._ha_api.get_entity(entity_id).call_service("toggle")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ icons = {
|
|||||||
'shield-airplane': 42,
|
'shield-airplane': 42,
|
||||||
'bell-ring': 43,
|
'bell-ring': 43,
|
||||||
'ray-vertex': 44,
|
'ray-vertex': 44,
|
||||||
|
'script-text': 45,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_icon_id(ma_name):
|
def get_icon_id(ma_name):
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ def map_to_mdi_name(ha_type, state=None, device_class=None):
|
|||||||
return "gesture-tap-button"
|
return "gesture-tap-button"
|
||||||
if ha_type == "scene":
|
if ha_type == "scene":
|
||||||
return "palette"
|
return "palette"
|
||||||
|
if ha_type == "script":
|
||||||
|
return "script-text"
|
||||||
if ha_type == "switch":
|
if ha_type == "switch":
|
||||||
return "flash"
|
return "flash"
|
||||||
if ha_type == "number":
|
if ha_type == "number":
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ translations = {
|
|||||||
'clear_code': "Maak skoon",
|
'clear_code': "Maak skoon",
|
||||||
'code': "Kode",
|
'code': "Kode",
|
||||||
'disarm': "Skakel Af",
|
'disarm': "Skakel Af",
|
||||||
|
'run': "Hardloop",
|
||||||
},
|
},
|
||||||
'ca_ES': {
|
'ca_ES': {
|
||||||
'PRESS': "Prem",
|
'PRESS': "Prem",
|
||||||
@@ -32,6 +33,7 @@ translations = {
|
|||||||
'clear_code': "Borrar",
|
'clear_code': "Borrar",
|
||||||
'code': "Codi",
|
'code': "Codi",
|
||||||
'disarm': "Desactivar",
|
'disarm': "Desactivar",
|
||||||
|
'run': "Executa",
|
||||||
},
|
},
|
||||||
'cs_CZ': {
|
'cs_CZ': {
|
||||||
'PRESS': "Stisknutí",
|
'PRESS': "Stisknutí",
|
||||||
@@ -50,6 +52,7 @@ translations = {
|
|||||||
'clear_code': "Zrušit",
|
'clear_code': "Zrušit",
|
||||||
'code': "Kód",
|
'code': "Kód",
|
||||||
'disarm': "Odbezpečit",
|
'disarm': "Odbezpečit",
|
||||||
|
'run': "Spustit",
|
||||||
},
|
},
|
||||||
'cy_GB': {
|
'cy_GB': {
|
||||||
'ACTIVATE': "Actifadu",
|
'ACTIVATE': "Actifadu",
|
||||||
@@ -75,6 +78,7 @@ translations = {
|
|||||||
'clear_code': "Ryd",
|
'clear_code': "Ryd",
|
||||||
'code': "Kode",
|
'code': "Kode",
|
||||||
'disarm': "Frakobl",
|
'disarm': "Frakobl",
|
||||||
|
'run': "Kør",
|
||||||
},
|
},
|
||||||
'de_DE': {
|
'de_DE': {
|
||||||
'PRESS': "Drücken",
|
'PRESS': "Drücken",
|
||||||
@@ -93,6 +97,7 @@ translations = {
|
|||||||
'clear_code': "Löschen",
|
'clear_code': "Löschen",
|
||||||
'code': "Code",
|
'code': "Code",
|
||||||
'disarm': "Deaktivieren",
|
'disarm': "Deaktivieren",
|
||||||
|
'run': "Ausführen",
|
||||||
},
|
},
|
||||||
'en_US': {
|
'en_US': {
|
||||||
'PRESS': "Press",
|
'PRESS': "Press",
|
||||||
@@ -111,6 +116,7 @@ translations = {
|
|||||||
'clear_code': "Clear",
|
'clear_code': "Clear",
|
||||||
'code': "Code",
|
'code': "Code",
|
||||||
'disarm': "Disarm",
|
'disarm': "Disarm",
|
||||||
|
'run': "Run",
|
||||||
},
|
},
|
||||||
'es_ES': {
|
'es_ES': {
|
||||||
'PRESS': "Pulsa",
|
'PRESS': "Pulsa",
|
||||||
@@ -129,6 +135,7 @@ translations = {
|
|||||||
'clear_code': "Limpiar",
|
'clear_code': "Limpiar",
|
||||||
'code': "Código",
|
'code': "Código",
|
||||||
'disarm': "Desarmar",
|
'disarm': "Desarmar",
|
||||||
|
'run': "Ejecutar",
|
||||||
},
|
},
|
||||||
'et_EE': {
|
'et_EE': {
|
||||||
'PRESS': "Vajuta nuppu",
|
'PRESS': "Vajuta nuppu",
|
||||||
@@ -147,6 +154,7 @@ translations = {
|
|||||||
'clear_code': "Puhasta",
|
'clear_code': "Puhasta",
|
||||||
'code': "Kood",
|
'code': "Kood",
|
||||||
'disarm': "Valvest maha",
|
'disarm': "Valvest maha",
|
||||||
|
'run': "Käivita",
|
||||||
},
|
},
|
||||||
'eu_ES': {
|
'eu_ES': {
|
||||||
'ACTIVATE': "Aktibatu",
|
'ACTIVATE': "Aktibatu",
|
||||||
@@ -171,6 +179,7 @@ translations = {
|
|||||||
'clear_code': "Tyhjennä",
|
'clear_code': "Tyhjennä",
|
||||||
'code': "Koodi",
|
'code': "Koodi",
|
||||||
'disarm': "Poista hälytys",
|
'disarm': "Poista hälytys",
|
||||||
|
'run': "Suorita",
|
||||||
},
|
},
|
||||||
'fr_FR': {
|
'fr_FR': {
|
||||||
'PRESS': "Appui",
|
'PRESS': "Appui",
|
||||||
@@ -189,12 +198,14 @@ translations = {
|
|||||||
'clear_code': "Effacer",
|
'clear_code': "Effacer",
|
||||||
'code': "Code",
|
'code': "Code",
|
||||||
'disarm': "Désarmer",
|
'disarm': "Désarmer",
|
||||||
|
'run': "Exécuter",
|
||||||
},
|
},
|
||||||
'fy_DE': {
|
'fy_DE': {
|
||||||
'off': "Út",
|
'off': "Út",
|
||||||
},
|
},
|
||||||
'gl_ES': {
|
'gl_ES': {
|
||||||
'off': "Apagado",
|
'off': "Apagado",
|
||||||
|
'run': "Executar",
|
||||||
},
|
},
|
||||||
'hr_HR': {
|
'hr_HR': {
|
||||||
'ACTIVATE': "Aktivirati",
|
'ACTIVATE': "Aktivirati",
|
||||||
@@ -211,6 +222,7 @@ translations = {
|
|||||||
'clear_code': "Vedro",
|
'clear_code': "Vedro",
|
||||||
'code': "Kod",
|
'code': "Kod",
|
||||||
'disarm': "Deaktiviraj",
|
'disarm': "Deaktiviraj",
|
||||||
|
'run': "Pokreni",
|
||||||
},
|
},
|
||||||
'id_ID': {
|
'id_ID': {
|
||||||
'PRESS': "Tekan",
|
'PRESS': "Tekan",
|
||||||
@@ -229,6 +241,7 @@ translations = {
|
|||||||
'clear_code': "Hapus",
|
'clear_code': "Hapus",
|
||||||
'code': "Kode",
|
'code': "Kode",
|
||||||
'disarm': "Nonaktifkan",
|
'disarm': "Nonaktifkan",
|
||||||
|
'run': "Jalankan",
|
||||||
},
|
},
|
||||||
'is_IS': {
|
'is_IS': {
|
||||||
'PRESS': "Ýttu á",
|
'PRESS': "Ýttu á",
|
||||||
@@ -246,6 +259,7 @@ translations = {
|
|||||||
'clear_code': "Hreinsa",
|
'clear_code': "Hreinsa",
|
||||||
'code': "Kóði",
|
'code': "Kóði",
|
||||||
'disarm': "Taka af verði",
|
'disarm': "Taka af verði",
|
||||||
|
'run': "Keyra",
|
||||||
},
|
},
|
||||||
'it_IT': {
|
'it_IT': {
|
||||||
'PRESS': "Premi",
|
'PRESS': "Premi",
|
||||||
@@ -264,6 +278,7 @@ translations = {
|
|||||||
'clear_code': "Canc",
|
'clear_code': "Canc",
|
||||||
'code': "Codice",
|
'code': "Codice",
|
||||||
'disarm': "Disattiva",
|
'disarm': "Disattiva",
|
||||||
|
'run': "Esegui",
|
||||||
},
|
},
|
||||||
'nl_NL': {
|
'nl_NL': {
|
||||||
'PRESS': "Klik",
|
'PRESS': "Klik",
|
||||||
@@ -282,6 +297,7 @@ translations = {
|
|||||||
'clear_code': "Wis",
|
'clear_code': "Wis",
|
||||||
'code': "Code",
|
'code': "Code",
|
||||||
'disarm': "Uitschakelen",
|
'disarm': "Uitschakelen",
|
||||||
|
'run': "Uitvoeren",
|
||||||
},
|
},
|
||||||
'nn_NO': {
|
'nn_NO': {
|
||||||
'ACTIVATE': "Aktiver",
|
'ACTIVATE': "Aktiver",
|
||||||
@@ -299,6 +315,7 @@ translations = {
|
|||||||
'clear_code': "Slett alt",
|
'clear_code': "Slett alt",
|
||||||
'code': "Kode",
|
'code': "Kode",
|
||||||
'disarm': "Skru av",
|
'disarm': "Skru av",
|
||||||
|
'run': "Køyr",
|
||||||
},
|
},
|
||||||
'pt_PT': {
|
'pt_PT': {
|
||||||
'PRESS': "Pressione",
|
'PRESS': "Pressione",
|
||||||
@@ -316,6 +333,7 @@ translations = {
|
|||||||
'clear_code': "Apagar",
|
'clear_code': "Apagar",
|
||||||
'code': "Código",
|
'code': "Código",
|
||||||
'disarm': "Desarmar",
|
'disarm': "Desarmar",
|
||||||
|
'run': "Executar",
|
||||||
},
|
},
|
||||||
'sr_RS': {
|
'sr_RS': {
|
||||||
'PRESS': "Pritisnite taster",
|
'PRESS': "Pritisnite taster",
|
||||||
@@ -339,6 +357,7 @@ translations = {
|
|||||||
'clear_code': "Rensa",
|
'clear_code': "Rensa",
|
||||||
'code': "Kod",
|
'code': "Kod",
|
||||||
'disarm': "Larma från",
|
'disarm': "Larma från",
|
||||||
|
'run': "Kör",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,10 @@ class LuiPagesGen(object):
|
|||||||
icon_id = get_icon_id_ha("scene", overwrite=icon)
|
icon_id = get_icon_id_ha("scene", overwrite=icon)
|
||||||
text = get_translation(self._locale,"ACTIVATE")
|
text = get_translation(self._locale,"ACTIVATE")
|
||||||
return f",button,{item},{icon_id},17299,{name},{text}"
|
return f",button,{item},{icon_id},17299,{name},{text}"
|
||||||
|
if item_type == "script":
|
||||||
|
icon_id = get_icon_id_ha("script", overwrite=icon)
|
||||||
|
text = get_translation(self._locale,"run")
|
||||||
|
return f",button,{item},{icon_id},17299,{name},{text}"
|
||||||
if item_type == "number":
|
if item_type == "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