Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multistate BACnet properties mapping #304

Open
egekorkan opened this issue Oct 12, 2023 · 1 comment
Open

Multistate BACnet properties mapping #304

egekorkan opened this issue Oct 12, 2023 · 1 comment
Labels
bacnet related to bacnet protocol binding Has Use Case Potential The use case can be extracted and explained Selected for Use Case

Comments

@egekorkan
Copy link
Contributor

As seen in BrickSchema/Brick#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
Copy link
Contributor

fennibay commented Nov 6, 2023

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:

<pre id="example-form-variables" class="example" title="value mapping for an Enumeration">
{
"@context": ["https://www.w3.org/2022/wot/td/v1.1",
{
"bacv": "https://example.org/bacnet"
}],
...
"properties": {
"multistate1": {
"type": "string",
"enum": ["on", "off", "auto", "manual"]
"readOnly": true,
"forms": [{
"op": [ "readproperty" ],
"href": "bacnet://5/14,1/85",
"bacv:usesService": "ReadProperty",
"bacv:hasDataType": {
"@type": "bacv:Enumerated",
"bacv:hasValueMap": [
{
"bacv:protocolVal": 1,
"bacv:logicalVal": "on"
},
{
"bacv:protocolVal": 2,
"bacv:logicalVal": "off"
},
{
"bacv:protocolVal": 3,
"bacv:logicalVal": "auto"
},
{
"bacv:protocolVal": 4,
"bacv:logicalVal": "normal"
}
]
}
}]
}
}
}
</pre>

@egekorkan egekorkan added the bacnet related to bacnet protocol binding label Nov 28, 2023
@egekorkan egekorkan added the Has Use Case Potential The use case can be extracted and explained label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bacnet related to bacnet protocol binding Has Use Case Potential The use case can be extracted and explained Selected for Use Case
Projects
None yet
Development

No branches or pull requests

3 participants