openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
221 stars 240 forks source link

Unable to use config control with INTEGER, options, and LimitToOptions=false #986

Open cdjackson opened 3 years ago

cdjackson commented 3 years ago

The problem

It is currently not possible to control most Z-Wave and many Zigbee devices, and possibly other bindings as well as the UI incorrectly renders configuration parameters that have options defined, and also allow other values to be specified (ie LimitToOptions is false).

@ghys stated on the forum -:

The combination of type: INTEGER, limitToOptions: false and options defined is not supported by the config parameter control at the moment.

https://community.openhab.org/t/zwave-oh3-config-parameters/119789/22

This is quite a major issue and affects around 875 ZWave things. I would suggest that if the control is not able to handle this for integers, that the UI instead renders a simple integer input both. This is probably better, but since the values defined in the options may be outside of the min and max values allowed for integers, it will still mean that some values cannot be defined. Often for example we may have an option Disable of (say) 255, but the min and max are defined as 0 and 100 - so just rendering an integer input of 0 to 100 will still mean that the user cannot select 255.

ghys commented 3 years ago

I would suggest that if the control is not able to handle this for integers, that the UI instead renders a simple integer input both. This is probably better, but since the values defined in the options may be outside of the min and max values allowed for integers, it will still mean that some values cannot be defined.

To be clear - this particular point has been brought up before. So the integer control doesn't enforce min or max if there are options defined, precisely because some options can fall outside the range.

https://github.com/openhab/openhab-webui/blob/545174f36c8e2eae36d4ba210f930f6ec57091ee/bundles/org.openhab.ui/web/src/components/config/controls/parameter-number.vue#L7-L8

Still it'd be better of course if both the options and the input box could be displayed.

cdjackson commented 3 years ago

So the integer control doesn't enforce min or max if there are options defined, precisely because some options can fall outside the range.

Ok, so you mean that there is really no problem here? I understood from the reports on the forum that if options are provided, and limit to options is false, and we have an INTEGER, then only the options may be selected? Do I understand that you are saying that isn't the case and in fact people can enter any number and the only issue is it doesn't enforce the min and max?

If so, I'm not sure what is meant when you said -:

The combination of type: INTEGER, limitToOptions: false and options defined is not supported by the config parameter control at the moment.

Unfortunately I can't easily test anything at the moment as I'm locked in a quarantine hotel in New Zealand with most of my equipment currently sitting in Singapore. I've just had a few reports of problems, so raised this issue based on your comment on the forum. If there's no issue, then I'm happy to close this.

ghys commented 3 years ago

Do I understand that you are saying that isn't the case and in fact people can enter any number and the only issue is it doesn't enforce the min and max?

Yes, I believe so - from reading the forum (https://community.openhab.org/t/zwave-oh3-config-parameters/119789/20) I believe it was just a matter of "why don't I see the options" rather than "I can't configure this parameter". I was not clear enough when I said "it's not supported", I meant it's just not displayed optimally.

I'm locked in a quarantine hotel in New Zealand with most of my equipment currently sitting in Singapore

Good luck! I made an visa-exemption for NZ just before the pandemic to visit as a tourist, it's valid for 2 years and I'm not even sure I'll be able to use it before it expires ;)

cdjackson commented 3 years ago

Ok, I understood differently. The original post states that ONLY the options are provided -:

image

Here we see that there is only the Disable option and not the ability to set a value. Maybe I should step back and let others raise this as I'm unable to test.

If you get down to NZ, look me up - I'm in Auckland and I'll buy you a beer :)

ghys commented 3 years ago

According https://community.openhab.org/t/zwave-oh3-config-parameters/119789/13 the problem is resolved and was likely a limitToOptions incorrectly set to true in the database.

ghys commented 3 years ago

Looks like it was indeed changed recently: https://github.com/openhab/org.openhab.binding.zwave/pull/1552/files#diff-0d72b662baf9bcf0f12eb7aedd13ba02b014bd71fd6720042fce83e97ef24170

cdjackson commented 3 years ago

When the issue was first opened the user was using an old version, so I guess anything could be wrong. I interpreted you comment as it simply not being supported but if that’s not the case then let’s close and put it down to ancient gremlins :)

Sent from my iPhone

On 2 Apr 2021, at 13:50, Yannick Schaus @.***> wrote:

 According https://community.openhab.org/t/zwave-oh3-config-parameters/119789/13 the problem is resolved and was likely a limitToOptions incorrectly set to true in the database.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ghys commented 3 years ago

Glad it's not as severe as it seemed - but the validation conflict between min/max and options was real (I tracked it down to https://github.com/openhab/openhab-webui/issues/459) and addressed in late October - I mentioned it was a "niche case" but not so much. I'll leave the issue open though as it would be nice to have both the list of options and a "enter your own value" text box.

thesebastianf commented 3 years ago

are you sure? @ghys @cdjackson

According https://community.openhab.org/t/zwave-oh3-config-parameters/119789/13 the problem is resolved and was likely a limitToOptions incorrectly set to true in the database.

this part of the thread you quote (post 12) is actually earlier then the issue reported here. If you read it in chronological order the issue here is described comes a few posts later. (post 20) It is also inverted to what you describe here. If a thing has OPTIONS and "limit to options" is set to false the UI does not show the options.

you can see it in Post #20 https://community.openhab.org/t/zwave-oh3-config-parameters/119789/20 the UI should show a Option and allow to type a value. It does not show the option. This is still the case and an active issue as far as I can see it on my end.

bwosborne2 commented 3 years ago

To add to that @ghys admitted to it not yet supported here.

https://community.openhab.org/t/zwave-oh3-config-parameters/119789/22

ghys commented 3 years ago

The problem is resolved for that particular device where it was impossible to set an arbitrary value because limitToOptions was set to true.

The fact that the UI does not show the options when limitToOptions is set to false is the reason why this issue is still open, which I believe was clear in my last post.