Added more event types
This commit is contained in:
parent
04c71061da
commit
337c701835
10
meshmqtt.py
10
meshmqtt.py
@ -65,6 +65,12 @@ def decode_encrypted(message_packet):
|
|||||||
logging.info('Received text message:')
|
logging.info('Received text message:')
|
||||||
logging.info(text)
|
logging.info(text)
|
||||||
|
|
||||||
|
elif message_packet.decoded.portnum == portnums_pb2.MAP_REPORT_APP:
|
||||||
|
pos = mesh_pb2.Position()
|
||||||
|
pos.ParseFromString(message_packet.decoded.payload)
|
||||||
|
logging.info('Received map report:')
|
||||||
|
logging.info(pos)
|
||||||
|
|
||||||
elif message_packet.decoded.portnum == portnums_pb2.NODEINFO_APP:
|
elif message_packet.decoded.portnum == portnums_pb2.NODEINFO_APP:
|
||||||
info = mesh_pb2.User()
|
info = mesh_pb2.User()
|
||||||
info.ParseFromString(message_packet.decoded.payload)
|
info.ParseFromString(message_packet.decoded.payload)
|
||||||
@ -117,7 +123,7 @@ def on_message(client, userdata, msg):
|
|||||||
service_envelope = mqtt_pb2.ServiceEnvelope()
|
service_envelope = mqtt_pb2.ServiceEnvelope()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Parse the message payload
|
# Parse the message payload
|
||||||
service_envelope.ParseFromString(msg.payload)
|
service_envelope.ParseFromString(msg.payload)
|
||||||
|
|
||||||
logging.info('Received a packet:')
|
logging.info('Received a packet:')
|
||||||
@ -126,7 +132,7 @@ def on_message(client, userdata, msg):
|
|||||||
# Extract the message packet from the service envelope
|
# Extract the message packet from the service envelope
|
||||||
message_packet = service_envelope.packet
|
message_packet = service_envelope.packet
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
#logging.error(f'Failed to parse message: {str(e)}')
|
#logging.error(f'Failed to parse message: {str(e)}')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user