|
Re: Change Channel pattern based on its configuration [message #1772488 is a reply to message #1772482] |
Mon, 11 September 2017 12:38 |
Henning Treu Messages: 44 Registered: April 2017 |
Member |
|
|
Hi,
you have three different options here:
- omit the unit in the channels state description entirely. The user has to provide item state descriptions in the items file or sitemap with the proper unit. This is how the WeatherUnderground binding does it right now.
- implement your own StateDescriptionProvider and resolve the Channel for the given item name. Then return a state Description matching the unit the user chose on the channel. This works in combination with 1) resulting in PaperUI not showing a unit but other UIs showing the unit the user configured.
- Preferred: Wait until https://github.com/eclipse/smarthome/pull/1857 is done and directly implement support for the frameworks QuantityType. This way your binding can update the channel with any unit and the framework will convert it to the local default or the specific unit the user configured on the item or in the sitemap.
I would strongly suggest to wait for option 3 as it is in development right now and will be really nice to solve your problem. The WeatherUnderground binding gets updated to with the mentioned PR so you can already have a look on how this is done.
Cheers,
Henning
[Updated on: Mon, 11 September 2017 12:43] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03429 seconds