nugget / python-insteonplm

Python 3 asyncio module for interfacing with Insteon Powerline modems
MIT License
32 stars 19 forks source link

Refactor message reception logic to further separate IM and Device layers #203

Open mstovenour opened 4 years ago

mstovenour commented 4 years ago

IM._process_recv_queue() needs to be refactored along with Device.receive_message() to further separate the processing at the IM layer vs. at the Device layer

I personally found this one of the most confusing aspects of the library because the IM and Device call back lists have the same name and are both invoked on every message. It took me a while to keep my head straight on which list was influencing each received message. Likewise the Device layer tries to process all the IM messages if they contain a valid "address" property. These two layers are doing some relatively hackish things to keep from processing each other's messages like looking for the presence of flags (hasattr(msg, 'flags')).

I am more than willing to submit a pull request for this but I do not have enough devices to do the extensive amount of testing that will be required to confirm I didn't break anything. If someone will help me with testing, I'll get to working on a pull request.

teharris1 commented 4 years ago

@mstovenour I have started a new library that has much better layer separation. It is called pyinsteon. You can find it on github. I would be very interested in feedback as I am at release candidate 3 right now.