From f9b143a969e73d073f91ac594fa2072507d4d26f Mon Sep 17 00:00:00 2001 From: Mario Bielert Date: Thu, 7 Nov 2024 14:14:59 +0100 Subject: [PATCH] Makes BacNet properties configurable --- metricq_source_bacpypes/config_model.py | 4 ++++ metricq_source_bacpypes/source.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/metricq_source_bacpypes/config_model.py b/metricq_source_bacpypes/config_model.py index 16398e9..6139030 100644 --- a/metricq_source_bacpypes/config_model.py +++ b/metricq_source_bacpypes/config_model.py @@ -66,6 +66,10 @@ class Device(BaseModel, **_model_config): class Source(BaseModel, extra="ignore", frozen=True): bacnetAddress: str """Address of the BacNet client used as source""" + bacnetIdentifier: int + """Identifier for the BacNet client used as source""" + bacnetName: str + """Name of the BacNet client used as source""" interval: PositiveFloat | PositiveInt | str | None = None """ Default query interval in seconds. diff --git a/metricq_source_bacpypes/source.py b/metricq_source_bacpypes/source.py index c7c3758..78fbb73 100755 --- a/metricq_source_bacpypes/source.py +++ b/metricq_source_bacpypes/source.py @@ -333,8 +333,8 @@ async def _on_config( self.bacnet = None this_device = DeviceObject( - objectName="MetricQBacpypesSource", - objectIdentifier=7, + objectName=config.bacnetName, + objectIdentifier=config.bacnetIdentifier, vendorIdentifier=15, maxApduLengthAccepted=1476, # was like that in ye olden scriptures )