Hubitat HomeKit Bridge Zooz Z72 Dimmer Issues

I am a Hubitat C-7 (v2.3.4.134 ) user with the HomeKit Bridge App Installed. For lighting I started out with (10) UltraPro (Jasco) Z-Wave Smart Light Dimmers connected into HomeKit. They worked without any issues (really nice) turning them on/off and setting brightness level from the Apple Home app or using Siri in any sequence.

So I decided to add (6) more dimmers but this time I went with the Zooz Z72 ver 2.0. I read a lot of good things about the Zooz dimmers with all the advanced configuration options including the ability to control the light ramp on speed. Added to Hubitat and HomeKit without an issue but ran into problems when I stared issuing commands through the Home app and/or Siri.

Performing a sequence such as "set kitchen light to 5%", "set kitchen light to 20%", "set kitchen light to 45%" would work showing me the actions being executed in the Hubitat live logging followed by Siri telling me what it just did. But then I would continue and say, for example "set kitchen light to 5%", Siri would acknowledge that it set to 5% but nothing. No change in level and no events logged in Hubitat or might turn it on and off just blinking the light with no level change. I would then return later and say "set kitchen light to 70%", Siri would acknowledge the level change but the light would only go on at the the level it was at the last time it was on and the log would only show an [on] action. UltraPro dimmers work perfectly now matter what the sequence. I tried using both the standard and advanced Zooz ZEN Dimmer Drivers with the same results. Any help is appreciated.

Welcome to the community!
Are you using this Advanced driver? [DRIVER] Zooz ZEN Switches Advanced (and Dimmers)

Join the owners group so you can post images: Hub owners - Hubitat

Turn on info and debug logging on that driver I posted above, see if the issue will reproduce and then SCREENSHOT the logs and post that please.

Also please go to Settings >> Z-Wave Details and then screenshot some of your new dimmers, if you added them all at once they should be grouped together.

See (no change) events below for issue:
This is using advanced driver

Siri: 16%
dev:1272023-01-29 08:01:51.487 AMinfoLiving Room Light: level is set to 16% (digital)
dev:1272023-01-29 08:01:51.482 AMdebugLiving Room Light: switch is turned on (digital) [NOT CHANGED]
dev:1272023-01-29 08:01:50.287 AMdebugLiving Room Light: getSetLevelCmds output [level:16, duration:255, endPoint:0]
dev:1272023-01-29 08:01:50.283 AMdebugLiving Room Light: setLevel(16, null)...
dev:1272023-01-29 08:01:50.261 AMdebugLiving Room Light: getSetLevelCmds output [level:255, duration:255, endPoint:0]
dev:1272023-01-29 08:01:50.258 AMdebugLiving Room Light: on...

Siri: 35% (no change)
dev:1272023-01-29 08:02:36.442 AMdebugLiving Room Light: getSetLevelCmds output [level:255, duration:255, endPoint:0]
dev:1272023-01-29 08:02:36.438 AMdebugLiving Room Light: on...
dev:1272023-01-29 08:02:36.419 AMdebugLiving Room Light: getSetLevelCmds output [level:35, duration:255, endPoint:0]
dev:1272023-01-29 08:02:36.415 AMdebugLiving Room Light: setLevel(35, null)...

Siri: 5% (no change)
dev:1272023-01-29 08:03:40.673 AMdebugLiving Room Light: getSetLevelCmds output [level:255, duration:255, endPoint:0]
dev:1272023-01-29 08:03:40.669 AMdebugLiving Room Light: on...
dev:1272023-01-29 08:03:40.650 AMdebugLiving Room Light: getSetLevelCmds output [level:5, duration:255, endPoint:0]
dev:1272023-01-29 08:03:40.646 AMdebugLiving Room Light: setLevel(5, null)...

Manual: 32 %
dev:1272023-01-29 08:04:43.431 AMinfoLiving Room Light: level is set to 32% (physical)
dev:1272023-01-29 08:04:43.428 AMdebugLiving Room Light: switch is turned on (physical) [NOT CHANGED]
dev:1272023-01-29 08:04:42.398 AMinfoLiving Room Light: button 1 released [up released]
dev:1272023-01-29 08:04:41.569 AMinfoLiving Room Light: button 1 held [up held]

Siri: 5%
dev:1272023-01-29 08:06:50.685 AMinfoLiving Room Light: level is set to 5% (digital)
dev:1272023-01-29 08:06:50.680 AMdebugLiving Room Light: switch is turned on (digital) [NOT CHANGED]
dev:1272023-01-29 08:06:49.069 AMdebugLiving Room Light: getSetLevelCmds output [level:5, duration:255, endPoint:0]
dev:1272023-01-29 08:06:49.064 AMdebugLiving Room Light: setLevel(5, null)...
dev:1272023-01-29 08:06:49.043 AMdebugLiving Room Light: getSetLevelCmds output [level:255, duration:255, endPoint:0]
dev:1272023-01-29 08:06:49.040 AMdebugLiving Room Light: on...

Siri: 60 %
dev:1272023-01-29 08:08:01.089 AMinfoLiving Room Light: level is set to 60% (digital)
dev:1272023-01-29 08:08:01.085 AMdebugLiving Room Light: switch is turned on (digital) [NOT CHANGED]
dev:1272023-01-29 08:07:59.469 AMdebugLiving Room Light: getSetLevelCmds output [level:60, duration:255, endPoint:0]
dev:1272023-01-29 08:07:59.465 AMdebugLiving Room Light: setLevel(60, null)...
dev:1272023-01-29 08:07:59.444 AMdebugLiving Room Light: getSetLevelCmds output [level:255, duration:255, endPoint:0]
dev:1272023-01-29 08:07:59.441 AMdebugLiving Room Light: on...

Siri: 5%
dev:1272023-01-29 08:08:39.731 AMinfoLiving Room Light: level is set to 5% (digital)
dev:1272023-01-29 08:08:39.727 AMdebugLiving Room Light: switch is turned on (digital) [NOT CHANGED]
dev:1272023-01-29 08:08:38.629 AMinfoLiving Room Light: level is set to 8% (digital)
dev:1272023-01-29 08:08:38.625 AMdebugLiving Room Light: switch is turned on (digital) [NOT CHANGED]
dev:1272023-01-29 08:08:37.572 AMdebugLiving Room Light: getSetLevelCmds output [level:5, duration:255, endPoint:0]
dev:1272023-01-29 08:08:37.567 AMdebugLiving Room Light: setLevel(5, null)...
dev:1272023-01-29 08:08:37.548 AMdebugLiving Room Light: getSetLevelCmds output [level:255, duration:255, endPoint:0]
dev:1272023-01-29 08:08:37.544 AMdebugLiving Room Light: on...

This is the built-in (beta) Homekit integration correct?

Is it is consistent where the issue only happens if the light is already on? Does not appear that way based on the logs, actually looks like in all cases it was already on.

I can see a pattern and think I know the problem. It seems to be always sending an ON command combined with a separate level command. Just setting the level will turn the device on so the extra command is not needed. In the cases where it did not work correctly the level adjustment was sent FIRST followed by an ON command. The ON command I am issuing from my driver is sending a special value which tells the switch to turn on at its last level (this is per zwave specs). The On command being sent is so quick after the level command, the "last" level is still probably what it was prior to the level command, so essentially the ON command is overriding it.

@gopher.ny what do you think of this? I am not sure how Homebridge handles this, if it sends both commands or just the level, I will have to test. I can see why you may want to send level first and then ON, IF (only if) the device supports a pre-stage, but nearly all devices will turn on when you send level so the ON command itself is not needed. IMO it should just be sending the level command.

So... I think at some point my driver may have used the last level from the hub, and sent that as the "ON" value, if that was done it would basically just send a second level command. This would solve this issue but the devices also have some settings where you can set a custom "turn on" level. So if I sent a different level for "on" besides the proper 255 value it would override that setting. Hmmm... maybe I could check if the device is already on, then use the current level instead of the "255" last level command only in that case.

The other option to protect against this in the driver would be if an on command is sent right after a level command the driver just ignores the on command and does not send it to the device.

@hal2001 I will think about this and try to post a small little fix for you to test later today, if you are OK with editing the code a tiny bit? Will just be a copy/paste to replace a small section.

Also, an actual screenshot of logs is much easier to read. I had to copy and paste your post into a text editor without word wrap so I could make sense of that mess.

Yes this is the built in HomeKit beta and no the issue still occurs even if the light was off.
Here is a case where light was turned off while at a 5% level (start of log), and then (with it still off) was set to 25% by Siri.
As you can see the light went on but reverted back to 5% even though the command was for 25%

I appreciate your help on this. I am a software developer so I am comfortable with what ever you need me to do.

Around line 1268 on the driver replace the getOnOffCmds function with this below. Tested it out quick, seems to do what I want and still works correctly to turn on/off

String getOnOffCmds(val, Integer endPoint=0) {
  if (val && device.currentValue("switch") == "on") {
    val = device.currentValue("level")
  } else {
    val = (val ? 0xFF : 0x00)
  }
	return getSetLevelCmds(val, null, endPoint)
}

Noted, I'll experiment with it.

I was just thinking, it could be firmware related also, really if the device just got a level command and is still transitioning to that level you would think it would just ignore the on command. I hate putting hacks in the driver to work around stuff, should not need to.

I made the change in the driver per your request and rebooted the hub. Did not solve the problem.

Logs start with light off. Then I set to 80% (that worked) and then 5% (Stayed at 80%) and then 30% (stayed at 80%). All my level changes show in the logs but keeps going back to initial 80%

OK I see why thats not working, the commands are so close together the driver has the same issue as the device, the last level is from prior, not the most recent command. Should have known that would happen. Next try I think I will block the on command if it comes over within 1s of the level command. That should so the trick for sure.

Any updates on this issues?

On my end, I think I totally forgot about this. I flagged it, will try and check it out tomorrow again.

I had same issue set up virtual switches in HomeKit that trigger different light levels in the Zooz switch

No switch for 25 and 50 or whatever value

And the virtual switch returns to off 500ms

I think I may have solved this, at least for myself. I have a Level Bolt in my back door and a Zooz Zen74 controlling the back patio light. I have an automation set in HomeKit to, between dusk and dawn, set the patio light to 100% when the door is unlocked, and set it back to 25% when locked. And it took a lot of hair pulling before I figured out the issue. You'll need an app like Home+ to modify HomeKit properties you can't in the stock Home app. You can go into your automation or scene and tell it to set the brightness level, but not turn the light on. Seems HomeKit was sending two commands simultaneously, but the Zen74 could only respond to one.

@tokon13 @user5068 @hal2001

Sorry all I was slacking on this. I really just could not think of a total hack way to do it, but after the post today I reviewed it again and had an idea. Please try out this version of the driver and see if it solves it. If you turn on debug logging you will see this when it works:

image