Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use asyncio Lock for fibaro light #18622
Changes Fibaro light turn_on and update functions into async versions, getting rid of a blocking lock by switching to async locks. Big thanks to @amelchio.
Related issue (if applicable): fixes #
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>
Example entry for
@pvizeli: The issue is that there's a thread for receiving updates from the fibaro hub, which then requests an update on the light. In the turn_on function there are (in case of switched off color lights) two calls out to fibaro hub, setting the color and switching it on. They trigger updates, and I'd have the update function called on a thread while turn_on is still being processed. So there is a race condition, which could have some side effects, unless handled. Maybe its a small thing, and it might not cause a crash, but could introduce a level of unpredictability as both functions are working on the same variables.