Bacnet Write Object Property
You can utilize a bacnetWriteObjectProperty() function to write to any writable property on a BACnet point, not just strictly for actions but modifying other properties. FIN Stack can write to any property in an Object, we just need to know which property you want to write to. For example, by default in FIN Stack if you have the bacnetWrite tag as bacnetWrite:AV1, what we do is send this on the wire. If they are unique and proprietary, then the below would help with this.
bacnetWriteObjectProperty
bacnetWriteObjectProperty(conn, obj, prop, value, priority: Number. <ctor>(16))
Write a BACnet property value
Parameters:
- conn: the BACnet connection used to query the object properties
- obj: either a BACnet point record or a point Ref, or a string formatted as bacnetCur, i.e. objectType:objectInstance.
- prop: integer or string value representing the object property id
- value: value to be written
- priority: priority level, defaults to 16
Examples:
// Write the present value bacnetWriteObjectProperty(@connRef, @pointRef, 85, 1.0) //in this case 85 is present value and 1.0 is the value bacnetWriteObjectProperty(@connRef, "AV1", "present_value", 1.0, 16) //in this case 1.0 is the value and 16 is the priority array bacnetWriteObjectProperty(@connRef, "2:1", 85, 1.0) //in this case "2:1" is AV1, look at the below functions on how we got this //priority 16 is default so it can be omitted
Couple useful functions to find objects and properties below:
- bacnetObjectTypeList() - this returns all the object types. For above "2:1" example, if you run this func in folio, you'll see the ANALOG_VALUE shortName is AV and value is 2. The one is the point ID. Combine that would be AV1.
- bacnetPropertyIdentifierList() - this returns all the available properties
In the Actions Example 1 below, you have a bacnetWriteObjectProperty() being executed within the actions grid tag of a point where the first two parameters are using the point's own bacnetConnRef & bacnetWrite. See below for proper syntax.
- $self->bacnetConnRef = the point's own bacnetConnRef ID
- $self->bacnetWrite = the point's own bacnetWrite tag value (aka the point ID i.e.. "AV1")
- $val = the value the user will set once the "Set" action is selected
Note: Instead of hardcoding the bacnetConnRef & the bacnetWrite, you want it to be the values of whichever point you're commanding so that's where you utilizing the $self-> or $val as you see above makes it dynamic.
ver:"2.0" expr,dis "bacnetWriteObjectProperty($self->bacnetConnRef, $self->bacnetWrite, \"present_value\", $val)", "Set"
ver:"2.0" dis,expr,hvac_finCat "Emergency Active","pointEmergencyOverride(\$self, true)",9 "Emergency Inactive","pointEmergencyOverride(\$self, false)",9 "Emergency Auto","pointEmergencyAuto(\$self)",9 "Manual On","pointOverride(\$self, true, \$duration)",6 "Manual Off","pointOverride(\$self, false, \$duration)",6 "Manual Auto","pointAuto(\$self)",6 "Set Default","pointSetDef(\$self, \$val)",3 "Set Bacnet level 1 ON","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, \"present_value\",1,1)",9 "Set Bacnet level 1 OFF","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, \"present_value\",0,1)",9 "Set Bacnet level 1 Null","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, \"present_value\",null,1)",9
To execute a bacnetWriteObjectProperty within the actions grid on points, you have to escape the quotation characters within the string value so that's why you see "\" marks on the Relinquish Default quotes IF using property name. However, we recommend to use the numerical value of the property instead so that the actions appear where ever they may be called.
Writing to Relinquish Default property
ver:"2.0" expr,dis "bacnetWriteObjectProperty($self->bacnetConnRef, $self->bacnetWrite, 104, $val)", "Set"
ver:"2.0" expr,dis "bacnetWriteObjectProperty($self->bacnetConnRef, $self->bacnetWrite, \"Relinquish_Default\", $val)", "Set"
Writing to Cov Increment property
If the user want to be able to modify the Cov_Increment object property on a point, they can do so using the bacnetWriteObjectProperty() func. Use case would be if a customer doesn't want to flood the network on every value change and only see change of value if it exceeds a certain threshold. That is where Cov_Increment property comes into play. This is a property that needs to be configured on the device, not FIN Stack. The device would also need to be able to support COV. Below is example of how to modify and read this property from FIN Stack.
Read Cov_Increment property to see current configuration:
- Go to folio and run query below with connector id and either point instance or point id.
- bacnetReadObjectProperty(@conn_id, "point_instance", "Cov_Increment")
- example 1: bacnetReadObjectProperty(@236b97c6-88cdae62, "AV52", "Cov_Increment")
- example 2: bacnetReadObjectProperty(@236b97c6-88cdae62, @236b9811-6943ab2a, "Cov_Increment")
Write to Cov_Increment property:
- Go to folio and run query below with connector id, either point instance or point id, and value for Cov_Increment.
- bacnetWriteObjectProperty(@conn_id, "point_instance", "Cov_Increment", 0.5)
- example 1: bacnetWriteObjectProperty(@236b97c6-88cdae62, "AV52", "Cov_Increment", 0.5)
- example 2: bacnetWriteObjectProperty(@236b97c6-88cdae62, @236b9811-6943ab2a, "Cov_Increment", 0.5)