How to get a switch toggle on a lamp that exposes only a "brightness" slider to the Model

Lamps usually have a Power point/child with a switch widget I can toggle. On the Lamp equipment parent group, I can have a power on/off switch by setting the following:

Metadata > Default Standalone Widget > oh-toggle-card > Power child

Now I have this one “INNR” branded lamp that does not have a “power” toggle.

In my Model, this Lamp equipment group only has a Brightness point slider. The Brightness goes from 0 to 100, and setting it to 0 makes the lamp turn off.

What is a good way of getting a Switch toggle for this slider? I have tried the same as described above for the other lamp, but then the Switch only works for turning the lamp off. I cannot turn it on again using the same Switch.

I would create 2 items: One for the switch snd one to store the brightness level. Then create a rule and whenever the switch is turned off, save the current brightness level in the dummy item and send 0 to the brightness level. When the switch turns on, just send the last stored value to the brightness channel

You can link a switch item directly to a dimmer channel:


When you do this the switch toggles the dimmer between Off and whatever the previous level was.

So, just add an additional switch item linked to your lamp’s brightness channel and then select that switch item as the target of your oh-toggle-card.

2 Likes

That’s definitely the better solution!

That’s easier than I thought! Thank you for sharing. I appreciate the screenshot.

Interestingly, the method described in my question now also works. The problem described (quoted below) no longer occurs after linking a switch, even though that seems unrelated. I don’t know if it was a fluke or if there is a logical reason why it wouldn’t work before but now it does.

I have tried the same as described above for the other lamp, but then the Switch only works for turning the lamp off. I cannot turn it on again using the same Switch.

Either way, I like your method because it is cleaner. I can’t believe I didn’t try this myself. Perhaps I was too focused on the “create equipment from thing” defaults.