micro-nova / AmpliPiWallPanel

Touchscreen wallpanel for interfacing with AmpliPi Home Audio System
9 stars 0 forks source link

Switches not working when disconnected from AmpliPi #33

Open rwarner opened 1 year ago

rwarner commented 1 year ago

When the wallpanel is disconnected from my AmpliPi (i.e. The AmpliPi is off the network) the switches on the front are unusable. There is a significant delay of at-least 30 seconds, then it flips on or off, along with MQTT not being forwarded to my broker.

jonahshader commented 1 year ago

This is happening because the wall panel is trying to communicate with the AmpliPi even when it is disconnected. Something similar was happening when MQTT was configured and disconnected, which was mitigated in a pre-release by keeping track of timed out operations and retrying only every few minutes instead of allowing more operations after a timeout. This same logic should be applied to AmpliPi related operations. I'll start working on this soon.

jonahshader commented 1 year ago

I changed it so that on a failed API call to AmpliPi, the WallPanel waits 10 minutes before retrying. During that timeout the system should be responsive, allowing the switches to work. Although these API calls use the urequests library and it appears that urequests doesn't support changing the default timeout which is around 30s. So this means that the system will be unresponsive for ~30s out of every 10 minutes, which isn't ideal but its better than never being responsive.

@rwarner if you want to try this fix out, you can download the 0.2.13 Polling Fix pre-release. Thanks!

rwarner commented 1 year ago

Thanks for the update, sounds good. Luckily it's been on the network since then but glad the issue has been made aware