Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Device value less than 1% showing 100% in HomeKit #673

Closed
1 task done
jtheller opened this issue Apr 25, 2023 · 4 comments · Fixed by #863
Closed
1 task done

[Bug] Device value less than 1% showing 100% in HomeKit #673

jtheller opened this issue Apr 25, 2023 · 4 comments · Fixed by #863
Labels
bug Something isn't working stale

Comments

@jtheller
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have IKEA TRADFRI bulbs that could be dimmed all the way down to 1/254 reported value in Zigbee2mqtt, or 0.39%. For some reason when the percentage value goes less than 1 it will be mistakenly reported as 100% in the Home app...could be an Apple thing for them to fix, but in the meantime could we implement this to monitor.ts?-

transformValueFromMqtt(value: unknown): CharacteristicValue | undefined {

  ...

  const percentage = (input - this.input_min) / (this.input_max - this.input_min);

  const result = out_minimum + percentage * (out_maximum - out_minimum);

  // Limit min possible return value to 1.
  if (result < 1 && result > 0) return Math.ceil(result);

  return result;
}

This will help HomeKit read less than 1% values somewhat correctly.

I believe the change should only affect lights and battery percentages.

Related devices

  • TRADFRI LED bulb E26/E27 800/806 lumen, dimmable, white spectrum, clear

and potentially other bulbs.

Related Devices

No response

Steps To Reproduce

  1. Use hardware dimmer switch or remote, or through Zigbee2mqtt, dim the lights to a brightness percentage value of less than 1%.
  2. Observe in the Home app that reported brightness stays or jumps back to 100%.
  3. Raise the brightness to a percentage value of greater than or equal 1%.
  4. Observe in the Home app that reported brightness resumes correctly again.

Expected behavior

Expect in the Home app that the reported value should correctly follow the calculated percentage even when it's less than 1%.

Device entry

No response

Status update

No response

Messages from this plugin

No response

This plugin

1.9.2

Homebridge

1.6.0

Zigbee2MQTT

1.30.3

Homebridge Config UI X (if applicable)

No response

@jtheller jtheller added the bug Something isn't working label Apr 25, 2023
@itavero
Copy link
Owner

itavero commented Apr 26, 2023

Can you make a PR for this?
Never seen this behavior myself, but I'm happy to look and test a PR for this.

@jtheller
Copy link
Author

Here is a short clip showing the problematic behavior, notice around 10s when the brightness value is 1 the percentage shown in Home app goes all the way to 100%.

Screen.Recording.2023-04-27.at.8.02.23.PM-1.mov

@stale
Copy link

stale bot commented Jun 9, 2023

It appears that this issue did not have an update in quite some time. Please check if you can provide any additional information to help resolve this issue. If there isn't any activity in the next two weeks, this issue will be closed automatically. Thank you for your contributions!

@burmistrzak
Copy link
Contributor

Here is a short clip showing the problematic behavior, notice around 10s when the brightness value is 1 the percentage shown in Home app goes all the way to 100%.

I can confirm that's a UI/UX bug in the Home app, iOS 17.2 still being affected.
It's likely caused by the bulb being in a technically invalid state, i.e. powered on but simultaneously at 0% brightness.
Zero percent brightness is treated by HAP as powered off, and because 1/254 is approximately 0.39%, HomeKit will automatically round it down to 0%... 🙄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants