openHAB 4.1.0.M2: oh-stepper not working properly

Continuing the discussion from openHAB 4.1 Milestone discussion.

In the milestone discussion, it was reported that oh-stepper was showing NaN even if the Item has a numeric state (see openHAB 4.1 Milestone discussion - #63 by DrRSatzteil), and that in that case it is not possible to send any command using up and down buttons (see openHAB 4.1 Milestone discussion - #64 by apella12). The last should be fixed by Fix oh-stepper cannot control Item if state is NaN by florian-h05 · Pull Request #2137 · openhab/openhab-webui · GitHub.

/cc @apella12 @DrRSatzteil Let’s continue the discussion here:

I will try to reproduce that …

This should be fixed by my PR. You are on milestone 2, correct? I can prepare a JAR so you can try out my fix, and I will probably add some debugging.

I see that you have manually defined the widget. Can you please copy the code tab of that metadata and share it here?

Sure, but there is not much to see there:

value: oh-stepper-card
config: {}

:grimacing:

I guess I found the issue. A previous PR introduced a regression, where Number() is called on the Item state containing a unit.
However Number('0 °C') returns NaN, instead parseFloat(0 °C) returns 0.

I have updated my PR, which now fixes both that issue and also allows sending a command to an Item when it’s state really is NaN.

I build an UI artifact, which should work with 4.1.0.M2 (I am on the latest snapshot, but since there was no core framework change, I expect it to work):

Deploy it to your addons folder, and log into the Karaf console:

bundle:list org.openhab.ui

Stop the milestone bundle, restart the other one.

bundle:stop ID and bundle:restart ID.

I’ll give it a test in a minute. Do I need to stop the existing UI bundle before adding the new one to the addons? I have a personal rule (learned from experience) to not have two of the same bundles running?

Also this sounds promising. Before I saw your message I thought to create a stepper card when everything running. (I had deleted them). It was still a problem.

        - component: oh-stepper-card
          config:
            item: MainThermostat14_SetpointCooling
            min: 70
            max: 80
            step: 1
            label: true
            scale: true
            title: Main Floor Cooling Setpoint
            footer: =items.MainThermostat14_SensorTemperature.state
        - component: oh-slider-card
          config:
            item: MainThermostat14_SetpointCooling
            min: 70
            max: 80
            step: 1
            label: true
            scale: true
            title: Main Floor Cooling Setpoint
            footer: =items.MainThermostat14_SensorTemperature.state

Stepper 2023-10-15 090214

Lastly, (if I read the PR correctly) I do not really like the idea of setting an Item value in the widget to the minimum or maximum. I do not want the AC or furnace to start with an OH restart. If the previous value can’t be loaded, I would prefer NaN.

Edit: I did stop the OH4.1M2 binding first :wink:
The new one works on a running system. Same screenshot with updated jar.
Stepper2 2023-10-15 090214

1 Like

For the UI bundle, I didn’t notice any issue when having two at the same time. The newly added one is not starting up as long as the older one is still active.
I think it makes no real difference, but if you want to, stop the existing one before installing the new one.

The stepper does not issue a command on its own, in fact I had invested a few hours some time ago to get rid of „ghost“ commands, which can occur in very rare cases.

With the PR, the stepper will be able to set the Item to a state when the state is NaN, it uses min or max or 0, but this only happens when you click plus or minus.

Great! If you have a GitHub account, it would be nice if you could approve or comment the PR — I am still not allowed to merge it because it is my own PR, but it’s always good for maintainers when someone else verifies a fix.

The fix also worked for me.

1 Like

I can also confirm that the fix resolves the problem! Thank you!

1 Like

Hi, Could you please upload the artifact again? The previous upload has expired. THX!

cancel previous. i’ve found the PR and built it locally. thx for the fix. br

1 Like