Fixed issue when exporter tried to parse messages from the stat folder in MQTT
This commit is contained in:
parent
d94cbe26ca
commit
67bb990190
6
main.py
6
main.py
|
@ -21,6 +21,12 @@ def handle_connect(client, userdata, flags, reason_code, properties):
|
||||||
def handle_message(client, userdata, message):
|
def handle_message(client, userdata, message):
|
||||||
current_timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
current_timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
print(f"Received message on topic '{message.topic}' at {current_timestamp}")
|
print(f"Received message on topic '{message.topic}' at {current_timestamp}")
|
||||||
|
|
||||||
|
# Filter out messages from the 'stat' topic
|
||||||
|
if '/stat/' in message.topic:
|
||||||
|
print(f"Filtered out message from topic containing '/stat/': {message.topic}")
|
||||||
|
return
|
||||||
|
|
||||||
envelope = ServiceEnvelope()
|
envelope = ServiceEnvelope()
|
||||||
envelope.ParseFromString(message.payload)
|
envelope.ParseFromString(message.payload)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue