-
-
Notifications
You must be signed in to change notification settings - Fork 456
Closed
Labels
enhancementAn enhancement or new feature of the CoreAn enhancement or new feature of the Core
Description
According to the docs the system locale will define the default unit of an UOM item.
There are many use cases where a user does not want the conversion to the default unit but rather wants the item state to represent a different unit.
So it's important the the user can explicitly set the desired unit for each item.
Explicit setting of the unit is optional and only required when the system default is not correct.
NumberItems should carry the unit as an additional field on the item
Changes to *.items files
Current syntax
Number:Temperature TestTemp "Temperature [%.1f °C]"
Since all the units are unambiguous I propose the following syntax for items files:
Number:°F TestTemp "Temperature [%.1f °C]"
Number:m/s TestSpeed "Speed [%.1f mph]"
Changes to the RestAPI
NumberItems should show the current unit
Current response:
{
"link": "http://localhost:8080/rest/items/TestTemp",
"state": "20 °C",
"stateDescription": {
"pattern": "%.1f °C",
"readOnly": false,
"options": []
},
"editable": false,
"type": "Number:Temperature",
"name": "TestTemp",
"label": "Temperature",
"tags": [],
"groupNames": []
}New response
- state doesn't carry the unit any more
- new fields
unitanddimension(I'm unsure about dimension since it's not required)
{
"link": "http://localhost:8080/rest/items/TestTemp",
"state": "20",
"unit": "°F",
"dimension": "Temperature",
"stateDescription": {
"pattern": "%.1f °C",
"readOnly": false,
"options": []
},
"editable": false,
"type": "Number",
"name": "TestTemp",
"label": "Temperature",
"tags": [],
"groupNames": []
}Metadata
Metadata
Assignees
Labels
enhancementAn enhancement or new feature of the CoreAn enhancement or new feature of the Core