Skip to content
\n

should work
\nAnd you don't need to clear_objects in your loop.

\n

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

\n
    # extract from code...\n    _new_objects.add_objects_to_application(weather_device)\n    app = WeatherApp(weather_device)\n    task_device = RecurringTask(\n            update, delay=int(os.environ.get(\"OWM_REFRESHRATE\"))\n        )\n    task_device.start()\n    while True:\n        await asyncio.sleep(0.1)
\n

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 await asyncio.sleep will block for 5 seconds before continuing... (I may be wrong). Using a task will eliminate risks.

","upvoteCount":1,"url":"https://github.com/ChristianTremblay/BAC0/discussions/502#discussioncomment-11467361"}}}

Updating values into BACnet objects #502

Discussion options

You must be logged in to vote

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
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

    # extract from code...
    _new_objects.add_objects_to_application(weather_device)
    app = WeatherApp(weather_device)
    task_device = RecurringTask(
            update, d…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ChristianTremblay
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants