Dashboard Randomly Disconnecting

It seems after a few of hours that my dashboard (running on Safari iOS on iPad) is no longer responding properly. I refresh of the URL gets it back but it’s a but annoying to have to randomly refresh the dashboard to get it controlling things again.

Looking on my Appdaemon server I see the following which I assume is the event causing the disconnect of the dashboard:

Fatal read error on socket transport 
protocol: <RequestHandler none:none connected>
transport: <_SelectorSocketTransport fd=19 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 724, in _read_ready
    data = self._sock.recv(self.max_size)
TimeoutError: [Errno 60] Operation timed out
2017-08-17 00:11:25.155325 INFO Dashboard disconnected

Any ideas on how to fix this?

Are you using a reverse proxy? Apache / Haproxy / Nginx ? If you do, those might have set up a maximum connection time.

No. I have AppDaemon running on OSX natively (not within docker). So nothing between the app and the ipads.

Hmm. Mine runs for days without an issue. The code itself retries indefinitely if the connection goes away.

Can you try this with a desktop browser to see if you get the same behavior, and also to see if you get any JavaScript errors on the console?

Sure thing. When I get back home I will try it and report back if I see anything.

@aimc So I ran it on a desktop browser, when I saw the error again I look at the Javascript console errors for Safari. I found:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://:5050/css/materialdesignicons.min.css.map
Failed to load resource: the server responded with a status of 404 (Not Found)
http://:5050/css/materialdesignicons.min.css.map
Failed to load resource: the server responded with a status of 404 (Not Found) (jquery.gridster.css.map, line 0)
http://:5050/css/dist/jquery.gridster.css.map

Further update. I saw the error again over night but this AM only my Ipad dashboards were broken. The desktop version was still working fine.

I’m fairly sure those errors are not related.

Looks like you are running on Python 3.6 - I am running on 3.5, I wonder if there is some kind of issue there? I’m running iOS as well, how often does this happen? I don;t see the same error in my setup.

So far the errors are thrown on my mac (where Appdaemon is runnign) a few times a day. So far my last one was at 22:50 last night, nothing since then. I wonder if I should downgrade to Python 3.5?

What type of OS are you running your Appdaemon on?

I run on Ubuntu 16.04

I might have to head that direction. Although I just got my build of HA just about done (only need to get Alexa moved to HA from my ST hub) their are just too many work arounds I have in place on the mac. Just need to decide if I want to run it on a Rasberry Pi or just load a piece of gear I have here in the house with linux.

For now I am restarting the Appdaemon every 15 mins and this seems to be avoiding the issue although I still find that after long periods of not using HADashboard, say over night, the iPads all need to have their dashboard reloaded to work.

So I tried following your setup @aimc. I loaded up Ubuntu 16.04.3 in a virtualbox VM and made sure my python version was 3.6. So far so good. It’s only been really setup since today but it seems the dashboards on the iPads are not losing their connectivity. For S&G’s I left one also running on OSX and that iPad lost contact with the dashboard not updating but the other two both homed ot the Ubunutu VM seemed okay.

Tomorrow AM will be the test to see if they can make it through the night…

1 Like

So @aimc my dashboards worked perfectly. One last question on the topic, do you run your AppDaemon in native Ubuntu or Docker?

My current setup is as I said on a Mac using docker (HASS, mosquitto and smartthings-mqtt-bridge) except for AppDaemon and a Life360 script to grab presence/location data which both run natively on the mac. Mac for docker has issues requiring restarts so I was thinking of moving everything over to Docker inside the Ubunut VM.

Glad you got it working!

I run native currently.

Odd, I have appdaemon working just fine natively on OSX python 3.6 with no errors.

I get that first error you posted every once in a while on my hass instance but it doesn’t seem to translate into any undesired results.

That is interesting. I wonder if HA can just recover better. All I can say is that once that Python error showed up on Appdaemon my iPads lost their connection. So far (knock on wood) running Appdaemon inside the Ubuntu VM seems to not have either the Python error nor any iPad’s disconnecting.

The engineer in me wants to dig deeper to figure out what is going on but the desire to stop being yelled at by the wife that the iPad’s aren’t working is winning out right now so I am just happy to have the issue seemingly fixed even without a root cause identified.