Compare commits

...

7 Commits

Author SHA1 Message Date
Odianosen Ejale
7e5dc837f7 Merge 7f621c935d into 64ff369a90 2024-02-18 23:57:51 +00:00
Odianosen25
7f621c935d Access other cards from apps 2024-02-18 23:54:40 +00:00
Odianosen25
0af6d354c8 Allow other apps to have access to current app 2024-02-18 23:52:58 +00:00
Odianosen25
fe3b23fc76 fix little conflict 2024-02-18 23:27:26 +00:00
Odianosen25
9f26d4cd2e Added ability to keep messages sent queit 2024-02-18 23:25:44 +00:00
Odianosen25
8059f65b11 Added the ability to keep the messages being sent quiet 2024-02-18 23:21:04 +00:00
Odianosen25
b22e055c18 Turn app into AD Base app 2024-02-18 23:13:46 +00:00
4 changed files with 22 additions and 5 deletions

View File

@@ -132,6 +132,7 @@ class LuiBackendConfig(object):
'sleepTrackingZones': ["not_home", "off"],
'sleepOverride': None,
'locale': "en_US",
'quiet': True,
'timeFormat': "%H:%M",
'dateFormatBabel': "full",
'dateAdditionalTemplate': "",

View File

@@ -458,3 +458,9 @@ class LuiController(object):
apis.ha_api.get_entity(entity_id).call_service("pause")
if button_type == "timer-finish":
apis.ha_api.get_entity(entity_id).call_service("finish")
@property
def current_card(self) -> str:
"""Used to get the current card"""
return self._current_card

View File

@@ -77,12 +77,13 @@ class LuiMqttListener(object):
self._controller.detail_open(msg[2], msg[3])
class LuiMqttSender(object):
def __init__(self, api, use_api, topic_send, api_panel_name):
def __init__(self, api, use_api, topic_send, api_panel_name, quiet):
self._ha_api = api
self._use_api = use_api
self._topic_send = topic_send
self._api_panel_name = api_panel_name
self._prev_msg = ""
self._quiet = quiet
def send_mqtt_msg(self, msg, topic=None, force=False):
if not force and self._prev_msg == msg:
@@ -90,7 +91,9 @@ class LuiMqttSender(object):
return
self._prev_msg = msg
apis.ha_api.log(f"Sending Message: {msg}")
if self._quiet is False:
apis.ha_api.log(f"Sending Message: {msg}")
if self._use_api:
apis.ha_api.call_service(service="esphome/" + self._api_panel_name + "_nspanelui_api_call", command=2, data=msg)
else:

View File

@@ -24,10 +24,11 @@ class NsPanelLovelaceUIManager(ad.ADBase):
topic_recv = cfg.get("panelRecvTopic")
api_panel_name = cfg.get("panelName")
api_device_id = cfg.get("panelDeviceId")
quiet = cfg.get("quiet")
mqttsend = LuiMqttSender(apis.ha_api, use_api, topic_send, api_panel_name)
mqttsend = LuiMqttSender(apis.ha_api, use_api, topic_send, api_panel_name, quiet)
controller = LuiController(cfg, mqttsend.send_mqtt_msg)
self._controller = LuiController(cfg, mqttsend.send_mqtt_msg)
desired_tasmota_driver_version = 8
desired_display_firmware_version = 53
@@ -48,6 +49,12 @@ class NsPanelLovelaceUIManager(ad.ADBase):
# Request Tasmota Driver Version
updater.request_berry_driver_version()
LuiMqttListener(use_api, topic_recv, api_panel_name, api_device_id, controller, updater)
LuiMqttListener(use_api, topic_recv, api_panel_name, api_device_id, self._controller, updater)
self.adapi.log(f'Started ({version})')
@property
def current_card(self) -> str:
"""Used to get the panel's current card"""
return self._controller.current_card.key