Add handling of clientNotification on FromRadio, sending a pubsub message

This commit is contained in:
Ian McEwen
2025-02-20 12:36:21 -07:00
parent e2c9c1315e
commit 46a8db286c
2 changed files with 10 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ type of packet, you should subscribe to the full topic name. If you want to see
- `meshtastic.receive.data.portnum(packet)` (where portnum is an integer or well known PortNum enum)
- `meshtastic.node.updated(node = NodeInfo)` - published when a node in the DB changes (appears, location changed, username changed, etc...)
- `meshtastic.log.line(line)` - a raw unparsed log line from the radio
- `meshtastic.clientNotification(notification, interface) - a ClientNotification sent from the radio
We receive position, user, or data packets from the mesh. You probably only care about `meshtastic.receive.data`. The first argument for
that publish will be the packet. Text or binary data packets (from `sendData` or `sendText`) will both arrive this way. If you print packet

View File

@@ -1,6 +1,6 @@
"""Mesh Interface class
"""
# pylint: disable=R0917
# pylint: disable=R0917,C0302
import collections
import json
@@ -1311,6 +1311,14 @@ class MeshInterface: # pylint: disable=R0902
self._handleLogRecord(fromRadio.log_record)
elif fromRadio.HasField("queueStatus"):
self._handleQueueStatusFromRadio(fromRadio.queueStatus)
elif fromRadio.HasField("clientNotification"):
publishingThread.queueWork(
lambda: pub.sendMessage(
"meshtastic.clientNotification",
notification=fromRadio.clientNotification,
interface=self,
)
)
elif fromRadio.HasField("mqttClientProxyMessage"):
publishingThread.queueWork(