mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 23:14:25 +01:00
added some more alarm states #81
This commit is contained in:
@@ -43,7 +43,8 @@ icons = [
|
||||
"window-closed",
|
||||
"shield-off",
|
||||
"shield",
|
||||
"shield-lock"
|
||||
"shield-lock",
|
||||
"shield-airplane"
|
||||
]
|
||||
|
||||
|
||||
@@ -69,7 +70,7 @@ for icon_name in icons:
|
||||
icon_name_list.append(icon_name)
|
||||
|
||||
# write mapping lib for python
|
||||
with open(os.path.join(__location__, "../../../apps/nspanel-lovelace-ui", "icon_mapping.py"), 'w') as f:
|
||||
with open(os.path.join(__location__, "../../../apps/nspanel-lovelace-ui/luibackend", "icon_mapping.py"), 'w') as f:
|
||||
f.write("icons = {\n")
|
||||
for idx, val in enumerate(icon_name_list):
|
||||
f.write(f" '{val}': {idx},\n")
|
||||
|
||||
@@ -46,3 +46,4 @@ ID | MD Icon Name | Icon
|
||||
39 | shield-off | 
|
||||
40 | shield | 
|
||||
41 | shield-lock | 
|
||||
42 | shield-airplane | 
|
||||
|
||||
@@ -41,6 +41,7 @@ icons = {
|
||||
'shield-off': 39,
|
||||
'shield': 40,
|
||||
'shield-lock': 41,
|
||||
'shield-airplane': 42,
|
||||
}
|
||||
|
||||
def get_icon_id(ma_name):
|
||||
|
||||
@@ -275,18 +275,24 @@ class LuiPagesGen(object):
|
||||
supported_modes.append("ARM NIGHT")
|
||||
if bits & 0b100000:
|
||||
supported_modes.append("ARM VACATION")
|
||||
else:
|
||||
supported_modes.append("DISARM")
|
||||
|
||||
if entity.state == "armed_home":
|
||||
color = rgb_dec565([223,76,30])
|
||||
icon = get_icon_id("shield-home")
|
||||
supported_modes.append("DISARM")
|
||||
if entity.state == "arming":
|
||||
color = rgb_dec565([243,179,0])
|
||||
icon = get_icon_id("shield")
|
||||
supported_modes.append("DISARM")
|
||||
if entity.state == "armed_away":
|
||||
color = rgb_dec565([223,76,30])
|
||||
icon = get_icon_id("shield-lock")
|
||||
supported_modes.append("DISARM")
|
||||
if entity.state == "armed_night":
|
||||
color = rgb_dec565([223,76,30])
|
||||
icon = get_icon_id("weather-night")
|
||||
if entity.state == "armed_vacation":
|
||||
color = rgb_dec565([223,76,30])
|
||||
icon = get_icon_id("shield-airplane")
|
||||
|
||||
# add padding to arm buttons
|
||||
arm_buttons = ""
|
||||
|
||||
Reference in New Issue
Block a user