sahilchaddha / homebridge-magichome-platform

Homebridge Plugin for MagicHome LED Strips with Preset Scene Automation Support (Cycle Color/Fade/Strobe)
MIT License
47 stars 12 forks source link

Support of Discovering Connected Devices ? #1

Closed dudusandi closed 6 years ago

dudusandi commented 6 years ago

Any way to auto discovery or set by hostname ? My router doesn't have mode to keep same ip devices and I can't set static ip on controllers led.

sahilchaddha commented 6 years ago

Hey @dudusandi ,

Currently the plugin doesn't support discovering of devices. But Yes we can discover connected MagicHome devices.

I will work on this implementation in my free time. Expect this feature to be in upcoming v1.2.0 Maybe we can use MAC Address instead of IP to reference to lights.

Thanks

dudusandi commented 6 years ago

Using MAC would solve the problem, thank you very much.

sahilchaddha commented 6 years ago

Hey @dudusandi , I have updated the plugin. You can use MAC instead of IP. MAC should be in format of XXXXXXXXXXXX.

Due to lack of time, i was not able to test it thoroughly. Would love if you can test v1.2.0 version and provide your feedback/suggestions.

Thanks

sahilchaddha commented 6 years ago

Fixed in v1.2.0

Do note when using MAC instead of IP : The plugin discovers lights every 30 seconds and map their IP to their corresponding MAC.

It can take upto 60-120s to discover and map all lights. Once discovered and mapped, rediscovery will take place every 30s and update IPs of lights.

dudusandi commented 6 years ago

Hey @dudusandi , I have updated the plugin. You can use MAC instead of IP. MAC should be in format of XXXXXXXXXXXX.

Due to lack of time, i was not able to test it thoroughly. Would love if you can test v1.2.0 version and provide your feedback/suggestions.

Thanks

I tested and it works perfectly with MAC, Thanks. Does this search every 30s use a lot of resources or not?

dudusandi commented 6 years ago

captura de tela 2018-10-23 as 15 21 25 I noticed this problem in the log, but I do not understand what it is

sahilchaddha commented 6 years ago

@dudusandi I am glad that new version of the plugin fixed your issue. The logs you are seeing is because of node-persist plugin. We use this plugin to cache IP:MAC Address mapping in case homebridge restarts or breaks.

I will debug this issue and you can expect a fix in upcoming version. Meanwhile you can ignore the logs, since they are not a blocker and does not interfere with fundamental features of the plugin.

To answer your earlier question, yes the plugin rediscovers and refreshes IP addresses every 30 seconds. It doesnt take lot of resources, just open a socket, advertise broadcast and listens for connected lights. In future version, i can add a configuration key for custom pollingInterval.

sahilchaddha commented 6 years ago

@dudusandi

I have added a potential fix for Unhandled Rejection logs occuring due to node-persist. Please try updating the plugin to 1.2.3.

The issue should be fixed, and you should not see any error logs. Enjoy your Lights Thanks

dudusandi commented 6 years ago

@dudusandi

I have added a potential fix for Unhandled Rejection logs occuring due to node-persist. Please try updating the plugin to 1.2.3.

The issue should be fixed, and you should not see any error logs. Enjoy your Lights Thanks

captura de tela 2018-10-24 as 15 30 45

sahilchaddha commented 6 years ago

Hey @dudusandi Looks like you need to install git on your raspberry pi. Nevermind, looks like node-persist is causing lots of issues. I will try to refactor the code and optimize this dependency.

dudusandi commented 6 years ago

Hey @dudusandi Looks like you need to install git on your raspberry pi. Nevermind, looks like node-persist is causing lots of issues. I will try to refactor the code and optimize this dependency.

If I can help with anything, just ask. I have git, but does't work

sahilchaddha commented 6 years ago

@dudusandi Thanks for your support. You can test version 1.2.4. Hope it resolves your issue.

dudusandi commented 6 years ago

@dudusandi Thanks for your support. You can test version 1.2.4. Hope it resolves your issue.

Testing here, apparently perfect.

sahilchaddha commented 6 years ago

Glad to hear that.