mikenemat / plum-probe

A tool to manage Plum LightPads without the iOS app
17 stars 5 forks source link

Updates for Python 3, Home Assistant and Hass #5

Closed deftdawg closed 1 year ago

deftdawg commented 5 years ago
mikenemat commented 5 years ago

Hey there. This script was never meant to be integrated directly with something like home-assistant. It was meant to be used as a query tool / troubleshooting tool for my accompanying openhab plugin https://github.com/mikenemat/org.openhab.binding.plum

I appreciate how well it has served you with home-assistant, but I'd urge you to use the openhab binding above as a reference point for a proper home-assistant add-on. The plum lightpads support subscribing to an event bus over a raw TCP port (port 2708), for instant updates on lightpad status (on/off/power consumption/dim/motion sensor). This is far more performant than polling the lightpad. Also, having to initialize an external python interpreter adds a few hundred ms of latency to any user-initiated events. A proper add-on instead of external shell calls would avoid this. Finally, the whole issue of the persistent db/docker containers can be avoided entirely with a proper add-on. The openhab binding for example has no discovery features and no dependence on an accompanying cache. You simply give it the LLID and IP address of the lightpad in the items config. A home-assistant addon should function the same way.

I will consider the python 3 changes, but I do not believe anything home-assistant specific belongs in this project.

deftdawg commented 5 years ago

@mikenemat please feel free to cherry pick the Python3 update bits 😄 ... ATM I have only one room with a couple of lightpads in it, so I'm okay with shelling to python to control the pads even if it's a bit slower. If I had lightpads everywhere, developing a custom HA component might be worth looking into.