mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-27 08:02:14 +01:00
Fix for empty detail page after change on previous page (#662)
* Update mqtt.py Allow force sending duplicate messages * Update pages.py Allow forcing sending MQTT message when the detail page is initially generated * Update controller.py Set is_open_detail to True when generate_xx_detail_page is called from detail_open
This commit is contained in:
@@ -64,11 +64,12 @@ class LuiMqttSender(object):
|
||||
self._topic_send = topic_send
|
||||
self._prev_msg = ""
|
||||
|
||||
def send_mqtt_msg(self, msg, topic=None):
|
||||
if self._prev_msg == msg:
|
||||
def send_mqtt_msg(self, msg, topic=None, force=False):
|
||||
if not force and self._prev_msg == msg:
|
||||
self._ha_api.log(f"Dropping identical consecutive message: {msg}")
|
||||
return
|
||||
self._prev_msg = msg
|
||||
if topic is None:
|
||||
topic = self._topic_send
|
||||
self._ha_api.log(f"Sending MQTT Message: {msg}")
|
||||
apis.mqtt_api.mqtt_publish(topic, msg)
|
||||
apis.mqtt_api.mqtt_publish(topic, msg)
|
||||
|
||||
Reference in New Issue
Block a user