sanjoyg / dirigera_platform

HomeAssistant Integration for Dirigera Platform
MIT License
71 stars 8 forks source link

slow reaction time for light changes #21

Closed acces90 closed 2 months ago

acces90 commented 3 months ago

I am using groups of lights. When I reduce the brightness of those groups there is a notable and tbh kinda annoying delay in dimming/turning on/off the lights using this add on. When I use the IKEA Home Smart app the lights react almost with no noticeable latency.

Is there some kind of delay coded into the HA addon to not stress the hub with too fast incoming requests? If so, is it possible to reduce it somehow? I believe the hub can handle requests much faster than that.

Here's a video of the reaction time: https://github.com/sanjoyg/dirigera_platform/assets/12232058/f733279b-8db9-4854-8f3e-af99a283107a

sanjoyg commented 3 months ago

There is no throttling in the code or the downstream library. The challenge I think is that all the functions are sync functions. I will start working on the async and then release which should hopefully fix this issue.

sanjoyg commented 2 months ago

@slajob would you be kind enough to try the new branch async_calls to test if the integration is working. I would then merge it to the main branch. It switches to async calls to fix this issue

slajob commented 2 months ago

Hey I reviewed it and it works better! Some video for comparison with similar setup like @acces90. I created group for kitchen main light and hood light and the differences are visible to the naked eye (And synchronous movie had to be trimmed due to big latency and video exceed allowed 10MB file 😅):

Synchronous: https://github.com/sanjoyg/dirigera_platform/assets/33373409/f9699164-1104-4600-8bba-7969caf84da8

Asynchronous: https://github.com/sanjoyg/dirigera_platform/assets/33373409/2e68698f-0a5d-427d-bb3a-ec147a70b2a9

I didn't noticed any errors in my HA logs, so @sanjoyg you can create a PR 🥳

sanjoyg commented 2 months ago

@slajob thank you!

@acces90 do try the latest release

acces90 commented 2 months ago

Waaaay better, difference like day and night! Thank you <3