Table of Contents |
---|
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 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 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:
Code Block |
---|
// 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. (takes connector id)
- example: bacnetObjectTypeList(@p:demo:r:2604f655-7cf3b976)
- bacnetPropertyIdentifierList() - this returns all the available properties (takes connector id)
- example: bacnetPropertyIdentifierList(@p:demo:r:2604f655-7cf3b976)
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.
Warning | ||
---|---|---|
| ||
If editing the actions directly via the Point Essentials view, then you want to make sure you escape the dollar sign ($) character if not already escaped. If using the Actions Category Permission tool, don't escape the $ because the tool already does that. If you do escape it in the tool, it'll add additional backslashes and break the actions. You would then need to edit and re-save to fix them. |
Code Block | ||
---|---|---|
| ||
ver:"2.0" expr,dis "bacnetWriteObjectProperty($self->bacnetConnRef, $self->bacnetWrite, toStr(`present_value`), $val)", "Set" |
Code Block | ||
---|---|---|
| ||
ver:"3.0" dis,expr,hvac_finCat "Emergency Set","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, toStr(`present_value`), \$val, 1)",9 "Emergency Auto","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, toStr(`present_value`), null, 1)",9 "Manual Set","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, toStr(`present_value`), \$val, 8)",6 "Manual Auto","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, toStr(`present_value`), null, 8)",6 "Set Default","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, toStr(`present_value`), \$val, 16)",3 "Set Null","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, toStr(`present_value`), null, 16)",3 |
Code Block | ||
---|---|---|
| ||
ver:"3.0" dis,expr,hvac_finCat "Emergency Active","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, true, 1)",9 "Emergency Inactive","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, false, 1)",9 "Emergency Auto","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, null, 1)",9 "Manual On","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, true, 8)",6 "Manual Off","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, false, 8)",6 "Manual Auto","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, null, 8)",6 "Set Default","bacnetWriteObjectProperty((\$self)->bacnetConnRef, (\$self)->bacnetWrite, 85, $val, 16)",3 |
To execute a bacnetWriteObjectProperty within the actions grid on points, make sure not to have quotations within quotations. If you need to use toStr() instead like we did above 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.
...