-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] UI for a dimming duration shows "[object Object]" #185
Comments
@LordMike Uh never saw this! I think it comes from last updates? I have durations values too but them were not showed in that way on ui. @AlCalzone Breaking change from 6.0.0? |
Nothing changed in that regard. |
Basically you need to select/edit both the value (0-127) and the unit (minutes/seconds) |
Humm I think I need to parse it in a different way. When I set it should I pass a Duration on the setValue too? |
Probably, but you cannot set the duration yet. zwave-js/node-zwave-js#1321 |
@AlCalzone Just to knnow but wouldn't a |
good point. I've treated |
@LordMike So keep this open until the support is available on zwave-js |
My 0.02$ would be not to make the available types more complex than primitives. So I wouldn't add a "duration-with-minute-and-seconds" type, that supports "minutes" and "seconds", only to add one that also supports "hours" later when a device comes along supporting that. I would do one of two things:
|
How would you configure a value of 127 seconds with that approach? |
"127s" or "2m7s" .. both are identical. The tricky part (for you) is distilling that down to a value that z-wave can work with, and abiding by any limitations by the device. You obviously can't send that as a z-wave value, in anything but seconds. If you were to send it as minutes, the best you could do was "120s" (2 minutes).. I don't imagine the message supports floats :) |
I'm wondering if that is intuitive that you can set 2m7s but not 2m8s (which cannot be represented and AFAIK all durations have the same encoding). |
If they're all in the low end or represented by seconds, why not just skip the unit and go with a "number" ? I imagine validation comes naturally for numbers, with the min/max values. Ooh, the 128..255 values are then minutes? If so, the seconds can still work, but validation will be trickier. You could simply log an error and not send the message, if a user puts in 179 seconds, instead of a valid value of 180 seconds. |
Yep that is the tricky part. When setting a duration: So just using a number won't work (well it will, but it is suuuuper unintuitive). I kinda like going with a hybrid approach:
Devs can then decide whether they need to work with timespan strings, value+unit objects or the original Duration object. |
Will all Durations be like that?... Like all ? I would be worried that suddenly a device comes along, which operates in increments of 10s. So one third way is simply to expose the 0..255 value. :) Additional metadata / functions could then help users in translating between timespans, Durations, or something else entirely. Anyhoo, if it's always minutes and seconds, it's probably fine. Let's hope a |
I don't like exposing values which need additional interpretation. The aim of a library is to abstract away the ugly details (or at least make them intuitive to work with). I think we're on a good way with the additions to Duration. |
I think that Duration value is good, I just think that the type should be |
* fix: duration type handling Fixes #185 * fix: handle writes * feat: allow to choose custom duration * fix: lint errors * fix: merge issues
Version
Build/Run method
zwavejs2mqtt version: v1.0.0-alpha.2
Describe the bug
A wall switch with built in dimmer (ZDB5100 Matrix) has a multilevel switch section in ZJS2M. In the UI, the duration parameter shows up as
[object Object]
. In thegetNodes
json, I see that the value of this field is:The UI probably doesn't handle the value+unit combo very well. :)
To Reproduce
N/A
Expected behavior
A dropdown or selector (maybe?) for value+unit... I expect only the value is settable, so maybe just display the unit next to the input box?
Additional context
Screenshot of the UI with the JS object outputted:
The text was updated successfully, but these errors were encountered: