Skip to content

Commit

Permalink
Changed eval to use initial data
Browse files Browse the repository at this point in the history
  • Loading branch information
imbeacon committed Jan 24, 2025
1 parent d4a698c commit 595444e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions thingsboard_gateway/connectors/odbc/odbc_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ def __process_row(self, row):
converted_data: ConvertedData = self.__converter.convert(self.__config["mapping"], data)

StatisticsService.count_connector_message(self._log.name, 'convertersAttrProduced',
count=data.attributes_datapoints_count)
count=data.attributes_datapoints_count)
StatisticsService.count_connector_message(self._log.name, 'convertersTsProduced',
count=data.telemetry_datapoints_count)
count=data.telemetry_datapoints_count)

converted_data.device_name = eval(self.__config["mapping"]["device"]["name"], globals(), converted_data)
converted_data.device_name = eval(self.__config["mapping"]["device"]["name"], globals(), data)

device_type = eval(self.__config["mapping"]["device"]["type"], globals(), converted_data)
device_type = eval(self.__config["mapping"]["device"]["type"], globals(), data)
if not device_type:
device_type = self.__config["mapping"]["device"].get("type", "default")
converted_data.device_type = device_type
Expand Down

0 comments on commit 595444e

Please sign in to comment.