joopert / nad_receiver

python api to connect to NAD receivers
MIT License
10 stars 18 forks source link

Wait for the requested response #11

Closed andreas-amlabs closed 6 years ago

andreas-amlabs commented 6 years ago

When sending a telnet request and at the same time using the remote control the reponse was sometimes incorrect. This solution is probably not 100%

Eg. sending main.volume? while fibbling with the remote does not guarantee that the response is for the main.volume? command, it could be a response from remote control volume changes. But filtering should work for e.g. main.power? while pressing vol+/- on the remote

Tested within home-assistant

andreas-amlabs commented 6 years ago

I expect this to be the final version ...

joopert commented 6 years ago

When something goes wrong, and the receiver does not response correctly, the loop will be infinite. I suppose we need to have a timeout (or a max retry mechanism) which will raise an error. Not sure yet what the best solution is though.

andreas-amlabs commented 6 years ago

Sloppy me, read the doc like "will raise timeout exception" ... Will submit an update later this evening. I feel "raise" should be enough, lets not overwork it. Even retry could eventually fail, let the app handle it

andreas-amlabs commented 6 years ago

Hope this will fix any issues. Tested it with home-assistant and appears to work. Difficult to really trigger all mishaps though

andreas-amlabs commented 6 years ago

Yeah, I will need to do 1 more patch since e.g. home-assistant does not like it when there is a raise in init.

Thanks for understanding

joopert commented 6 years ago

Uploaded version 0.0.11 to pypi