Hue Emulation: Behavior of One Item for Dimmer and Switch

I have tried using a single Dimmer item exposed with Hue emulation that functions as both a light dimmer and a switch. The problem is that sending ON to a Dimmer forces the lights to 100%. I understand the underlying reason why, but it’s a problem with voice command simplicity.

I want to be able to say both “Alexa, turn the living room lights on” or “Alexa, set living room lights to 50%”. However, I want ON to function like it was mapped to a Switch and simply turn on the lights to the value they had when they were turned OFF (through OH, not electrically).

To make something work for now, I have two proxy items set up:

Switch    SW_LivingRoom_OnOff     "Living Room Lights"    ["Switchable"]
Dimmer    DM_LivingRoom_Level     "Living Room Dimmer"    ["Switchable"]

Using two different voice commands for this seems counterintuitive, and I’m told has a very low WAF :wink: Anybody have ideas on a way to accomplish this? I wrote a rule to intercept command value 100% from a proxy item, and then send ON to the Switch group, but then I can’t ever set the lights to actually be 100%. Asking my wife to say 99% isn’t going to happen.

Proxy the Switch. So when the user says “Turn on the lights” the proxy switch triggers a rule which looks up the last dimmer value and sends the device a dimmer command rather than ON.

Thanks for the reply, @rlkoshak. My post was poorly worded, and as it turns out, the brightness being set to 100 is happening in the hue emulation itself.

Alexa sends {on: true, bri: -1} when you turn something “on”. Hue emulation assumes 100% brightness in this case. If the item linked to Alexa is just a switch it receives a true ON because it can’t accept a number. If the linked item is a dimmer it receives 100 for the simple on toggle.

I don’t think there’s a way for the emulation to know what I want it to do, which would be to look up the previous state, as you suggest, and return that brightness instead of 100. Alternatively, it could be modified to accept two items (switch + dimmer) with the same label as a “group” of sorts, and be smart enough to send the command to the appropriate member.

@digitaldan Does this enhancement sound useful for the hue emulation, or am I totally missing something?

I think you can still do it.

Create a proxy Dimmer Item which gets connected to the Hue Emulation but is not bound to the actual bulb.

Create a “real” Dimmer bound to the Hue bulb in question. This Item does not get exposed to Hue emulation.

The Rule receives the commands from the Proxy Item and if the Proxy Item’s new state is 100 and the “real” Item’s state is 0 (i.e. OFF) then send the last dimmer value to the bulb. Otherwise the bulb is already ON so treat this as an adjustment and send the 100.

This way if the bulb is OFF and you tell Alexa ON the rule will know to not forward the 100 and use the last dimmer value. If the bulb is already ON it knows someone said Alexa 100 (or Alexa ON again).

Wow, that totally makes sense. I didn’t even consider checking the current state to determine the context. Thank you very much!