Updating values into BACnet objects #502
-
Hello Guys, If you have any suggestions,I will appreciate that. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
you can't reference your object like this. The add_object_to_application method will put everything where bacpypes needs it. The thing you get back from this is an object that contains all the object you want to build.... device1['ZN-T'].presentValue = new_value should work Also, have a look to the tasks (RecurringTask). This way you can create different functions to update the value of your objects and the execution will be automatically dealt by the task manager # extract from code...
_new_objects.add_objects_to_application(weather_device)
app = WeatherApp(weather_device)
task_device = RecurringTask(
update, delay=int(os.environ.get("OWM_REFRESHRATE"))
)
task_device.start()
while True:
await asyncio.sleep(0.1) I'm not sure, but my instinct would tell me not to wait 5 seconds in the main loop as it could create delays in the responses BAC0 will give to other BACnet device talking to it. I know it is async code, but I'm pretty sure |
Beta Was this translation helpful? Give feedback.
-
Thank you @ChristianTremblay for you fast response. First line above works and updates a value. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
you can't reference your object like this. The add_object_to_application method will put everything where bacpypes needs it. The thing you get back from this is an object that contains all the object you want to build....
should work
And you don't need to clear_objects in your loop.
Also, have a look to the tasks (RecurringTask). This way you can create different functions to update the value of your objects and the execution will be automatically dealt by the task manager