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

Add documentation for Unit Hint #2283

Merged
merged 3 commits into from
May 20, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion developers/bindings/thing-xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Overriding labels of a channel type must only be done if the very same functiona

### State Channel Types

The following XML snippet shows a thing type definition with 2 channels and one referenced channel type:
The following XML snippet shows a thing type definition with three channels and two referenced channel types:

```xml
<thing-type id="thingTypeID">
Expand All @@ -85,6 +85,7 @@ The following XML snippet shows a thing type definition with 2 channels and one
<channels>
<channel id="switch" typeId="powerSwitch" />
<channel id="temperature" typeId="setpointTemperature" />
<channel id="roomHumidity" typeId="humidity" />
andrewfg marked this conversation as resolved.
Show resolved Hide resolved
</channels>
</thing-type>
<channel-type id="setpointTemperature" advanced="true">
Expand All @@ -93,8 +94,16 @@ The following XML snippet shows a thing type definition with 2 channels and one
<category>Temperature</category>
<state min="12" max="30" step="0.5" pattern="%.1f °C" readOnly="false" />
</channel-type>
<channel-type id="humidity" advanced="false">
andrewfg marked this conversation as resolved.
Show resolved Hide resolved
<item-type unitHint="%">Number:Dimensionless</item-type>
<label>Humidity</label>
<state readOnly="true" pattern="%.1f %%"></state>
</channel-type>
```

The `item-type` element defines the [item type](../../configuration/items.md#type) to be used when a linked item is created.
If the `item-type` is a `Number:<dimension>`, then a `unitHint` attribute may be provided to suggest the measurement unit to be used when a linked item is created.

In order to reuse identical channels in different bindings a channel type can be system-wide.
A channel type can be declared as system-wide by setting its `system` property to true and can then be referenced using a `system.` prefix in a `channel` `typeId` attribute in any binding - note that this should only be done in the core framework, but not by individual bindings!

Expand Down
Loading