Skip to content

Conversation

@Andry925
Copy link
Member

  1. Fixed the custom mqtt convertor by adding timestamp to telemetries and adapt it for default mqtt config.

@Andry925 Andry925 changed the title Adapted the custom mqtt convertor example for default mqtt config. Adapted the custom mqtt convertor for default mqtt config Oct 30, 2025
TelemetryEntry({datapoint_key: value}) # creating telemetry entry
converted_data.add_to_telemetry(datapoint_key) # adding telemetry entry to telemetry array for sending data to platform
for _ in range(self.__config[extension_config_key][telemetry_key]):
try:# reading every value with value length from config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this comment below and follow PEP8!

for _ in range(self.__config[extension_config_key][telemetry_key]):
try:# reading every value with value length from config
value = converted_bytes.pop(0)
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this e variable here? Do we use this variable next?

continue
# process and remove byte from processing
datapoint_key = TBUtility.convert_key_to_datapoint_key(telemetry_key.replace("Bytes", ""), None, {}, self._log) # creating telemetry entry
converted_data.add_to_telemetry(TelemetryEntry({datapoint_key: value}, ts=timestamp)) # adding telemetry entry to telemetry array for sending data to platform
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If len(self.__config[extension_config_key][telemetry_key]) == 0, what will happen to the value variable?

@samson0v samson0v merged commit 810e843 into thingsboard:master Nov 11, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants