thecowan / wallpanel-android

WallPanel is an Android application for Web Based Dashboards and Home Automation Platforms
https://wallpanel.app
Apache License 2.0
750 stars 103 forks source link

[feature request] Auto refresh on error #230

Open kylehase opened 3 years ago

kylehase commented 3 years ago

Is your feature request related to a problem? Please describe. WP will sometimes display an error (error: webpage not available) when the Lovelace dashboard is unreachable, for instance due to temporary network problems. When this occurs, it's usually enough to swipe down to refresh the page to reload the dashboard.

Describe the solution you'd like WP should be able to detect such errors and automatically refresh the page.

Describe alternatives you've considered Considered sending an MQTT message to WP to reload, but it's unclear when to send the message as the WP MQTT status looked normal while the error was displayed.

Additional context Add any other context or screenshots about the feature request here.

thanksmister commented 3 years ago

We would need to add code to detect the error and then auto refresh on some type of interval. I can move this to feature request and hopefully either I or someone from the community could make a PR for this feature. We have a few more web related issues such as accessing microphone, camera, and security certificates that require direct interaction with the web page through JS injection or interfaces.

azhinu commented 3 years ago

Grafana lost connection in 3 days. It would be great to add an option to refresh page with some interval.

thanksmister commented 3 years ago

@azhinu have you checked out why you are losing connection? Is your device wifi disconnecting, is your device sleeping? It's best if you keep the application running and use the built-in screensaver and keep screen awake features, this way you always have connection to the server.

azhinu commented 3 years ago

@thanksmister I set up app with android stick. It was connected to the internet with Ethernet. So it can't lost Wi-Fi connection or sleep. Maybe it's NGiNX or Grafana limit connection time.

thanksmister commented 3 years ago

I can catch network errors such as network disconnected and reload the current page. I cannot reload the platform page if the server such as Home Assistant goes down. For this I recommend that on server boot, send refresh command to the application using either MQTT or HTTP. The app has no way of knowing the page has become disconnected since it uses websocket connection.

kylehase commented 3 years ago

Sending a refresh command on HA boot is a great idea! I'm going to implement it across all my dashboards, even those not running WP.