added some more alarm states #81

This commit is contained in:
Johannes
2022-03-28 16:35:13 +02:00
parent 0e6ec05056
commit 1bf01b28a3
4 changed files with 14 additions and 5 deletions

View File

@@ -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")

View File

@@ -46,3 +46,4 @@ ID | MD Icon Name | Icon
39 | shield-off | ![shield-off](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/shield-off.svg)
40 | shield | ![shield](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/shield.svg)
41 | shield-lock | ![shield-lock](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/shield-lock.svg)
42 | shield-airplane | ![shield-airplane](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/shield-airplane.svg)

View File

@@ -41,6 +41,7 @@ icons = {
'shield-off': 39,
'shield': 40,
'shield-lock': 41,
'shield-airplane': 42,
}
def get_icon_id(ma_name):

View File

@@ -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 = ""