Jan200101 / ShellyPy

Python library to interact with Shelly devices
MIT License
22 stars 14 forks source link

rewrite #11

Open Jan200101 opened 2 years ago

Jan200101 commented 2 years ago

ShellyPy was originally written quite hastily without the expectation of API revisions or similar.

The idea afterwards was to write a C library for which Python bindings could be written that abstract the concepts, but the inconsistencies of the Gen 1 API have drowned any desire to actually implement that.

Now ShellyPy has developed a bit of cruft based on assumptions that are no longer true or were never true to begin with.

Rewriting the entire library from scratch with support for multiple different backends (direct http, mqtt, CoIoT, cloud) may be better than piling ontop of an already unstable foundation.

h3tz commented 2 years ago

like the idea but can not support the amount of work needed.

Jan200101 commented 2 years ago

all work-in-progress rewrite stuff will appear on the wip/rewrite branch (at the moment all it can do is Gen1 light toggling)

Once I manage to get all my local Shelly devices working under it using at least one backend I'll merge all the WIP commits into a singular rewrite one and start a dev branch under it.

h3tz commented 2 years ago

i just have a single shelly plug device so I am limited doing testing (except code review, architecture and stuff like that)

h3tz commented 2 years ago

What do you think about Websockets as the backend or is this meant by http backend to use MQTT?

Jan200101 commented 2 years ago

backend talks about the different ways an API can be used to talk to the devices.

For Gen1 that would be http, MQTT and CoIoT(based on CoAP). The user of this library can then eiher choose to use the default backend (currently http, possibly CoIoT in the future) or pick one to fit their specific needs (with mqtt the device would announce when something changed allowing the library to change its state)

I am not aware of any Shelly devices that support Websockets

h3tz commented 1 year ago

any update?

h3tz commented 1 year ago

any update ? dead?

Jan200101 commented 1 year ago

Its happening but slowly.

Going further I have been thinking about if this library could benefit from async or callbacks, I'll have to see if either makes sense and how to implement them properly

Jan200101 commented 1 year ago

long live rewrite!

Its "working" but its not finished.

I currently don't have an MQTT setup, but this is worth looking into since it allows active tracking.

Cloud support has been dropped for now, it would add complexity that would hinder the completion of an MVP.

mDNS is coming as an optional feature with a singular dependency on zeroconf that needs to be opted into using at install time and can only be used via a specific class.

h3tz commented 1 year ago

any updates?