Skip to content

Commit

Permalink
Merge branch 'master' of github.com:thingsboard/thingsboard-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
imbeacon committed Jan 20, 2025
2 parents fc825c4 + 7d974c6 commit e9d00c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.


from bacpypes3.basetypes import DateTime

from thingsboard_gateway.connectors.bacnet.bacnet_converter import AsyncBACnetConverter
from thingsboard_gateway.connectors.bacnet.entities.uplink_converter_config import UplinkConverterConfig
from thingsboard_gateway.gateway.entities.converted_data import ConvertedData
Expand Down Expand Up @@ -49,6 +51,9 @@ def convert(self, data):
value)
continue
try:
if isinstance(value, DateTime):
value = value.isoformat()

datapoint_key = TBUtility.convert_key_to_datapoint_key(config['key'],
device_report_strategy,
config,
Expand Down
13 changes: 9 additions & 4 deletions thingsboard_gateway/connectors/bacnet/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ def __send_callback(self):

@staticmethod
def find_self_in_config(devices_config, apdu):
apdu_address = apdu.pduSource.addrTuple[0] + ':' + str(apdu.pduSource.addrTuple[1])
device_config = list(filter(lambda x: x.get('address') == apdu_address or apdu_address in x.get('altResponsesAddresses', []), devices_config))
if len(device_config):
return device_config[0]
apdu_host = apdu.pduSource.addrTuple[0]
apdu_address = apdu_host + ':' + str(apdu.pduSource.addrTuple[1])
for device_config in devices_config:
if device_config.get('address') == apdu_address:
return device_config
elif apdu_address in device_config.get('altResponsesAddresses', []):
return device_config
elif device_config.get('host') == apdu_host:
return device_config

@staticmethod
def get_object_id(config):
Expand Down

0 comments on commit e9d00c5

Please sign in to comment.