I have OpenHab 3.2.0 set up and working. I am tring to add contol to my blinds, and it works too, but at the moment I have to things (one switch for controling blinds and second an integer value in the rage of 0 … 255 which gives me a blind position).
For now I set up two items too, but this is not looking nice. It would be better to have one switch, and in the description of it a value of the position. It would be perfect if that value would change icons as it is now - when value is 0 icon is open, when 100 it is closed). The metter of scale range 0 … 255 to 0 … 100 is not my problem at the moment and should be easy to fix later.
Is it possible to make above scenario to work as intended?
Alright, so you are using a xxx.sitemap file, and you may use dynamic icons in the usual way.
If you create a set of images like -
yourIcon.png
yourIcon-0.png
yourIcon-1.png
then for a numeric value 0 to 100, the -0 image is displayed for 0 Item state, the -1 image for all states 1 to 100
Note that dynamic icon does not work properly in this way for numbers over 100
Yes, it is already working this is not my problem. As I said I have two things and two items which are listed in the sitemap file. So in the UI I have one switch and a number below which translates to the position of the blind. Now I would like to have in the site map only one item. Inthe description of the switch item I would like to have a number (posisiton of the blind).
If I understand what you are after the closest you can get is to use Label and Value Colors which is one of only places in sitemaps where an entry can refer to two separate Items in the same widget (the other is visibility).
If that doesn’t suffice, you’ll have to use MainUI or HABPanel.
If you don’t ask for a state display, you don’t get one.
You wanted the number displayed, so ask for it -
Number FF_Office_Blind_Pos "Pozycja rolety [%d]" ...
Then you want it displayed in switch type widget
Switch item=FF_Office_Blind_Pos
You do not have to use Switch type Items with Switch type UI widgets.
But
If you move the toggle/slider on the UI it will send ON or OFF command to your Number type Item, that’s not accepted.
You might want to use a Dimmer type Item instead, which has a 0-100 state and will deal with both number commands and on/off commands.
Then you’d need a rule to intercept those commands to the Number Item and convert them to commands to your FF_Office_Blind switch Item.
or
stay with the Number type Item, but use the switch widget in "button"mode instead, with mappings.