xiaohuim / homeassistant-magicblue

MagicBlue custom component for Home Assistant
14 stars 13 forks source link

Add support for reading state from magicblue #1

Open StevenLooman opened 7 years ago

StevenLooman commented 7 years ago

The magicblue library has been enhanced. A new feature is the ability to read the state from the bulb itself. This pull request uses this ability to supply data to home assistant itself.

Great work with homeassistant-magicblue!

renekliment commented 7 years ago

@xiaohuim Are you still working on this project? It would be awesome if it could be integrated with HA directly now that the dependency library can be installed via pip.

renekliment commented 7 years ago

@xiaohuim Also, with respect to https://github.com/Betree/magicblue/blob/24d2277dd919c61adf2f5ad4061b2007468087d8/magicblue/magicbluelib.py#L177 do you know of any good way to implement this (as in 2 exclusive lightbulbs) in HA?

StevenLooman commented 7 years ago

Still working on it, but at the moment distracted to home-assistant-dlna-dmr. I expect to work more on homeassistant-magicblue later on.

There is more to do. I have multiple bulbs configured in home-assistant, but most of the bulbs are usually off. As a result, homeassistant-magicblue tries to poll the bulbs (from the main thread) but this becomes a blocking call. home-assistant then reports this call is taking too long... I plan to move the updating code to a separate thread/call to work around this. As soon as I have this working, I'll update the pull request.

Two (virtual) bulbs should be possible, but are you certain you want to do this? I can set color and warm light via two different controls in home-assistant. Also, these 2 virtual bulbs would be interfering with each other. i.e., if you set a warm light on the warm-light-virtual-bulb, then the color-virtual-bulb would turn off/change.

StevenLooman commented 7 years ago

Moved the update to a separate job, please test if you can.

Betree commented 7 years ago

@StevenLooman Works for me with 2 v10 bulbs ;)

@xiaohuim any plans to merge these changes ?