tonesto7 / homebridge-hubitat-tonesto7

Hubitat Homebridge Plugin
108 stars 34 forks source link

(BUG) Dimming a light under 5% causes setLevel to be called with value 0 and command fails in hubitat #219

Closed b-ill-y closed 2 weeks ago

b-ill-y commented 6 months ago

About Your Setup

Expected Behavior

Tell us what you think should be happening If value is rounded down to 0 due to transformAttributeState, the off command should be sent. This presents an issue since homekit allows users to use a slider to turn on the light.

Hubitat app should be able to receive commands with a 0 integer.

Current Behavior

What happens instead of the expected behavior? setLevel is called with 0, but Hubitat doesn't recognize the command since it is interpreting 0 as undefined property and fails to find method to trigger.

Rounding taking place:

image

Hubitat complains:

image

Steps to Reproduce (for bugs)

Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant Using a dimmable light:

  1. Start from a level above 10% brightness, and pull the slider down to 1%-4%
  2. Start from off position, slide to 4%, only the on command is recognized, setLevel isn't properly triggered, and the level is incorrect.

Context

**How has this issue affected you? What are you trying to accomplish? Noticed lights brighter than what they were supposed to be when trying to turn on a device via slider (step 2 from above). Not a huge issue since this is controlled via a config parameter, but the Hubitat app not receiving setLevel(0) correctly might cause other issues, errors being thrown in log history.

github-actions[bot] commented 3 weeks ago

This issue has been marked stale automatically after no activity for the last 180 days.