Hi I developing a project with bacnet (BAC0 library) and python 3 and this is my code in my method
// Connect in Lite Mode
self.bacnet = BAC0.connect(
ip='192.168.1.2'
)
self.bacnet.discover(networks='known')
tmp = self.bacnet.devices
my_controller = BAC0.device(address=tmp[0][2], device_id=tmp[0][3], network=self.bacnet)
points = my_controller.points
point = points[0]
numeric_point = self.GetNumericPoint(point)
// create a while for change value of point and trig COV notification
while True:
i = i + 1
numeric_point.write(i, prop="presentValue", priority="12")
value = numeric_point
time.sleep(1)
print('wait')
And question is how to trig a function with BAC0 in python3 when has Notify by COV (Change of Value) Thanks.
For now, COV is implemented in the develop branch only. It will be in the next release, don't know when.
You can subscribe to a COV for any point (if your device supports it). When the notification will be received, the history of the point will be written to so the lastValue of the point will be accurate.
By default, confirmedCOV are declared. But you can configure this, as lifetime too.
Edit to illustrate the use of a callback, added to develop branch
objectID : a tuple with ("objectType", instance) ex. ("analogInput",1)
More information available in the documentation : https://bac0.readthedocs.io/en/latest/cov.html?highlight=cov