add config option for btn on cardalarm

This commit is contained in:
Johannes
2022-06-02 21:14:12 +02:00
parent 70af6edcb7
commit b514860389
2 changed files with 9 additions and 3 deletions

View File

@@ -448,6 +448,7 @@ key | optional | type | default | description
`entity` | False | string | `None` | contains the entity of the current card, valid for cardThermo, cardAlarm and cardMedia
`key` | True | string | `None` | Used by navigate items
`mediaControl` | True | string | `None` | Only valid on cardMedia, contains the action executed on pressing the top left media icon. (useful to navigate to a hidden card or start a script)
`alarmControl` | True | string | `None` | Only valid on cardAlarm, contains the action executed on pressing the left bottom icon, by default this button is used to show a list of open sensors on a failed attempt to arm.
#### Possible configuration values for entities key

View File

@@ -369,7 +369,7 @@ class LuiPagesGen(object):
command = f"entityUpd~{heading}~{navigation}~{item}~{icon}~{title}~{author}~{volume}~{iconplaypause}~{source}~{speakerlist[:200]}~{onoffbutton}~{mediaBtn}"
self._send_mqtt_msg(command)
def generate_alarm_page(self, navigation, entity):
def generate_alarm_page(self, navigation, entity, alarmBtn):
item = entity.entityId
if not self._ha_api.entity_exists(item):
command = f"entityUpd~{item}~{navigation}~Not found~Not found~Check your~Check your~apps.~apps.~yaml~yaml~0~~0"
@@ -423,6 +423,10 @@ class LuiPagesGen(object):
add_btn = ""
if "open_sensors" in entity.attributes and entity.attributes.open_sensors is not None:
add_btn=f"{get_icon_id('progress-alert')}~{rgb_dec565([243,179,0])}~opnSensorNotify"
if alarmBtn is not None and type(alarmBtn) is dict:
entity = alarmBtn.get("entity")
icon = alarmBtn.get("icon", "progress-alert")
add_btn=f"{get_icon_id(icon)}~{rgb_dec565([243,179,0])}~{entity}"
# add padding to arm buttons
arm_buttons = ""
@@ -467,7 +471,8 @@ class LuiPagesGen(object):
mediaBtn = card.raw_config.get("mediaControl", "")
self.generate_media_page(navigation, card.title, card.entity, mediaBtn)
if card.cardType == "cardAlarm":
self.generate_alarm_page(navigation, card.entity)
alarmBtn = card.raw_config.get("alarmControl")
self.generate_alarm_page(navigation, card.entity, alarmBtn)
if card.cardType == "screensaver":
theme = card.raw_config.get("theme")
self.update_screensaver_weather(theme)