thingsboard / thingsboard/thingsboard-python-client-sdk
Telemetry upload bug if telemetry list is not ordered by timestamp or if elements of list have different number of key/value pairs
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 130
- Forks
- 86
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I'm using tb-mqtt-client version 1.10.10
I have a use-case where I'm uploading a list of telemetry readings. Depending on the order of the list, sometimes not all telemetry is being uploaded and sometimes the timestamp with which it is being uploaded is incorrect...
I first though that the list needed to be sorted by the timestamp attribute but then I had cases where even if it was sorted by timestamp it would work fine. It seems to be a combination of the list not being sorted with each element of the list not having the same number of key/value pairs.
I can't figure out or understand this behavior so any help would be appreciated.
This is the code snippet I'm using for testing this problem:
from tb_device_mqtt import TBPublishInfo
from tb_gateway_mqtt import TBGatewayMqttClient
telemetry =[...]
client = TBGatewayMqttClient("my.url.com", port=1883, username="token")
client.connect()
result = client.gw_send_telemetry('test device', telemetry)
success = result.get() == TBPublishInfo.TB_ERR_SUCCESS
client.disconnect()
print(success)
Following are some examples of the problem where the only thing I'm changing is the order of the telemetry list:
Example 1 - works fine
telemetry =[
{
'ts': 1736330010000,
'values': {
'test_1': 1,
'test_1_1': 1,
}
},
{
'ts': 1736330030000,
'values': {
'test_3': 3,
'test_3_1': 3,
}
},
{
'ts': 1736330020000,
'values': {
'test_2': 2,
'test_2_1': 2
}
},
]
Example 2 - does not upload test_2 and test_2_1 telemetry
telemetry =[
{
'ts': 1736330010000,
'values': {
'test_1': 1,
'test_1_1': 1
}
},
{
'ts': 1736330020000,
'values': {
'test_2': 2,
'test_2_1': 2
}
},
{
'ts': 1736330030000,
'values': {
'test_3': 3
}
},
]
Example 3 - test_1 and test_1_1 are being uploaded with the wrong timestamp. They are being uploaded with the same timestamp as test_3
telemetry =[
{
'ts': 1736330010000,
'values': {
'test_1': 1,
'test_1_1': 1,
}
},
{
'ts': 1736330030000,
'values': {
'test_3': 3,
}
},
{
'ts': 1736330020000,
'values': {
'test_2': 2,
'test_2_1': 2
}
},
]
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza reproduciendo los tres ejemplos de telemetría mediante TBGatewayMqttClient.gw_send_telemetry y compara los resultados subidos. Sigue la ruta de subida de la telemetría para identificar cómo afectan el orden de las listas y las distintas longitudes de los valores a las marcas de tiempo y las entradas; se considera terminado cuando cada valor se sube con su marca de tiempo correspondiente, independientemente del orden o la forma de entrada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100