Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix MagicHome LEDs with flux_led component #20733
The main purpose of this is that the RGB color is stored. When it is not stored, changing from RGB to warmwhite changes RGB to 0,0,0. When afterwards the color is changed from warmwhite to RGB, the value is set to 0,0,0, which let the bulb stuck, even with the Magic Home App it's difficult to let the bulb shine again.
Another question: How can I tell hass that the next update should be in 2 seconds? After changing color, the bulb needs a second until the new values are returned from the bulb, so the UI stucks at the old value for a few seconds.
amelchio left a comment
You can move the meat to a separate method that is scheduled with
Probably you will need a lock if you start testing for races.
So something like
async def async_turn_on(self, **kwargs): async with self.lock: await self.hass.async_add_executor_job(self.meat, **kwargs) await asyncio.sleep(2)