Skip to content

Commit a097161

Browse files
committed
Add a sendMqttClientProxyMessage helper for client proxy implementation
1 parent e675050 commit a097161

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

meshtastic/mesh_interface.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Mesh Interface class
22
"""
3-
# pylint: disable=R0917
3+
# pylint: disable=R0917,C0302
44

55
import collections
66
import json
@@ -477,6 +477,18 @@ def sendAlert(
477477
priority=mesh_pb2.MeshPacket.Priority.ALERT
478478
)
479479

480+
def sendMqttClientProxyMessage(self, topic: str, data: bytes):
481+
"""Send an MQTT Client Proxy message to the radio.
482+
483+
Topic and data should be the MQTT topic and the message
484+
payload from an MQTT broker, respectively."""
485+
prox = mesh_pb2.MqttClientProxyMessage()
486+
prox.topic = topic
487+
prox.data = data
488+
toRadio = mesh_pb2.ToRadio()
489+
toRadio.mqttClientProxyMessage.CopyFrom(prox)
490+
self._sendToRadio(toRadio)
491+
480492
def sendData(
481493
self,
482494
data,

0 commit comments

Comments
 (0)