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:
kayvenm
2023-01-03 08:14:06 -05:00
committed by GitHub
parent 801c17ca47
commit 0cd3045340
3 changed files with 24 additions and 22 deletions

View File

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