domoticz/Reacticz

Dimmer widget needs a On/Off button

Closed this issue · 14 comments

t0mg commented

From @davidlb on February 13, 2017 15:42

For the moment, the dimmer widget is not fully working:

  • if in Domoticz, the dimmer is set to Off, the value in Reacticz is set to 0 and Off but after if in Domoticz, the dimmer is turned On, nothing happens in Reacticz
  • it should be possible to turn On/Off in Reacticz without changing the value of the dimmer

device.nvalue has 3 possible values:

It's not really difficult to fix it but I'm not inspired how to change widget layout to manage on/off for a good user experience

Copied from original issue: t0mg/reacticz#85

t0mg commented

From a technical point of view, on/off and dimmer value are indeed two separate things.
But in the physical world, not so much. A light bulb cannot be off and at max dimmer level at the same time, or on and at zero (arguably, there is a small difference here depending on your dimmer type).

So I agree we're not in a prefect situation but I really want to keep the layout as clean and simple as possible, and just like you I'm not very inspired. Maybe double-tap for on/off toggle ?

t0mg commented

From @davidlb on February 13, 2017 16:46

In fact, I use it for sound level and so on/off for mute.
I already tried double click but I'm not very satisfied yet. I'll try other things tonight :)

t0mg commented

Ah, bummer. Maybe long-press then? (hint: on mobile, listen to mousedown event to easily detect a long press - the proper way to do it would be with a timeout on touchstart though)

Otherwise maybe something that looks roughly like the RGBW switch. On the left, a square shape for on/off toggle, on the right an extensible area for the dimmer. When the widget is in default size (2x1 like all widgets in reacticz) it would look like a domino piece, with two squares of equal size, so the dimmer part is very tiny, probably not very usable. When resized to the smallest possible size, it's only on/off toggle. And when made wider, only the dimmer part grows to fit.

t0mg commented

From @gerard33 on February 13, 2017 23:1

Maybe this is an option as well?
Putt the on/off button on top of the dimmer. The dimmer keeps the same width so it can be used in a small widget as well.
The height of the dimmer and on/off button can be aligned just as a selector switch.
See the picture below (quickly made this, so the text aligning of the dimmer is not as it should be ;) ).

dimmer_button

t0mg commented

I think that I can make it like the new RGBW widget now, with a mini mode where it's only a toggle, and a normal mode where it's a toggle on the left + a dimmer on the right.

t0mg commented

From @felix63 on February 19, 2017 19:19

Funny.. I just saw the new RGBW widget and was about to suggest to use the exact same concept in this case. Only to find that you already came to the same conclusion! It would certainly contribute to consistency in the UI.

Keep up the good work!

t0mg commented

From @gerard33 on February 20, 2017 20:55

This new widgets looks good :)
Still some issues however

  • when clicking the on button, the dimmer is not set (from Reacticz and also from Domoticz) --> this is due to the svalue1 of the MQTT being 0. The JSON route for this one as well?
  • clicking on the left of the dimmer part is still switching to off in stead of a low dim value

I also see some strange behaviour in switches (not only the dimmer) added by the Python plugin.
It seems that those switches do not send MQTT messages when the value is changed (so has nothing to do with Reacticz). I will have a look at that.

t0mg commented

Thanks for testing @gerard33, I knew it wasn't over yet (which is why I didn't close the issue ;)). I'll look into it.

t0mg commented

@gerard33 commit 98ddfce should fix your second point (hard to set low dim value).

Regarding the first point, I don't think I want to change the current behavior. It's true that the dimmer isn't set but at least this way we return to the value that was previously set before turning off the lamp (at least with Hue). I don't know of any way to know what the value was before switching off so I can't request it explicitly when switching back on...

This issue:

if in Domoticz, the dimmer is set to Off, the value in Reacticz is set to 0 and Off but after if in Domoticz, the dimmer is turned On, nothing happens in Reacticz

Should be fixed by domoticz/domoticz#1906

t0mg commented

Thanks for the heads up @emontnemery and for fixing the issue in domoticz! I also agree that the -1 thing discussed in your PR is weird, I'd be glad to update Reacticz if this is gets fixed in domoticz.

@t0mg The decrement of dimlevel is now fixed in domoticz through domoticz/domoticz#1921

t0mg commented

Thanks @emontnemery so I'll remove the +1 when sending the command, and make sure a value of -1 doesn't break the widget. Anything else I'm forgetting ? Maybe reflect the -1 value on the UI somehow (not sure how though) ?

@t0mg -1 value is only used internally by Domoticz, it should not be visible through http JSON API or in domoticz/out message.

Edit: Updated domoticz/domoticz#1921 to better reflect what was implemented.