Hubitat Virtual Dimmer Buttons

Hi all,

I’m new to SharpTools and am trying to create my first Dashboard for my Nursery, so I apologize in advance if I’m asking stupid questions!

My home automation is via Hubitat and I have the SharpTools app installed and can see Hubitat devices, but what I’m struggling with is how to do what I want - I might very well be asking too much here, but hopefully it can be done.

My nursery has Philips Hue bulbs in the lights. The colour is set automatically by the Hubitat throughout the day, that works fine. What I want to be able to do it SharpTools is control the level of the bulbs at preset levels. I initially tried creating a virtual button with 7 physical buttons (off, night, 10%, 25%, 50%, 75%, 100%), then realized SharpTools doesn’t support Hubitat Virtual Buttons. OK, I can replace the virtual button with a series of momentary Virtual Switches, no problem.

The problem is, what I’d like to do, is have 7 tiles in a column on the dashboard, one for each level (night is a special case when all but one bulb is switched off), I’d like the level percentage to be set to be displayed on the tile (so I suppose I want either an icon or centered label) and I want the background of the tile to bit lit (in the Hue color) if the level is at or above that tile’s percentage. So, for example, if the level is 50%, the night, 10%, 25% and 50% tiles should be lit.

So, the question is, how to do this? Can I set the background colour of a tile from one “thing” with the button being linked to another “thing”? Can I turn the background on and off using a variable? Can I stack tiles on top of each other to achieve the effect (a tile linked to the bulb at the back, a blank tile thats either transparent or black depending on the level, then the switch tile on top of that)?

I know all this is convoluted (to say the least) but hopefully you folks have some suggestions as I know lots can be done with SharpTools.

Thanks!

Paul

You might be able to use true/false variables for each range and a rule to determine which one should be true and the rest should be false. That just gives you the highlighted state part… so then you would create a rule for each dim level and use the hyperlink action on the variable to run the respective rule to set the level.

Probably quite a bit of configuration, but it’s the solution that came to mind. You could probably also do something with virtual switches and the Rule Machine built into Hubitat if that’s more your jam.

@James and @josh it would be cool if we could pass data to a rule when using the special hyperlink syntax.

2 Likes

Thanks @Chris_C for the variable idea. Yes, creating variables for each level range and a rule to set the specific one to True, and others to false based on the level reading. However, the highlight won’t be based on the Hue color of the physical bulbs. The only thing I can think of is probably to create simulated RGBW bulbs for each level range. One rule to turn the specific RGBW bulb on and set the Hue color. See below quick example how to set Hue color based on another bulb’s Hue change.

And maybe add the custom css to hide the level reading for these simulated RGBW bulbs, and add a NUMBER variable to the dashboard and a rule to sync the Hub bulb’s level to this NUMBER variable to so you can the current level reading.

That being said, it does have several parts to be configured though.

Thank you all for the suggestions. So, I have part of it implemented, but I’m struggling with the rest…

I have virtual RGBW bulbs created on the Hubitat with rules that turn them on an off depending on the level - that is all working fine. They are also set to the correct colour.

I tried adding tiles based on those bulbs as Things in SharpTools, and if I have Display Color As set to Icon Glow, it works in that the background in lit when the virtual bulb is on, but dark when its not. However when I switch it Display Color As to Tile Background, its lit up whether the virtual bulb is on or off.

So, for display purposes, what I’m missing is still how to get the background lit with the correct colour when the bulb is on, or dark when the bulb is off.

I have virtual momentary switches set up on the hubitat which I would use to change the level, but I’m not sure how to “press” those switches. If I just use the virtual RGBW bulbs to signal to the Hubitat, I suspect I’m going to end up in a loop if the level is changed by other means (e.g. through the Hue app or Google Home). i.e. the level of the physical bulb changes, so the rule on the Hubitat changes the levels of the virtual bulbs, which would trigger the Hubitat to change the physical bulb level and around we go…

Sorry for the multiple replies, but one more quick question - I assume it is not possible to stack / overlay tiles in SharpTools? I know this can be done by editing the code manually in the Hubitat dashboard, but I don’t see a way to do that with SharpTools, but of course I might well be missing something!

Did you apply custom style or theme style to these tiles with the specific tile background color? So the color might be shown because of the style, instead of the state?

What if you add an IF condition to check if the simulated and physical devices’ level are different first and only set the level value if they are different to prevent them keep setting the same value and loop?

Correct, stacking/overlaying tiles is not currently support in SharpTools.

I have tried both and it doesn’t seem to make a difference. If Display Color As is set to Tile Background, the background color is the bulb color whether the bulb is on or off. If I set it to Icon Background for example, the icon background is always the bulb color whether the bulb is on or off, but the tile background does change with the state.

Actually, on a little more investigation, it seems that Icon Glow follows the state, but Tile Background and Icon Background do not.