zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
920 stars 196 forks source link

Indicate Value min/max/step values in the UI #3789

Open kpine opened 2 days ago

kpine commented 2 days ago

Is your feature request related to a problem? Please describe. The UI for the Values doesn't show min / max and step restrictiosn. If you set a value outside of the range, the command will report an error.

Describe the solution you'd like Indicate min / max and step in the UI next to the Value somewhere. Or validate the value client side before allowing it to be sent (but I might want to force an invalid value for some debug purpose?). Or do this for select Values, like wake up interval.

Describe alternatives you've considered N/A

Additional context I was setting the wake up interval for a battery device (ZSE41). I usually use 7 days (604,800 seconds), most of my devices all this. I tried with a Zooz and got an error flash in the UI. When I checked the value it was set to 86400 seconds instead.

I checked the node dump and it lists a min and max value, for this device, as well as a step value of 60 seconds. 7 days is out of range (so would non-multiples of 60). It would be preferable to know this prior to setting an invalid value.

    {
      "id": "60-132-0-wakeUpInterval",
      "nodeId": 60,
      "toUpdate": false,
      "commandClass": 132,
      "commandClassName": "Wake Up",
      "endpoint": 0,
      "property": "wakeUpInterval",
      "propertyName": "wakeUpInterval",
      "type": "number",
      "readable": false,
      "writeable": true,
      "label": "wakeUpInterval (property)",
      "default": 43200,
      "stateless": false,
      "commandClassVersion": 2,
      "min": 3600,
      "max": 86400,
      "step": 60,
      "list": false,
      "value": 86400,
      "lastUpdate": 1719774741980,
      "newValue": 604800
    },
robertsLando commented 20 hours ago

@kpine I was going to implement this but I noticed that some values already report this in the hint. It could be a bit redundant in such cases.

Suggestions? cc @AlCalzone

2024-07-02_18-02

AlCalzone commented 19 hours ago

Those hints you mention exist only for configuration parameters, and they should only exist in cases that cannot be modeled with min/max/step, e.g. in the case here with one value outside the "normal" range. Respecting the min/max/step where they exist is a good idea in general.

robertsLando commented 3 hours ago

Respecting the min/max/step where they exist is a good idea in general.

I already respect them on UI the problem here is that actually I don't show them. My idea was to add it to the hint but then I saw some hints already have them so I was wondering what's the best choice here

Ref: https://github.com/zwave-js/zwave-js-ui/blob/40080a17ee730611bd3c89e04e10ad82bac60eec/src/components/ValueId.vue#L55-L58

What I only miss here is step that I wasn't aware it existed. I can add it but the question remains open for min/max value, should I show them? If yes where?