alengwenus / pypck

Asynchronous LCN-PCK library written in Python
MIT License
8 stars 4 forks source link

Rework connection handling in pchk connection manager #65

Closed maximilianriemensberger closed 3 years ago

maximilianriemensberger commented 3 years ago

Draft as basis for discussion of #58.

I decided to create and destroy GroupConnection objects on the fly instead of storing one for each group permanently. Storing in a separate collection e.g. group_conns would easily be possible as well. But since they don't carry any state right now, I saw no reason to do so. If something like a StatusRequestHandler were to be added to the GroupConnection, then they clearly have to be stored again to have a persistent base for activating and canceling the handlers.

maximilianriemensberger commented 3 years ago

Great idea creating GroupConnection dynamically!

Removing register_for_inputs() from GroupConnection will break some functionality within HomeAssistant. There's nothing bad about it... Just have to keep it in mind.

Which functionality? It must have been a dead-end registration since input will never arrive. If you can point me to the breakage, I can certainly try to fix it up if it's not too difficult.

alengwenus commented 3 years ago

Which functionality? It must have been a dead-end registration since input will never arrive. If you can point me to the breakage, I can certainly try to fix it up if it's not too difficult.

Yes, it is a dead-end registration. For convenience, modules and groups are handled exactly the same way. Adding a single if-condition will resolve the breakage. Never mind.

maximilianriemensberger commented 3 years ago

Sure. I'll try to keep an eye on potential HomeAssitant breakage in the future.