w3c / wot-binding-templates

Web of Things (WoT) Binding Templates
http://w3c.github.io/wot-binding-templates/
Other
22 stars 25 forks source link

Multistate BACnet properties mapping #304

Open egekorkan opened 10 months ago

egekorkan commented 10 months ago

As seen in https://github.com/BrickSchema/Brick/issues/566, a property can have 3 values i.e. State_Text = ("Off", "On_Low", "On_High") but these are not what is sent via the protocol. Based on the implementation, these "meanings" can be mapped to different numbers. E.g. one implementation says that "Off" is 0 where the other has that as "2". We can solve this with TDs

fennibay commented 9 months ago

So, BACnet's approach is that only the numeric values (unsigned, enum, boolean) are transferred over the wire. Strings remain on the state-text property on multistate objects (and active-text, inactive-text properties on binary objects), and BACnet clients can use these strings to show the actual value of the object as a string instead of the numeric value.

In WoT-BACnet protocol binding we mimic this behavior with the ValueMap. Data schema is based on strings, which is then mapped to protocol-specific numeric values in the Form using the ValueMap.

Example: https://github.com/w3c/wot-binding-templates/blob/a6d657cb08d8042a686e896f39ea597ac686efd3/bindings/protocols/bacnet/index.html#L1045-L1086