fix for exception, when sending mqtt messages without topic
This commit is contained in:
parent
12044492cd
commit
7008ec077b
@ -130,7 +130,10 @@ class MqttSniffer(App):
|
|||||||
"""Event handler called when a button is pressed."""
|
"""Event handler called when a button is pressed."""
|
||||||
if event.button.id == "send_button":
|
if event.button.id == "send_button":
|
||||||
if self.mqtt is not None:
|
if self.mqtt is not None:
|
||||||
|
if len(self.send_topic) > 0:
|
||||||
self.mqtt.send(self.send_topic, self.send_payload)
|
self.mqtt.send(self.send_topic, self.send_payload)
|
||||||
|
else:
|
||||||
|
logger.warning("Can't send mqtt message with empty topic. topic=%s; payload=%s", repr(self.send_topic), repr(self.send_payload))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user