• G gk_brown

    I'm still trying to get a basic proof-of-concept working with bacnet4j. Was wondering if there might be a simple test app I could run on my subnet to validate connectivity. I looked through the test code, but it seems like it is all unit tests. Any suggestions?


    posted in BACnet4J general discussion read more
  • G gk_brown

    Any suggestions on this? I found out that I was using the wrong device ID, but other wise, I believe the code is correct. However, it still doesn't connect.

    posted in BACnet4J general discussion read more
  • G gk_brown

    Hi all. I'm trying to build a simple proof-of-concept that retrieves a single analog value from a given device using bacnet4j. Although I have not confirmed this yet, I believe the device ID is 0 and the instance number of the value is 9.

    The code first obtains and initializes a LocalDevice instance, then constructs a DeviceObjectPropertyReferences to hold the requested property. It then uses PropertyUtils to read the properties. Finally, the value is extracted as an Encodable and converted to a double.

    Unfortunately, the code is not working as written - it fails with a timeout exception. I'm not sure if this is because I have the wrong broadcast address, network prefix length, or device ID, so I am trying to isolate the problem.

    I am also wondering if this is the best way to read a specific value from a specific device. For example, I know the actual IP address of the device. Assuming that I have the correct device ID, is there a way to connect to the device directly (for example, one that does not require the broadcast or subnet address)?

    The sample code and resulting stack trace are below. Thank you for your help.

    Greg Brown

    private static final int DEVICE_ID = 0;
    private static final ObjectIdentifier OBJECT_IDENTIFIER = new ObjectIdentifier(ObjectType.analogValue, 9);
    private static final long TIMEOUT = 5000;
    public static void main(String[] args) throws Exception {
        // Initialize local device
        IpNetworkBuilder ipNetworkBuilder = new IpNetworkBuilder().withBroadcast(BROADCAST_ADDRESS, 24);
        LocalDevice localDevice = new LocalDevice(ObjectIdentifier.UNINITIALIZED, new DefaultTransport(;
        // Request property
        DeviceObjectPropertyReferences deviceObjectPropertyReferences = new DeviceObjectPropertyReferences();
        deviceObjectPropertyReferences.add(DEVICE_ID, OBJECT_IDENTIFIER, PropertyIdentifier.presentValue);
        DeviceObjectPropertyValues deviceObjectPropertyValues = PropertyUtils.readProperties(localDevice, deviceObjectPropertyReferences, null, TIMEOUT);
        PropertyValues propertyValues = deviceObjectPropertyValues.getPropertyValues(DEVICE_ID);
        // Extract property value
        Encodable encodable = propertyValues.get(OBJECT_IDENTIFIER, PropertyIdentifier.presentValue);
        double value = ((com.serotonin.bacnet4j.type.primitive.Double)encodable).doubleValue();

    11:17:27.638 [main] INFO com.serotonin.bacnet4j.LocalDevice - Waiting for incoming IAms
    11:17:37.642 [main] INFO com.serotonin.bacnet4j.LocalDevice - Found 20 ids that are still available. Choosing 2911125
    11:17:42.667 [pool-1-thread-1] INFO c.s.bacnet4j.util.PropertyUtils - Timeout while finding device 0
    com.serotonin.bacnet4j.exception.BACnetTimeoutException: No response from instanceId 0
    at com.serotonin.bacnet4j.util.RemoteDeviceFinder$DeviceFutureImpl.get(
    at com.serotonin.bacnet4j.LocalDevice$2.get(
    at com.serotonin.bacnet4j.util.PropertyUtils.requestPropertiesFromDevice(
    at com.serotonin.bacnet4j.util.PropertyUtils.lambda$readProperties$0(
    at java.base/java.util.concurrent.Executors$
    at java.base/
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.base/java.util.concurrent.ThreadPoolExecutor$
    at java.base/
    Exception in thread "main" com.serotonin.bacnet4j.exception.PropertyValueException
    at com.serotonin.bacnet4j.util.PropertyValues.get(
    at com.serotonin.bacnet4j.util.PropertyValues.get(
    at com.novapwr.agent.BACnetTest.main(

    posted in BACnet4J general discussion read more
  • G gk_brown

    Hi all,

    I'm new to bacnet4j as well as BACnet in general, and am looking for advice on how to get started. I am a long-time Java developer and am familiar with similar protocols such as Modbus and SNMP.

    I have looked for introduction/tutorial information and have not been able to find much. Any suggestions would be very much appreciated.

    Greg Brown

    posted in BACnet4J general discussion read more