1
0
mirror of https://github.com/thingsboard/thingsboard-gateway synced 2025-10-26 22:31:42 +08:00

Revert "Optimize attribute parse method"

This commit is contained in:
Illia Barkov
2023-11-23 15:04:48 +02:00
committed by GitHub
parent 4cd2698ae7
commit fcea620f92

View File

@@ -537,14 +537,18 @@ class TBGatewayService:
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)
@@ -553,6 +557,10 @@ class TBGatewayService:
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()