thingsboard / thingsboard-python-client-sdk

ThingsBoard client Python SDK
https://thingsboard.io
Other
114 stars 70 forks source link

KeyError in _count_datapoints_in_message #66

Open DriftingShadows opened 5 months ago

DriftingShadows commented 5 months ago

We're suddenly getting errors today causing gateway to look like fine (logs continue to show incoming messages) but message never seem to reach thingsboard.

""2024-06-18 04:37:41" - |ERROR| - [tb_gateway_service.py] - tb_gateway_service - __send_rpc_reply - 1142 - 'OGCPV01001'"
Traceback (most recent call last):
  File "/thingsboard_gateway/gateway/tb_gateway_service.py", line 1133, in __send_rpc_reply
    self.tb_client.client.gw_send_rpc_reply(device, req_id, content, quality_of_service=quality_of_service)
  File "/root/.local/lib/python3.10/site-packages/tb_gateway_mqtt.py", line 258, in gw_send_rpc_reply
    info = self._send_device_request(TBSendMethod.PUBLISH, device, topic=GATEWAY_RPC_TOPIC,
  File "/root/.local/lib/python3.10/site-packages/tb_gateway_mqtt.py", line 159, in _send_device_request
    info = self._publish_data(**kwargs, device=device_name,
  File "/root/.local/lib/python3.10/site-packages/tb_device_mqtt.py", line 777, in _publish_data
    return self._send_request(TBSendMethod.PUBLISH, {"topic": topic, "payload": data, "qos": qos}, timeout,
  File "/root/.local/lib/python3.10/site-packages/tb_device_mqtt.py", line 654, in _send_request
    datapoints = self._count_datapoints_in_message(data_for_analysis, device=device)
  File "/root/.local/lib/python3.10/site-packages/tb_device_mqtt.py", line 898, in _count_datapoints_in_message
    datapoints += TBDeviceMqttClient._count_datapoints_in_message(data[device])  # noqa
KeyError: 'XXXX12345'

Any idea what may be going on?

samson0v commented 3 weeks ago

Hi @DriftingShadows, thanks for your interest in ThingsBoard Python Client SDK! Try to use the latest release version (currently 1.10.8) and let us know about the result.