For a project in Java, I use the com.serotonin.bacnet4j library
I want to unsubscribe all activeCovSubscriptions during initialization. For that, I first get the list of all activeCovSubscriptions and I loop on it to call the unsubcribe.
Get the list: (this part works)
final ReadPropertyRequest request = new ReadPropertyRequest(deviceObject, PropertyIdentifier.activeCovSubscriptions);
Unsubscribe:
final SubscribeCOVRequest cancellation = new SubscribeCOVRequest(new UnsignedInteger(subscriptionProcessIdentifier), monitoredObjectIdentifier, null, null);
try {
localDevice.getDevice().send(remoteDevice, cancellation, null);
} catch (final Exception e1) {
LOGGER.warn("Failed to find remote device to which to send unsubscribe", e1);
}
My problem occurs after resetting my docker container: it gets a new MAC address.
Then the unsubscribe doesn't work !
I guess that it's because of the MAC address which was used for the registration is not the same anymore (after the reset of container) when I want to unsubscribe.
Until now, I didn't find any method in bacnet4j where I can provide the MAC address.
Other question: Is there a method to force the deletion of all activeCovSubscriptions
?
Thanks in advance for your help
I already had a look in the library and I have seen in the class SubscribeCOVRequest that the handle
method is taking in argument a final Address from
but I don't know how to set it when I want to send this on a remoteDevice and not in LocalDevice.
For a project in Java, I use the com.serotonin.bacnet4j library
I want to unsubscribe all activeCovSubscriptions during initialization. For that, I first get the list of all activeCovSubscriptions and I loop on it to call the unsubcribe.
Get the list: (this part works)
final ReadPropertyRequest request = new ReadPropertyRequest(deviceObject, PropertyIdentifier.activeCovSubscriptions);
Unsubscribe:
final SubscribeCOVRequest cancellation = new SubscribeCOVRequest(new UnsignedInteger(subscriptionProcessIdentifier), monitoredObjectIdentifier, null, null);
try {
localDevice.getDevice().send(remoteDevice, cancellation, null);
} catch (final Exception e1) {
LOGGER.warn("Failed to find remote device to which to send unsubscribe", e1);
}
My problem occurs after resetting my docker container: it gets a new MAC address.
Then the unsubscribe doesn't work !
I guess that it's because of the MAC address which was used for the registration is not the same anymore (after the reset of container) when I want to unsubscribe.
Until now, I didn't find any method in bacnet4j where I can provide the MAC address.
Other question: Is there a method to force the deletion of all activeCovSubscriptions
?
Thanks in advance for your help
I already had a look in the library and I have seen in the class SubscribeCOVRequest that the handle
method is taking in argument a final Address from
but I don't know how to set it when I want to send this on a remoteDevice and not in LocalDevice.
1 Answer
Reset to default 0As you said: The issue occurs because BACnet device addressing is tied to the network address. When a Docker container restarts with a new MAC address, the original subscription context is lost
Two solutions are available:
- Bind to all interfaces instead of a specific IP.
- Use the BBMD (BACnet Broadcast Management Device) approach.