Homey Community Forum

Retrieving DIM values

I’ll start this question with some background info:

I have a couple of z-wave lights hanging over my dinertable in the living. These things can be dimmed and/or switched from Homey. Primarily, they are controlled from a couple of flows that make up scenes where we can switch between “Diner”, “Evening”, “To bed” and so on. These switch the lights on or off.

Secondly, I have an old tablet hanging on the wall that I run a homey.ink based dashboard on. It allows to switch between these scenes through a couple of virtual switches but also provides the original switches for the lights so that my wife can easily switch 'm on or off without using the physical switches on the wall. She found out that she can control the dim function from these lights by long pressing the button of each light at which time a slider appears. So far so good.

However. I also have a spare KAKU remote control laying around, gathering dust. So , just for the heck of it, I hooked it up to Homey - works like a charm! Now, the wife wanted it to control the lights over the dinertable too, and that’s where the problems start.

So, I built the following flow:

When the lights are off, they are switched on. If they already were on, it increases brightness. Great!

However… the counterpart is not so great (don’t mind the “and” card in there, it doesn’t do anything useful now):


I would have liked to decrease the brightness on this button when the lights are over 20% brightness and switch 'm off when they drop below 20%. Ideally, the flow would read: “If dimvalue > 20%” then “set relative dim level -20%” else “switch off”.

Here’s the caveat: that “if dim value” card does not exist. Without it, the lights will dim to 0%, but that is not the same as “off” (the switches on the tablet that are connected to the raw lights stay active when dimmed to 0% !).

I know I can add a variable to keep track on the dim level, but that would just mimic the real value and is bound to fail at some point (for example: when loosing contact with the lights when somebody inadvertently touches the physical switches…).

So, is there a way to read the dim level after all? Or a foolproof workaround?

The test you want is in the logic cards, you just need to select the dim level label from the dinner table lamp: But isn’t setting a dim value 0 equal to off? or is a relative set never below 1%?

According to Athom’s coding guidelines regarding lights, dimming to 0% should turn off the light. But this is not handled automatically. The app has to implement this behaviour.

Thanks guys, that logic card did the trick. :+1:
Two remarks:

  1. Dim level is not in percents, it has a range 0…1, thus testing needs to be “less than 0.21”
  2. The lights are Domitech. The plugin switches off the lights when the dim level is set to 0, but the accompanying “onoff” does not return to false. I observed this in the developer > devices panel. Should it change the onoff capability too? Because that obviously is the trigger to control the on/off switches with…

Hi @Joost_Else,
in regards to

  1. 0.0-1.0 actually is percentage in means of software. so 0.21 means 21%.
  2. According to the development guidelines (you can check them here: App Development Guidelines - Homey Apps SDK v2 Documentation) a lights app should handle this. So yes, it is intented that lights being dimmed to 0% should actually turn off. But this is in the responsibility of the app / the app developer. Not all light apps might be implemented according to that guideline.