jalmeroth / homie-python

A Python-implementation of the homie v2 convention.
https://github.com/marvinroger/homie
54 stars 15 forks source link

auto subscribe to node properties #30

Closed stufisher closed 7 years ago

stufisher commented 7 years ago

I'm working with your dev branch for the homie-control devices. I've just migrated from your v1 to v2 branch and noticed that you currently have to call

Homie.subscribe(switchNode, "on", switchOnHandler) switchNode.advertise("on").settable(switchOnHandler)

I would expect the node once advertised and settable to be auto subscribed as per the esp platform and thus not require the Homie.subscribe call. Does this sound reasonable, Is it a planned feature? I can have a go at adding this if you've not started on something, i've spotted

Homie.subscribeProperty

and homie is passed through to the node, so no reason we couldnt call subscribeProperty when the property is registered on the node.

jalmeroth commented 7 years ago

Thanks for your feedback! You're absolutely right, @stufisher. It almost looks, like I missed to implement this in the first place. O.o

If you want, you can give it a go! I will be happy to merge your PR.