sahilchaddha / homebridge-yeelight-platform

Homebridge plugin for Yeelight Lights supporting Scenes/Moods/Color Flow/Custom Presets/Music Flow/Night Mode
MIT License
58 stars 7 forks source link

Auto discover On/Off state and update Lamp state in HomeKit #8

Open Hopflnger opened 5 years ago

Hopflnger commented 5 years ago

Keep track of the lamp state and update HomeKit if a lamp will be switched off with a wall switch. At the moment, when I switch off power from a lamp, it is still available in HomeKit and you cannot mention if it is really On or OFF. Thanks for your nice work! This is really the best Yeelight HomeKit implementation at the moment.

sahilchaddha commented 5 years ago

Hey @Hopflnger , Thanks for your input.

Do you mean turn the lightBulb state to switched off in HomeKit whenever Device is unavailable(Plugged off from Power Supply) ?

I will be releasing a new version of the plugin which will turn the light off if light gets disconnected from the network & update its state when it gets back connected. I will also add a restriction to change state of Bulb from HomeKit whenever the light is disconnected.

Currently the plugin polls all lights at a specific interval to update HomeKit states. To reduce network traffic you see delay in change of lightBulb states.

Aekung commented 5 years ago

@sahilchaddha

Looking forward to the update. The ability to just turn the light off if light gets disconnected from the network would really be a cool additional to an already awesome plugin. I am thinking of using your plugin to control all the Yeelights in my house instead of the current one I'm using.

Right now, the currently plugin I'm using will only show "Unresponsive" to the lights where someone manually turns the switch off instead of turning it off by using Home App. We all know that Unresponsive Devices could potentially cause the lag or downtime of Home App so having it changes its state to 'Off' when it can't connect to the network even when someone is manually switching off the switch would likely solve the problem.

Looking forward to the update.

sahilchaddha commented 5 years ago

@Aekung , You can update the plugin to 1.2.1. Powered off devices will be turned off in Homekit. Do note there will be a small lag in turning off lights in homekit when Yeelight gets powered off. Off state will be persisted until device reconnection.

Aekung commented 5 years ago

@sahilchaddha worked as you said. Thank you very much. By far, this is the best yeelight plugin I have ever tried. Hopefully you could get rid of the lagging but it's not that big anyway.

Thank you very much.

Hopflnger commented 5 years ago

@sahilchaddha Thanks for the update. Now this plugin is going in to the right direction. Unfortunatly I cannot get the new plugin to work. The On State is recognized and HomeKit updates a new connected Lamp to the ON State. But the other direction is not updated. If I switch off a bulb, it will not update HomeKit to the OFF State... Any Ideas? regards Chris

sahilchaddha commented 5 years ago

@Aekung , I agree with you on terms of lag/delay. The sole purpose of delay/lag is to reduce network traffic.

@Hopflnger , Homekit lights should turn off whenever the Lights get powered off. Once powered off, you cannot turn on the light from HomeKit until Light is powered on. Also do note, there is a delay from plugin side to turn off the lights in Homekit.

It might take upto 60 seconds (depending on your polling interval) for socket connection to timeout, and plugin to turn off those lights.

zucht commented 5 years ago

Due to the on/off state deprecated devices/scenes cant be deleted, other than deleting the accessories and persist folder. Please make this function optional with a plugin config option.

Hopflnger commented 5 years ago

@sahilchaddha

The newest update is running now since around 3 weeks without any major problems. Homekit also keeps responding very fast. Until now there was no need to restart the System.

Only small issue is, that it takes around 5-10 min to update the OFF state. Is it possible to adjust the polling intervall in your plugin?