I have my button controller set up to toggle a dimmable light when the button is pushed. This looks to be set up correctly, but whenever I press the button, the light does not turn on. The weird part is that in the HE logs, it shows that the light is actually turning on and turning off on the button pushes, but nothing actually happens and the light never turns on.
This light is able to be turned on via the app and other automations, so I know the light is working correctly. Just not sure why the button controller isn't toggling the light correctly. Anyone have any ideas? Screenshots below
1 Like
My initial thought is that trying to toggle a dimmer may be the issue in some way, shape or form... Toggle is typically a command used with plain on/off switches. But maybe it's something totally unrelated to that.
Yeah that thought crossed my mind also. Because what I'm really trying to do is:
Button pushed - Turn on light and set dimmer to 50%
Button pushed again- Turn off light
But not sure what this "Toggle Dimmer" action is for if not exactly that...
What device is this, and what driver is it using? It's a bit odd that the device seems to be reporting something that isn't doing, assuming the entry at 9:52:27.394 is this device and presumed to be a result of this Button Rule instance (though enabling action logging for this app and filtering the logs to just this app and the device would paint a clearer picture, and maybe enabling debug logging on the device). Also, Button Rule would be sending a setLevel(50)
, not an on()
, with the way this rule is set up, so when you're testing things from the device detail page, that's what I'd use.
This is a Hue bulb that's integrated with the native Hue integration. I don't know how to enable debug logging on that device, but if there's a way to do that let me know.
I do think it's a bug with the "Toggle Dimmer" action though because I just changed the action to "Toggle" and that worked.
So I guess my follow up question is, how do I get the following to work if "Toggle Dimmer" doesn't seem to be working?
Button pushed - Turn on light and set dimmer to 50%
Button pushed again- Turn off light
1 Like
If there is a bug, I'm not able to reproduce it. Does "Current States" on the Hue bulb page update as expected when the commands are sent? Here are my logs for a virtual device I used for testing, which should always "report" accurately (since there is no real device behind it and everything is faked):
The version at the bottom of my Button Rule says "Version 1.1.1 (10/11/2022)." If you aren't using the latest version, I suppose it may be worth a try to "upgrade" or maybe just re-create this Button Rule to see if that helps.
Yes the current states show up on the bulb info:

I am also on version 1.1.1. I just deleted the rule and recreated it and got the same result. It works when I just toggle the light on and off, but as soon as I set it to "Toggle Dimmer", it doesn't work.
1 Like
I meant whether they update (in near real time) to reflect the state of the bulb, not just whether they're there (though that's also good!).
One thing I don't see in your rule: you have "Toggle Dimmer" selected but don't seem to have input a percent (level). This is based on your logs, but I know I did and my logs look different. Sounds like you want 50? Or if you just want off or on to the last state, the Toogle Switch action (in a different "category") is what you're after.
Oh yes they do update in real time.
Regarding the input percent, in my first post you can see that I have it listed there at 50%, but the log screenshot was showing that it stated it was turned in when in reality it wasn't doing anything. I think I had tried it a few times so it set the percentage on the first button press, but on subsequent presses it would just turn the light on or off (since the percentage was already at 50). But the part that was hard to capture was that nothing was happening to the light at all. It wasn't even turning on.
1 Like
My logs for them Button Rule still show 50, even though that is the last percent. (The device event logs and history may not, since it isn't a change.). Is your action still set up like it is in the screenshot? If not, make sure it is; if so, consider removing and re-adding it in case something got messed up.
I do have toggle and dim rules for some of my hue bridge integrated bulbs
Try doing it as two separate commands with the dimming first.
Works at least 95% of the time. Sometimes it doesn't and I have put that down to my syncronisation time - for example if pushed too soon after last push, hubitat may not had confirmation the light is already on or off
1 Like
I'm not sure I'd recommend this approach; the "Dim" action calls "Set Level" on the device, which will turn it on if it's off. Then, the "Toggle" action will read the current state and send either "Off" or "On," depending on the current state. Theoretically, it would always be on by this point and so send an "Off," but this happens in such quick succession that it often might not have finished committing the "switch: on" state to the database yet,leading to unpredictability. That might explain some of the differences you see.
It is possible to stimulate the toggle behavior on your own:
IF (Light is on) THEN
Off: Light
ELSE
Dim Light: 50
END-IF
But from the logs it still looks to me like the OP is missing the level from the "Toggle Dimmer" action configuration, so I'd yet something I suggested above first.
1 Like
Well that's the small percentage of times when it hasn't finished committing, mainly cos not enough time has elapsed since the previous press. Whether that's acceptable probably depends on the use case. We're happy to simply give it another push if it gets out of sync. Might be annoying if you're trying to impress a first date and the lights play up and ruin the atmosphere 
The last press shouldn't play (much) into it; I'm more talking about the "Dim" action in the rule, which will turn on the light if it's off, per standard Hubitat setLevel()
behavior (the command that this rule action ultimately runs). That means by the time you get to the "Toggle" action, it should be on, making for a pretty boring action that would theoretically only turn things off. But it depends on the hub seeing that it's on fast enough, and with it being the very next action in the rule, that might not happen yet. (This assumes no "classic" pre-staging, etc.)
1 Like
Same thing really. If the light briefly flashes when it should be turning off, or the dim command is acted on out of sequence, another press deals with it.
1 Like
So I tried a few things last night including recreating the rule in RM with the "Toggle Dimmer" action, but it still didn't work. Even tried the same rule and button controller rule with different hue lights. What I noticed was that the rule would change the state of the light to "On", but it would be out of sync and not actually turn on. The Hue app would still show that it was off. If I manually turned it on from the device settings page, it would then turn on and the state would remain the same at "On".
Not sure why this behavior is happening or what I can do to fix it. As I mentioned previously in the thread, the rule works with the "Toggle On/Off" just fine, it's only fails when the "Toggle Dimmer" action is used.
To get around this, I finally created a rule in RM that worked. It's a little more complex than the original button rule, but it will do for now. See below. Hopefully the Toggle Dimmer action will end up working at some point though since it's a lot simpler rule.
1 Like
What Hue integration are you using? Do you have some "prestaging" option enabled? (The built-in one doesn't support this, and neither does mine for new users, but something else might.) You shouldn't need both an "On" and "Dim" action in your ELSE
, as the "Dim" (which calls "Set Level" on the device) will turn it on if it is not already. If that's not the case, something else could be happening that is affecting the behavior of toggle for you.
I'm using the built in Hue Integration app with HE. Is there a better option to use? I didn't think I'd need both the "On" and "Dim" actions either, but that's the only way I got it to work. The "Dim" action by itself didn't do anything besides change the state in the device details like I mentioned, but the light would not turn physically turn on. So if it is something else causing this, I have no idea how to fix that
1 Like
That should work, so I don't know why it isn't. I suppose if you've found something that works for you, there's no reason to change. The Button Rule action works for me, so it seems like an integration problem, but if Set Level works from the device detail page, there's no reason it shouldn't here. There are at least two currently maintained community integrations (one of which I wrote), but I'm not sure what's going on with this one.
1 Like
Yeah I have no idea. Just to confirm, I removed the "On" action, but left the "Dim" action and tried it unsuccessfully. Adding back that "On" action caused it to work again. So weird
1 Like