Generic Z-Wave Dimmer reports [0..99] for brightness instead of [0..100]

I'm a developer working on a bug in the Google Home Hubitat Community Integration.

In specific, I have a number of GE/Jasco Z-Wave dimmers (regular Z-Wave, not Z-Wave Plus). I configured them using the Generic Z-Wave Dimmer device and the basics work fine. When I set the level of these dimmers to 100, they report a level of 99 (as I understand it, Z-Wave uses 0..99 instead of 0..100).

However, the documentation for Driver Capability: SwitchLevel says the level should be reported to Hubitat in the range 0..100.

Is this a bug in the Generic Z-Wave Dimmer driver? I ask because many other drivers seem to use [0..100] as documented in the Driver Capability List, so it's hard for integrations like Google Home to know how to scale the level value (there seems to be no way to know if the maximum is 99 or if it's 100 for a given driver).

Here's what I see when I enable debug logs and turn on the device when it's set to the maximum level:

dev:292021-05-10 12:08:05.674 infoDining Room Main Lights was turned on [digital]
dev:292021-05-10 12:08:05.670 debugdimmerEvents value: 99
dev:292021-05-10 12:08:05.665 debugSwitchMultilevelReport value: 99 ok
dev:292021-05-10 12:08:05.603 debugparse description: zw device: 1A, command: 2603, payload: 63 , isMulticast: false
dev:292021-05-10 12:08:02.276 debugon()

The zwave spec is 0-99%. No zwave device should ever report 100%, as that is not in spec.

Yes, I know that is annoying for things like Google Home/Alexa integration. Some authors will make their drivers go to 100% to work around that, but it is a kludge and not per spec so many other authors (myself included) will not do that in their drivers.

The most common way to make a zwave device report 100% is to automatically make 99%=100% in the driver. Like I said - a kludge, albeit a minor one.

All that said, I have no idea what Hubitat's official stance is on this.

Totally understood that the Z-Wave spec is [0..99]. Makes sense.

I'm just gently suggesting that the official Hubitat Z-Wave drivers should handle mapping the Z-Wave range [0..99] to the Hubitat range [0..100], since that's what's documented in Hubitat's Driver Capability docs.

I understand. And if Hubitat does that consistently in their drivers, and they document 'the official way' of how to do it (override 99 to 100?), I would concede and follow suit.

1 Like

100% agreed. I'm mainly looking for official documentation and guidance from the Hubitat side that:

  1. SwitchLevel's level (as well as position for WindowBlind and WindowShade) devices must be reported in the range [0..100]
  2. Built-in Z-Wave drivers as well as user drivers are responsible for mapping the underlying physical device state to the Hubitat range [0..100]

In the mean time, I sent this fix to the Google Home Hubitat Community Integration which basically does what you said (treats a Hubitat level of 99 as 100 if it ever appears, regardless of the device).

That does mean folks who really do want to set their devices to 99% instead of 100% can never do so, but I assume that's pretty rare.

Yup, the range specified is 0 to 100, that doesn't mean that the device is capable of operating at both extremes in that range.

Z-Wave has the 99% problem, every other protocol I'm aware of can report 100%

We've talked about this internally some time ago and decided not to force change the level reports produced by Z-Wave devices


I can see why that might be a short-term solution. I'd love to advocate for revisiting that and making Z-Wave drivers map to [0..100]. (Just mapping 99 -> 100 would be fine.)

Just as a heads-up, this decision actually caused a nasty crash in the Google Home app (the Hubitat-GH integration started sending % values of 101, which caused an out-of-range exception in the app).

that's the first report of that error I'm aware of, please explain how you were able to invoke it...

Sorry, I should have specified it was a bug I caused in the open-source Google Home Hubitat Community integration. :slight_smile:

I suspect this kind of bug is endemic to Hubitat (and other Z-Wave) integrations, but by specifying that all device implementations (including built-in Z-Wave devicesa) must normalize their ranges to [0..100] will go a long way to resolving it.

Another strange one is the capability

it says the range is 1-100%

where switchLevel says 0-100

(as does setVolume)

also note setColorTemperature does not specify the level range....

A level preset value of 0 makes no sense, hence it being one.

1 Like

setLevel = 0 means turn off (which makes sense)

Preset = 0 would mean never turn on? (which makes no sense)