mirror of
https://github.com/OMGeeky/homecontrol.esp-sensors.git
synced 2025-12-26 17:02:29 +01:00
remove simulation mode checks from MQTT packet handling and message checking
This commit is contained in:
@@ -124,10 +124,6 @@ class MQTTClient:
|
|||||||
|
|
||||||
def _send_packet(self, packet_type, payload=b''):
|
def _send_packet(self, packet_type, payload=b''):
|
||||||
"""Send an MQTT packet to the broker"""
|
"""Send an MQTT packet to the broker"""
|
||||||
if SIMULATION:
|
|
||||||
print(f"[MQTT SIM] Sending packet type: {packet_type:02x}, payload: {payload}")
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.sock is None:
|
if self.sock is None:
|
||||||
raise MQTTException("Not connected to broker (_send_packet)")
|
raise MQTTException("Not connected to broker (_send_packet)")
|
||||||
|
|
||||||
@@ -270,8 +266,6 @@ class MQTTClient:
|
|||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
"""Send PINGREQ to keep the connection alive"""
|
"""Send PINGREQ to keep the connection alive"""
|
||||||
if SIMULATION:
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.connected:
|
if self.connected:
|
||||||
self._send_packet(PINGREQ)
|
self._send_packet(PINGREQ)
|
||||||
@@ -378,13 +372,6 @@ class MQTTClient:
|
|||||||
|
|
||||||
def check_msg(self):
|
def check_msg(self):
|
||||||
"""Check for pending messages from the broker"""
|
"""Check for pending messages from the broker"""
|
||||||
if SIMULATION:
|
|
||||||
# In simulation mode, we simulate message checking
|
|
||||||
if self.last_message and self.callback:
|
|
||||||
self.callback(self.last_topic, self.last_message)
|
|
||||||
self.last_message = None
|
|
||||||
self.last_topic = None
|
|
||||||
return
|
|
||||||
|
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user