zizi4n5 / homebridge-switchbot-for-mac

Homebridge SwitchBot is plugin for Homebridge that allows you to manage SwitchBot.
MIT License
18 stars 3 forks source link

Ping IP #2

Closed samsonrosen closed 4 years ago

samsonrosen commented 4 years ago

Hey! This is more of a feature request.

Is it possible to build in a power status based on pinging IP? Some of the Television plugins have them in case someone powers on/off manually.

The use case I was thinking of was a wireless printer. When powered off wouldn't be pingable therefore should display as off and vice versa.

samsonrosen commented 4 years ago

Thanks so much for this plugin! It does work really well. My switchbot came this morning and the plugin worked straight away.

If there is an optional way it can ping a device to detect in Homebridge whether the device is off or not that would be amazing. It would help if someone turns off the device manually.

I tried to setup something with an occupancy sensor to detect if the printer is on or off and then set the state of the switch. But if the sensor detects the printer has been turned off, when the switch-bot is on, the automation then just make the switch bot press the button again, which then turns the printer on.

zizi4n5 commented 4 years ago

It seems to be possible to achieve this by referring to homebridge-broadlink-rm, which I was told about in a recent tweet.

https://github.com/lprhodes/homebridge-broadlink-rm/blob/815b94734a1468f3960b922a6f4778f8eed37576/accessories/switch.js#L73-L109

samsonrosen commented 4 years ago

Hey @zizi4n5,

Does the above pull request mean you made progress? I couldn’t see anything in the readme.

Thanks,

Sam

zizi4n5 commented 4 years ago

Hey @samsonrosen ,

Version 0.1.0 has been released, including this feature. Please check it out. https://github.com/zizi4n5/homebridge-switchbot-for-mac#ping