There appears to be an issue with Hubitat's integration with HomeKit when using Dimmer devices. When turning on a dimmer via the Apple Home app, rather than it going to the previous state dim level, it goes straight to 100%.
I confirmed this issue with Zooz and the Virtual Switch. This behavior does not exist with with devices directly connected to HomeKit, such as Philips Hue or Meross dimmers.
To test, create a virtual dimmer switch and expose it to HomeKit. Find the dimmer on the Apple Home App. Set the dim to 60%. Then, turn off the dimmer switch. Then, turn it on again. It should automatically set itself to 60% dim.
Now, completely exist the Home App (reboot your phone). When you tap to turn the dimmer back on, it goes straight to 100%.
This issue does not happen if you use Hubitat or operate the physical light switch directly.
I am really hoping this is a bug (and not a feature). This is the big reason why I'm not a fan of Lutron Caseta. When turning a dimmer, I want it to return to the previous state.
That's an interesting one. I can reproduce. The issue is within Hubitat's native Apple Home integration. The light works as intended with the Homebridge v2 integration. @gopher.ny
That is why I run all my Lutron lights to Apple Home via Hubitat. Hubitat's driver is configurable and doesn't have the same limitations as Lutron's native direct to Home integration.
Its a bug and it was brought up quite a while back with @gopher.ny , but to my knowledge it was never fixed. I will see if I can find the old thread.
If you are using Zooz dimmers, I made a workaround patch in my driver that should prevent the issue by blocking the extra 'on' command that is being sent: [DRIVER] Zooz ZEN Switches Advanced (and Dimmers)
Hi @jtp10181 , thanks for the info. I actually have been using your Zooz drivers. I love how they add more options.
Using the driver definitely helps, but the issue still remains. Without the driver, the dimmer goes to 100% when turning off/on the dimmer in the Apple Home app. With the driver, it goes to previous state. However, if you turn off the dimmer and exist/enter the home app, then turn on the dimmer, it goes to 100%. I have attached logs showing what I mean.
Hi @bill.d , since you are using Hubitat to expose Lutron Caseta lights, are you able to reproduce this issue with the Lutron Caseta? Or only with the Virtual Dimmer?
So my fix I made was for a set level followed quickly by an On command. The on would hit before the level changed so the switch would then go to its prior level. It actually blocks the on command at the driver and sends a warn log. I think HE may have fixed that issue as I have not seen anyone reporting they are getting that log entry.
Your issue I think is coming from HK itself, because all of the other "ON" have only on and not a setLevel, which is proper. My driver sends a special command to the device telling it to use the default level and duration (which if configured to use last level that is what Zooz will do).
After you force quit HK the app it looks like Homekit itself is then sending an on command followed by a setLevel 100 to the HE integration. The reason I say this is because how would the HE integration know you restarted the app and change its behavior? So therefor I think it is coming directly from HK and HE along with my driver are just passing on the requests.
I think the advice above of 'don't force quit the app' will mostly solve your issue.
That is interesting. I am going to try installing HomeBridge and do further testing.
This definitely seems like a bug on Hubitat's HomeKit implementation, as other HomeKit native devices dimmers (like the Meross dimmer, Philips Hue, the Eve Flare) all behave as expected. When turned on, they dim to the correct level.
Does Hubitat consider this to be a bug in their HomeKit implementation?
The reason I put "force quit" in reproducing the bug was because I really wanted to make reproducing the bug as easy as possible. However, the issue occurs even if you turn off the dummer, let the Home App be in the background, then load it up. If you turn it on, then it turns to 100%.
The Zooz Advanced Dimmer Drivers actually do have an impact (thank you for making these drivers BTW). If I use the standard built-in Zooz Drivers, then then the dimmer always goes to 100%, no matter if I run the Apple Home app in the background or not.
I just tested it with a Virtual dimmer and it does the same thing, those drivers are super basic. Basically just takes whatever commands you send and sets the device that way.
This is 100% something that Apple HK app is doing.
I am thinking Homebridge may be filtering this out, I dont think my lights do this and I have everything through HB.
I could probably have the driver block it, your example the commands are only 13ms apart. I would feel OK specifically blocking a setLevel 100 if it is sent within 100ms of an on command.
I confirmed the issue occurs after just waiting long enough. No need to kill the Apple Home app. This is 100% a Hubitat HomeKit Integration app issue, and is independent of any brand of device.
That's a reasonable question and I have no answers. I don't know when the issue arose. I do know that Homebridge 2.0 integration works as intended even after killing the Home app and has not had any recent changes. So there is something different about Hubitat's native app.
Might be something we get devs attention on during the next beta cycle. Would be good to know whats going on under the hood of the integration exactly. To understand what is being sent from HK to HE to trigger the 'on' immediately followed by setLevel(100).
Possibly enabling a bunch of debug logging in HB may shed some light, if it logs all the incoming HK messages. May have to check that out too.
Devs seem to be pretty stretched these days. On HomeKit I don't think they've ever completed the certification and it is missing from the current marketing materials.
I agree that this appears to be a bug in Hubitat's HomeKit implementation. Especially because native HomeKit devices do not have this issue. The brightness is remembered.
I ran some more testing and may be seeing a potential cause. This is only my speculation, so I could be wrong here.
When setting the dim on the home app, then turn it off, the Home App appears to "cache" the dimmer level. When you exit the Home App and re-enter, the cache its cleared.
The Home App then downloads the current dim level (what it's set to). However, Hubitat is not properly reporting this number. Therefore, the Home App sets the brightness to 100%.
I know the Devs are extremely busy, but I hope this is something they can look at fixing. Hubitat is pretty awesome here. It is one of the few products in the market that allow you to bring Z-Wave devices directly into HomeKit.
But why is HK only sending the specific level after being idle / closed? At least thats what it looks like in the logs. In your logs above the normal on/off sequence does not have any level commands being issued, only on and off. If it did send its "cached" level every time this would show in logs and also break any device configurations which create a default level other than "last set". As soon as you quit and restart the app and turn on again, it appears to send a level 100. If it would send only the on command (like every other time its turned on) then the device would come on at its configured level.