Objective:
Push the button to toggle a smart bulb between dim and bright
A quick definition of variables for clarity Button UtilityRoom is the name of the Smartthings button UT0 is the name of the smart bulb __ut0_state is the name of a virtual switch (you will need to create one to match your bulb)
Rule 2 simulates pushing the button again 30s after the first push. For my use case I only wanted the light to be bright long enough for me to find something is the freezer. As a bonus it also so serves as a reminder to hurry up and close the freezer door
You could also use a local Boolean variable to track button pushes/ state and replace __ut0_state with it instead and then skip creating Rule 2. In this case On=true
i.e Change On: __ut0_state to Set localVar to true
You can also just use the RM function of Toggle Brightness. That will toggle the light between the brightness you set and off whenever the button is pressed. Gets the exact same functionality in a one line rule.
Perhaps, I hadn't really thought about it like that. When I "dim" I'm also lowering the bulb's color temp from 4000 to 2700 not just changing its intensity. Using a scene seemed easier than manually tweaking the bulbs parameters.
I see that now. Can't say it was one I've noticed before. I've played with dimmer levels when writings rules for a motion sensor, but haven't experimented with the toggle options. Thanks for the heads up
Doesn't yield the same results. Yes, it toggles the bulb between on/off but NOT from dim to bright like a 3-way bulb.
The objective was to go from dim to bight not on/off. This particular light is normally always on as a nightlight. My utility room is normally rather dark even during the day
Trigger: St Button pressed
Action:
IF Light is off THEN
Set Light to Level X
If Light is 0< level <= X THEN
Set light to Y
IF Light level is Y<Level <=98 THEN
Set Level to 100
IF Level >=99 THEN
Turn Light off
END-IF
I don't get the use of the scenes and the complexity you have. This is a lot simpler and easier to implement.
Didn't think it was really that complex. It operates exactly as I intended.
Tap the button once the light goes bright
Tap the button again or wait 30 seconds and the the light goes dim.
Double-tap to turn the light off. A single-tap turns it on again
Note, it rarely gets turned off so I kept it out of the "push" loop. Just tap to toggle back and forth between dim and bright. The version of Rule 1 above is actually a simplified version of the one I'm actually running. The light also turns red when HSM is in Armed-Night mode. (outside the scope of the button presses) Tap the button and it will go bright. tap again it goes back to red. The light happens to be near an outside door and it's a visual reminder Hubitat is armed. Below is the "full" version. Hope that helps it make more sense.
Also, by using scenes I could control the light by voice assistance if I wanted. It just keeps the operation consistent. The caveat to using voice to brighten light is that bright become the new "default" By that I mean pressing the button once dims the light for 30 seconds and it goes back to bright. Another reason why a double-tap is used to turn it off, it resets state. I should probably change the double-tap to turn off both the light and the virtual switch to avoid any possible delay resetting or the light coming back on unexpectedly, but I rarely use voice, I only use it when I want the light to stay bright not when I looking for something in the freezer which is the normal reason for tapping the button. It's a temporary state of brightness.