I’m trying to send a downlink command via gRPC and Python to an existing device.
It works to a point, but I tried to send a JSON, which then should get processed via the payload formatter.
The problem is that if I send the JSON as an utf-8 encoded string, it does not get passed through the payload format but gets enqueued directly to the device.
I tried to assign the req.queue_item.object, but it gives me an error (“AttributeError: Assignment not allowed to message, map, or repeated field “object” in the protocol message object.”).
Is there a way to send a downlink to chirpstack with a JSON so that the payload formatter can encode it for the device?
def send_downlink(self, message, fport: int): req = api.EnqueueDeviceQueueItemRequest() req.queue_item.dev_eui = str(self.device.internal_id) req.queue_item.confirmed = False req.queue_item.f_port = fport req.queue_item.data = message try: self.client.Enqueue(req, metadata=self.auth_token()) return True except grpc.RpcError as e: logger.error(e) return False