Default priority to 16 for commands.
dopry opened this issue · 1 comments
Node Version: N/A
Node BACstack Version: master, 4777725
- Feature Request
Feature Request / Question
- When writing commandable properties, priority should default to 16.
Current Behaviour
when writing a commandable proper if a priority is not provided, a parameter-out-of-range error is received from some devices.
Expected Behaviour
It would be nice if the priority defaulted to 16 as it does in the web services specification. This might not be exact to spec. Other devices might throw errors if we pass priority to non-commandable properties through APDU instead of WebServices. It looks like if an Object is commandable, then Priority Array and Relinquish Default are required. Maybe the library could check for those properties.
Steps to reproduce Issue
- WritePropert to the Present Value of some commandable object...
const objectId = { type: Bacstack.enum.ObjectTypes.OBJECT_BINARY_VALUE, instance: 2};
function command(deviceIp, value, priority) {
return new Promise((resolve, reject) => {
client.writeProperty(deviceIp, objectId,
Bacstack.enum.PropertyIds.PROP_PRESENT_VALUE,
// set binary-value present-values with enumerated BACnetBinaryPV(0=inactive, 1=active)
[ { type: Bacstack.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value } ],
// must set priority when commanding, otherwise you will get an out of range exception.
// { priority },
(err, response) => (err) ? reject(err) : resolve(response)
);
});
};
command('192.168.1.81', 0, 8).then((response) => {
console.log('then', JSON.stringify(response));
})
.catch((err) => {
console.log('err', JSON.stringify(err));
});
you can uncomment the options line in the client.writeProperty method to see a working case..
These changes should be incorporated int https://github.com/BiancoRoyal/node-bacstack, please try this package and open issues at https://github.com/BiancoRoyal/node-bacstack/issues if it does not work as expected