Skip to content

Commit

Permalink
Merge pull request #1239 from thingsboard/revert-1238-master
Browse files Browse the repository at this point in the history
Revert "Optimize attribute parse method"
  • Loading branch information
imbeacon authored Nov 23, 2023
2 parents 4cd2698 + fcea620 commit 7a674d7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions thingsboard_gateway/gateway/tb_gateway_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,18 @@ def _attributes_parse(self, content, *args):
log.debug("Received data: %s", content)
if content is not None:
shared_attributes = content.get("shared", {})

# client attributes now required for now, can be used in future
# client_attributes = content.get("client", {})
client_attributes = content.get("client", {})
if shared_attributes or client_attributes:
self.__process_attributes_response(shared_attributes, client_attributes)
else:
self.__process_attribute_update(content)

if shared_attributes:
self.__process_attribute_update(shared_attributes)
log.debug("Shared attributes received (%s).",
", ".join([attr for attr in shared_attributes.keys()]))
if client_attributes:
log.debug("Client attributes received (%s).",
", ".join([attr for attr in client_attributes.keys()]))
except Exception as e:
log.exception(e)

Expand All @@ -553,6 +557,10 @@ def __process_attribute_update(self, content):
self.__process_remote_configuration(content)
self.__process_remote_converter_configuration_update(content)

def __process_attributes_response(self, shared_attributes, client_attributes):
self.__process_remote_logging_update(shared_attributes.get('RemoteLoggingLevel'))
self.__process_remote_configuration(shared_attributes)

def __process_remote_logging_update(self, remote_logging_level):
if remote_logging_level == 'NONE':
self.remote_handler.deactivate()
Expand Down

0 comments on commit 7a674d7

Please sign in to comment.