How do you combine both On/Off and Dimming for an Item and Alexa?

  • Platform information:
    • Hardware: RPI3
    • Raspian
    • openHAB version: 2.3.0-1

Item defined as a dimmer, Alexa can dim the light up and down without a problem but when you tell her to turn the light off she sends a 0 and when you tell her to turn the light on she sends a 100. The problem with this is the prior dim level isn’t maintained and the light always comes on at 100%.

Alternatively I can configure the dimmer as a switch in which case Alexa will send either an On or Off to the dimmer. In this case, the prior dim level is maintained (which is great) but she can’t dim the light.

Here are the two item configurations I tried. Both work, but as I stated above the first one Dims correctly but doesn’t allow for On/Off and the second one Send On/Off but won’t dim.

Dimmer FR_Light_D “Family Room Light Dimmer” [“Lighting”] {channel=“zwave:device:8fa1ae60:node3:switch_dimmer”}

Switch FR_Light_S “Family Room Light Switch” [“Lighting”] {channel=“zwave:device:8fa1ae60:node3:switch_dimmer”}

You can have more than one itemtype linked to the same channel. So just use both at the same time and differentiate with the label (as already done).

That is how I have it configured now as I was going thought troubleshooting but I’m not sure of that is the right way to do it.

You would have to say:

“Alexa, Dim Family Room Light Dimmer to 50%” to dim the light and
“Alexa, Turn Off the Family Room Light Switch” to turn off the light.

You should be able to use the On/Off and Dimming commands with the same item.

Is anyone able to help with this? Seems straight forward but I can’t find and answer.

Just want to figure out how to configure a dimmer so when Alexa sends an Off or On its an actual Off and On and not a 0 or 100.

Thanks

Unless I am mistaken, Only way is to have the item configured as a switch. This is how the openHAB connector was written for alexa. You could post a request over on the connectors git page and see if they can add this.

I would love to do this also, my only way has been to have two items.

Turning out to me a nightmare of research for something that should be basic.

If you configure the light as a dimmer, Alexa sends and On/Off and the prior Level is maintained, but as I said, Alexa won’t accept “set level” commands.

If you configure the light as a dimmer, Alexa can set levels and turn the Light On/Off but she sends 100 and 0 for the On and Off so you loose the prior dim level.

It’s as if the Dimmer functionality isn’t correct. Dimmer’s accept On/Off commands so not sure why it would be sending a 100 and a 0 .

Maybe a rule could be written. Have Alexa control a proxy item. When you command alexa to turn the item on you could then use a rule to send 'On" to the real item if the proxy receive 100.

The proxy item label that is exposed to alexa could be named as if it were the real item. I am fairly certain this method would work. The only downside would be you could never use alexa to command the light to 100, but you could get to 99.

***Note this is only pseudo code.

rule "use alexa to send on"
when item proxy_item changes

if proxy_item command = 100 then send command On to real_item
if proxy_item command = 0 then send command Off to real_item

end

That should work as a workaround but what I’m trying to determine is if there’s a bug or if I’m just doing something wrong with the item configuration. The dimmers and bulbs, zwave and zigbee, I use all accept Off an On commands, think they are all designed this way, so why is OpenHAB converting Off commands to 0 and On commands to 100.

Thanks

@holmes.j not sure if you’ve been in the community lately but I saw your post on DimWit and figured you be able to help me understand. Basically I can’t get my Dimmers to respond properly to Off and On commands coming in via Hue Emulation or Alexa Skill.

When the Item is configured as a Dimmer, the Off command is converted to a 0 and the On command to a 100 rather than just sending the Off/On commands directly to the Dimmer.

If you configure the Item as a Switch the On/Off commands are sent directly through to the item, which is great, but since the item is now configured as a Switch it won’t except dim level commands.

I realize you could configure a workaround for this but why but before I head down that path I want to confirm I’m not missing something. Everything I’ve ready says Dimmer Items should accept Off/On commands.

Thanks!

I have a different experience from you and the one I think you want.

I have Hue light bulbs and if I set them to 15% they dim to 15%
if II say turn off they dim to 0% and if I ask for them to be turned on they return to the last brightness state so 15% in this case.

I think this is what you are after, please confirm.
If it is I will grab all the bits I have and you can see if somehow I have some magic or yours behave differently.

Regards

Paul

I haven’t been around much. I’m near the tail end of a large remodel (7 months) and have been out of the house the entire time. Openhab and everything has been torn down so I won’t be much help until I move back in.

Looking at the code, I would respond to on/off taps with the value that I wanted it to be, not On/Off. So doesn’t sound like that will help you too much. Hopefully @idkpmiller has something that can help you!

Assuming that the behaviour I have is what you are after here is what I have setup for one light, in this case its the master bedroom.

On Alexa:
Skills: Openhab, Hue

Smarthome => Group => Bedroom
this contains the device BR1Light which is a dimmable device

Smarthome => Device => BR1Light Dimmable light
Smarthome => Device => Brightness Dimmer BR1Light_Brightness Lighting via openHAB

I basically try to set up that I use Alexa for real time voice interaction with devices and Openhab is aware. And the scheduled event driven interactions are performed from OH, as well as Web and Mobile UI.

On Openhab
I have the following configured
Bindings: Hue

Things (PaperUI)
BR1Light Brightness a dimmqable light

items (PaperUI)
Dimmer BR1Light_Brightness

Sitemap

			Slider item=BR1Light_Brightness label="Ceiling [%.0f]" icon="light"
			Switch item=BR1Light_Brightness label="Ceiling"

I think thats it.

Regards

Paul

Thanks for getting back. Congratulations on the remodel (and being close to completed)! I have a feeling the place is going to look incredible.

Hi Paul - thank you for jumping in. I tried your suggestion, learned more and now able to better describe what I’m seeing:

  • Dimmer Items accept the ON and OFF command then sends either a 100 or 0 to the Thing via its Dimmer Channel. This appears to be the case regardless of UI (BasicUI, Panel, Alexa) or the Thing (Hue, Zigbee, Z-wave).

  • Switch Items accept the ON and OFF command and then send ON or OFF to the Thing via its Dimmer Channel. The great thing about this is the dim level of the Thing isn’t changed.

So if Dimmer Things accept ON and Off commands, why have the Dimmer Item convert the these commands to a dim level of 100 or 0?

Seems like having the Dimmer Item send an ON / OFF through to the Item makes more sense.

Thought?

Thanks

I am trying to understand what is driving the need to use ON and Off commands rather than 0 and 100 brightness if the outcome is the same?

Two things come to mind,

  1. although the luminance may be the same is the power consumption? is a relay set to OFF the same as a dimmer set to 0%, perhaps a hardware expert can advise.
  2. Another that came to mind is that the controller dictates the return to past brightness level not the element sending the update. In my case there are three controllers in play, Hue bridge, Alexa Skill, OH2 Binding. It is not clear to me why this is a OH discussion as such. most of the behaviour is between Alexa and the device controller and nothing to do with OH at all.

I am currently happy with the way my lights return to the last brightness settings, although it means I must remember when I am in the bedroom and have the lights on full to dim them to say 15% before requesting them to be switched off so that if they are put on during the wee hours they return to a reasonable level and do not cause difficulties with the brightness.

Incidentally the group setup on Alexa per room also contains the thermostat elements so she can tell me the temperature and set target for each room. I find the integration with Alexa much better than my Siri, Google Home and Cortana integration which all have annoying nuances that I have to work around.

Thanks

Paul

On my setup my zwave dimmer is restored to it’s last value when I tell Alexa to turn the lamp on. Both of my dimmers have an option on the PaperUI thing’s DImmer channel to “Restore Last Value” which I have turned on.

Please note though that this doesn’t seem to get reported properly to openhab. For example, I have a Lamp dimmed to 20% when I turn it off. If I say to Alexa “Alexa, Lamp on”, the lamp will come on dimmed to 20%. The openhab event log will show “Light_Lamp changed from 0 to 100” and the app and PaperUI Control screen will initially indicate the lamp is set to 100%. They will show the correct value when the item eventually updates.

So, what you’re looking to do seems to be controlled by the thing. At least in my case.

Hope this helps.

Hi Paul,

I feel the its a workable situation but really think something is off (no pun intended). Like I was saying, why would openHAB take an OFF command and change it to a 0 when the device supports and OFF. There are a bunch of reasons why an OFF and an ON are very different from a 0 and a 100.

I’ll give you a couple examples, out of many, that come to mind:

  • If I use openHAB to turn off the Family Room Light (send it a dim level of 0) when someone walks into the room and turns the light on via the dimmer switch nothing appears to happen. The actual led on the dimmer goes out because the light actually comes on but its dimming level is 0. Can we program and send around this, sure, by why bother with all that when the capability is already designed into the dimmer simply by using a true OFF and ON command.

  • One way to get around some of this is by configuring a Dimmer and a Switch for the Device. What’s great is the Switch does send a true OFF and ON to the device, but can’t dim the light. The problem here is with the when using Alexa, you have to remember to tell her to use the switch (Alexa, turn off/on the Family Room Light Switch) and the dimmer (Alexa, dim the Family Room Light Dimmer to 25). Can we configure and this, absolutely, but why bother when a single dimmer item that sends true OFF/ON commands to the device would have worked.

The great thing is, enabling the dimmer to send true ON/OFF commands takes nothing away from the ability to do all the things people are doing with dimmers, it only eliminates a bunch of unnecessary workarounds required when all you want to do is turn a light Off and On.

All the home automation solutions I’ve tried (SmartThings, Wink, Vera, HASS) send OFF/ON commands directly to the device so I can’t help but think I’m just missing something in openHAB with the configuration of the Binding, Thing, Channel or Item. I really hope to figure this out as openHAB is by far the best home automation platform (for me) out of everything I’ve tried.

FWIW, I have 62 dimmers/dimmable bulbs and 9 ceiling fans.

Thanks Again for all your and everyone’s feedback and advice.

1 Like

There’s an open PR that addresses this issue, I believe. It looks like it got caught up in review and forgotten about. You might want to ping over there and see if someone can get it merged.

I had the same problem. It’s too late but here is one solution if someone hits this page searching for a hint to resolve.

In Alexa app make a group “Family Room Light” and add following …
Family Room Light Dimmer
Family Room Light Switch

Now you can say " Alexa, Turn ON Family Room Light"
“Alexa, set Family Room Ligh to 40”

What I believe the ‘correct’ way is to ONLY tag the dimmer channel (or color if it is a colored light) with “Lighting” and to call it the name of the light like “Family Room”. Do not tag the switch as the dimmer should handle both.

I have written bindings for lights from scratch and if it does not work then it is IMHO the fault of the binding not correctly handling ON OFF and PERCENT commands on the channel.

Alexa/google home should only see a single light called “Family Room” and you should be able to say:

Turn “Family Room” On
Change “Family Room” to 50% brightness

If that does not work then it should be raised as an issue as Jason posted about above. I don’t use the bindings mentioned to know if this is an issue still or not (old thread), but don’t accept it if it is, create an issue on GitHub.

Any other “solution” is a work around hack and not the correct way to move Openhab forward. The standard is that a channel should handle both and if the code is missing to handle both then it needs to be added. As mentioned I have no idea if this is even an issue still as I don’t use the binding. Often old posts like this are no longer relevant.

Thanks for posting a band aid solution if there is an issue, it is great to know how to work around it, but please create a issue on GitHub (if there is an issue) so it does not drag on and not get fixed.

1 Like