Dual range slider

Hi,
I want to add to my settings in OH4 a range slider , something like:
image
I want to use it to set some min-max values e.g. min max for temperature, and if the value is outside that range, do something, e.g. send a notification.

I found that I can use a range:

component: oh-list-card
config: {}
slots:
  default:
    - component: f7-range
      config:
        min: 1
        max: 100
        value:
          - 20
          - 80
        dual: true

How could I bind the values to OH items ?

Right now you can’t. You would just have to use two sliders for this.

The only way for the components to interact with OH items is if you use the oh- version of the components; it requires quite a bit of special function for that to work. Currently the oh-slider is not built to handle the dual mode of the f7-range, it would require some significant modification.

You can certainly file a feature request for this, there are probably quite a few use cases where this is justified.

Thank you,
I expected this, but I was hoping for a possibility of a dirty JS trick or similar…

Sorry to correct you, but you can bind Item values to the min/max and value array options just like anywhere else.

For the value, just use

value:
   - =items.someItem.state
   - =items.secondItem.state

For temperature I am using

value:
   - =Number.parseInt(items.someItem.state)

Only Issue I have actually, it is working in widget designer, but is not showing in the UI.


Ups, spoiler for the new version….

Just a thought… Are you using the widget on the Overview page or on a different page? I have seen some weird behavior like that on the Overview Page.

No, we are not using the overview page for the project.

Hi, thank you for your response!
I tried it and it works partially for me, meaning than the items are not updated after i move the slider’s points with the mouse.

Ok, I guess that is what @JustinG meant with you cannot do this. As I only use it read only, I did not test updating the values from the widget.

Strange, after changing the top menu, it is working

Correct. At the moment it is only configured to send changes to the single value to items/variable. Changes tot he dual min/max settings are not tracked and or processed

Hmm, but we are not talking about the oh-slider component, but the f7-range…
So the issue cannot be related to the code you are quoting, correct?

An f7 component will never send interaction back to OH items or variables because it lacks the underlying code that connect them. You can always put an f7 component into widget and configure it to work exactly as expected as long as you don’t want to control any OH specific function.

So my answer was with respect to this. That code is the only code anywhere that connects the value(s) of an f7-range to OH items and it ignores the dual value configuration and only responds to the single value configuration.