I have roller shutters that are controlled via a KNX actuator. This actuator supplies the current position via a group address (item). I can also move to a defined position using a different group address (item).
So I created a widget with a popup slider.
Now I want to set a target position with a slider and (when released) send the value to the item. But I want to see the current position when I open the slider via popup before I move it and send a new value. But I can only assign one item to the slider.
So what option do I have to preset the slider to a status value and then send the value to another item after moving it?
The slider represents the item‘s value, so I don’t think you can provide a „starting“ value.
Out if the top of my head I would work with a proxy item which triggers a rule.
gets triggered by COMMAND-trigger from the widget and sends the command to the actuator
gets triggered by COMMAND-trigger (not sure if that works) from the sensor and does a POSTUPDATE to the proxy item (You may not use a sendCommand because that will create a loop). And you cannot use an itemChangedTrigger for the sensor change because that would also create a loop.
There is an easier solution (proxy item without rule) but that would not cover the case if you change the position via a separate remote control.
But that’s not particularly satisfactory for me. I don’t want to have to create two additional rules for each widget. That all has to be included in the widget.
Any other ideas?
What are metadata and variables in items or widgets for? I used pattern metadata for the item, but the possibilities of the many others are not yet entirely clear to me. Maybe something will work with that?
That’s simply not feasible at this point. The oh-slider widget was not designed with this use case in mind.
The limitation here is just that there is no mechanism, based on how the oh-slider has been constructed, to set a starting value for it other than the value of the item linked to the slider.
Metadata are just that. Additional information that it makes sense to have associated with one particular item. Metadata can be very useful in widgets but not in this instance for two reasons: 1) the metadata for an item is only available in the widget context when that item has been fully accessed by an oh-repeater making a call the the API, and 2) even if you had the value in the item metadata, there’s still no way for you to define that as the starting point of the oh-slider.
Variables are designed as a method by which the different components in a widget or the difference widgets on a page can pass information back and forth.
You have to solutions to this problem:
Find a way to get OH to do a better job of keeping these item values synchronized. Oliver has suggested one method, there might be a way with something like the follow profile or a transform, there are probably several different viable options here.
Submit a modification to the ui code that fundamentally alters how the oh-slider works.