Slider to display value and set another value

Hello Experts,

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?

Just add a Label component to your widget which shows the state of the position item…

Ok, that’s a solution and I’ll do that too, but I logically want to start moving the slider at the right place.

Please remember that the slider remains at the last value, but I can also move the shutters with other conventional switches and then the slider is no longer correct.

Should be possible. Could you post the definition of both items?
If I understand correctly item 1 sends a command to the knx-rollershutter and item 2 contains the position?

Item for status position:

  "KNX_Sensoren__Haus_1_1_Markise_Position": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "EG1",
        "Garten"
      ],
      "itemType": "Number",
      "tags": [
        "OpenLevel",
        "Opening"
      ],
      "label": "1 Markise Position",
      "category": "rollershutter"
    }
  },

Channel:

  - id: 1MarkiseInPosition
    channelTypeUID: knx:number
    label: 1 Markise Position
    description: null
    configuration:
      ga: 5.001:<1/1/50

Item for position:

  "KNX_Aktoren__Haus_1_1_Markise_Position_Sollwert": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "EG1",
        "Garten",
        "Haus1"
      ],
      "itemType": "Number",
      "tags": [
        "OpenLevel",
        "Opening"
      ],
      "label": "1 Markise Position Sollwert",
      "category": "rollershutter"
    }
  },

Channel:

  - id: 1MarkisePosSoll
    channelTypeUID: knx:dimmer
    label: 1 Markise Position Sollwert
    description: null
    configuration:
      ga: 5.001:<1/1/51

I would just have to initially set the setpoint to the status value.
But how can I do that?
Maybe metadata?

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.
That rule

  1. gets triggered by COMMAND-trigger from the widget and sends the command to the actuator
  2. 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.

Hello Oliver,

thank you. :blush:

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:

  1. 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.
  2. Submit a modification to the ui code that fundamentally alters how the oh-slider works.

Misunderstanding. What I suggested was one rule which has two tasks/functions