mbudnek/google-home-hubitat-community

Device states for BrightnessAbsolute and OpenClose can report invalid value 101

Closed this issue · 3 comments

I think my PR #72 introduced a regression. Some of my devices are now reporting a value of 101 for brightness and/or openPercent:

https://gist.github.com/bhamiltoncx/3ca5e881ab0296286755f3babdd17975

It looks like Hubitat does document the range for percentage values as being 0..100, not 0..99:

https://docs.hubitat.com/index.php?title=Driver_Capability_List#WindowShade

setPosition(position)
position required (NUMBER) - Shade position (0 to 100)

https://docs.hubitat.com/index.php?title=Driver_Capability_List#SwitchLevel

setLevel(level, duration)
level required (NUMBER) - Level to set (0 to 100)

I suspect this is actually a bug in Hubitat's built-in "Generic Z-Wave Dimmer" driver, which definitely reports level of 99 when the lights are on maximum. (I believe Z-Wave uses 0..99 instead of 0..100 for dimmer values).

Here's what I see when I have the level set to maximum and turn on debug logs for this driver, then turn on the device:

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()

We can probably partially revert #72 and apply per-driver workarounds for known bad drivers like "Generic Z-Wave Dimmer".

I asked on the community forums if this is indeed a bug in the Generic Z-Wave Dimmer driver.

Send #77 as a fix.

I don't think it's just the generic z-wave dimmer driver. The z-wave spec itself only supports the range [0-99], so every dimmer driver I've used (Generic, GE, and Inovelli) caps at 99%.