Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read not working while using same port and different IP on Linux #522

Open
kuriakosejohn opened this issue Feb 5, 2025 · 1 comment
Open

Comments

@kuriakosejohn
Copy link

The following test works fine on windows, but not on Linux. Looks like when there are multiple BAC0 instances (using same UDP port) on Linux environment, it is not working.

import BAC0
import pytest
from BAC0.core.devices.local.factory import analog_input
from bacpypes3.basetypes import EngineeringUnits

@pytest.mark.asyncio
async def test_read_using_same_port():
    '''
    Test BAC0 API to read single property from BACnet objects
    '''
    # create BACnet device as server
    async with BAC0.start(ip="127.0.0.1/24") as server:
        # add objects
        ai_obj = analog_input(
            name="ZN-T",
            properties={"units": "degreesCelsius"},
            description="Zone Temperature",
            presentValue=21,
        )
        ai_obj.add_objects_to_application(server)

        # create BACnet client
        async with BAC0.start(ip="127.0.0.2/24") as client:
            present_value = await client.read('127.0.0.1 analogInput 0 presentValue')
            assert present_value == 21
            unit = await client.read('127.0.0.1 analogInput 0 units')
            assert unit == EngineeringUnits.degreesCelsius
@ChristianTremblay
Copy link
Owner

This is probably more on the bacpypes3 side and the way the socket works on Linux vs Windows

I don't use 127.0.0.1 usually and stick to the real(?) IP address of the interface.

I also declare multiple IP address per interface if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants