mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-19 12:44:44 +01:00
implement #242
This commit is contained in:
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -283,3 +283,12 @@ class LuiController(object):
|
|||||||
# for alarm page
|
# for alarm page
|
||||||
if button_type in ["disarm", "arm_home", "arm_away", "arm_night", "arm_vacation"]:
|
if button_type in ["disarm", "arm_home", "arm_away", "arm_night", "arm_vacation"]:
|
||||||
self._ha_api.get_entity(entity_id).call_service(f"alarm_{button_type}", code=value)
|
self._ha_api.get_entity(entity_id).call_service(f"alarm_{button_type}", code=value)
|
||||||
|
if button_type == "opnSensorNotify":
|
||||||
|
msg = ""
|
||||||
|
entity = self._ha_api.get_entity(entity_id)
|
||||||
|
if "open_sensors" in entity.attributes and entity.attributes.open_sensors is not None:
|
||||||
|
for e in entity:
|
||||||
|
msg += f"- {self._ha_api.get_entity(e).attributes.friendly_name}\n"
|
||||||
|
|
||||||
|
self._pages_gen.send_message_page("opnSensorNotifyRes", "", msg, "", ""):
|
||||||
|
|
||||||
|
|||||||
@@ -413,13 +413,18 @@ class LuiPagesGen(object):
|
|||||||
icon = get_icon_id("bell-ring")
|
icon = get_icon_id("bell-ring")
|
||||||
flashing = "enable"
|
flashing = "enable"
|
||||||
|
|
||||||
|
#add button to show sensor state
|
||||||
|
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"
|
||||||
|
|
||||||
# add padding to arm buttons
|
# add padding to arm buttons
|
||||||
arm_buttons = ""
|
arm_buttons = ""
|
||||||
for b in supported_modes:
|
for b in supported_modes:
|
||||||
arm_buttons += f"~{get_translation(self._locale, b)}~{b}"
|
arm_buttons += f"~{get_translation(self._locale, b)}~{b}"
|
||||||
if len(supported_modes) < 4:
|
if len(supported_modes) < 4:
|
||||||
arm_buttons += "~"*((4-len(supported_modes))*2)
|
arm_buttons += "~"*((4-len(supported_modes))*2)
|
||||||
command = f"entityUpd~{item}~{navigation}{arm_buttons}~{icon}~{color}~{numpad}~{flashing}"
|
command = f"entityUpd~{item}~{navigation}{arm_buttons}~{icon}~{color}~{numpad}~{flashing}~{add_btn}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
|
|
||||||
@@ -529,6 +534,6 @@ class LuiPagesGen(object):
|
|||||||
pos_translation = get_translation(self._locale, "position")
|
pos_translation = get_translation(self._locale, "position")
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{pos}~{pos_translation}: {pos_status}~{pos_translation}~{icon_id}~{icon_up}~{icon_stop}~{icon_down}~{icon_up_status}~{icon_stop_status}~{icon_down_status}")
|
self._send_mqtt_msg(f"entityUpdateDetail~{pos}~{pos_translation}: {pos_status}~{pos_translation}~{icon_id}~{icon_up}~{icon_stop}~{icon_down}~{icon_up_status}~{icon_stop_status}~{icon_down_status}")
|
||||||
|
|
||||||
def send_message_page(self, id, heading, msg, b1, b2):
|
def send_message_page(self, ident, heading, msg, b1, b2):
|
||||||
self._send_mqtt_msg(f"pageType~popupNotify")
|
self._send_mqtt_msg(f"pageType~popupNotify")
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{id}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")
|
self._send_mqtt_msg(f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")
|
||||||
|
|||||||
Reference in New Issue
Block a user