Skip to content

Issue polling devices with certain kinds of objects #579

Description

@AlexanderWells-diamond

I'm running into an issue with the poll feature present in the device. As part of the polling action, it appears to do a ReadPropertyMultiple request to read many objects from the device. One of the object is of type "loop", which appears to break the parsing found on this line of code as "loop" does not contain a colon, comma, or dash. This results in the while loop continuing, incorrectly consuming the next argument which is not a property id, and that breaks the rest of the parsing in this function.

I seem to be unable to avoid this exception as even setting a poll timer of zero still triggers a one-time RPM to the device. Full exception text (slightly reformatted for readability) is:

[05/06/26 15:08:22] ERROR    2026-05-06 15:08:22,756 - ERROR   | Site01'bmstest01 (<device ip>) 
Polling results contains a wrong value. Probably a communication error. Will skip this result and wait for the next cycle.                                                                                                                      
Error: invalid literal for int() with base 0: 'presentValue' | Type : <class 'ValueError'>
Poll.py:139

Example code to recreate this ( I apologise that I can't seem to create a software "loop" object, I don't see it available in the object factory methods):

import asyncio

from BAC0 import device, start

async def f():
    async with start() as client:
        controller = await device(<device-ip>, <device id>, client, poll=0)

        await asyncio.Event().wait()


asyncio.run(f())

I think bacpypes3 has an easy method to check if something is a valid Object Type which I believe would solve this issue:

import bacpypes3.primitivedata

bacpypes3.primitivedata.ObjectType("analog-value")  # Valid
bacpypes3.primitivedata.ObjectType("analogValue")  # Valid
bacpypes3.primitivedata.ObjectType("loop")  # Valid
bacpypes3.primitivedata.ObjectType("bad data")   # Invalid - raises ValueError exception

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions