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

Light example takes a long time to set brightness when controlled by Home Assistant (CON-1304) #1053

Open
dheckl opened this issue Aug 14, 2024 · 3 comments

Comments

@dheckl
Copy link

dheckl commented Aug 14, 2024

Describe the bug
Light example tested on ESP32-C6, ESP32-H2 and ESP32-C3 takes a long time to set a new brightness when controlled by Home Assistant via Matter. When setting a new brightness, the brightness starts fading and takes up to 20 seconds to finish setting the desired brightness. Turning on / off works as expected. Also setting brightness with some other Client, e.g. Home App from Apple, works as expected. Please see this discussion home-assistant/core#113775 (comment). As mentioned here, Home Assistant has a default transition time and esp-matter seems to not handle it correctly.

There is a workaround available. Setting 0 for transition in the Home Assistant light profile config fixes the issue, but then no transition time is applied for changing e.g. brightness.

@github-actions github-actions bot changed the title Light example takes a long time to set brightness when controlled by Home Assistant Light example takes a long time to set brightness when controlled by Home Assistant (CON-1304) Aug 14, 2024
@sayondeep
Copy link
Contributor

@dheckl
We carried out some tests and it was found that executing each iteration of this callback takes around 1 ms on the Linux platform and on MCU-based platform (like ESP32), it takes around 40ms - 70ms. This eventually causes the delay in level control response from the end-devices. Even after disabling all the console logs, it came down to around 6ms for each execution, which somewhat improved the response time.
Example -
To change level by say 40 in 200ms, this callback is scheduled every 5ms (see here) to reduce brightness by 1 (see here). When callback itself takes around 50ms for each execution, overall it takes quite some time for the device to respond.
It has been fixed on the Home Assistant side in this PR home-assistant/core#126220, which changes the default transisiton time from 2 to 0.

@dhrishi
Copy link
Collaborator

dhrishi commented Oct 16, 2024

@dheckl Please give it a try with the latest Home Assistant code and close this if the issue is resolved

@dheckl
Copy link
Author

dheckl commented Oct 16, 2024

Thanks for your analysis. I can confirm that it works with transition time 0. However, very sad that we don't get it fixed with a defined transition time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants