alexwohlbruck / covalent

Internet connected lamps! For my senior capstone project💡⚛️🎓
https://alex.wohlbruck.com/project/covalent
2 stars 0 forks source link

Handle connection drop #23

Open alexwohlbruck opened 2 years ago

alexwohlbruck commented 2 years ago

If the connection drops to the lamp, it should attempt to auto reconnect on an interval after about 5-10 attempts. If it still fails, then it should fallback to setup mode.

alexwohlbruck commented 2 years ago

uPy error traceback #1

#ff0090
Sending PONG
Connection closed
Reconnecting to server (Attempt 0)
Unhandled exception in thread started by <bound_method>
Traceback (most recent call last):
  File "app/server.py", line 35, in listen
  File "app/server.py", line 65, in reconnect
  File "app/server.py", line 19, in connect
  File "app/uwebsockets/client.py", line 23, in connect
  File "app/uwebsockets/protocol.py", line 42, in urlparse
RuntimeError: maximum recursion depth exceeded
Failed to send data: {"name": "SEND_LAMP_COMMAND", "data": {"lampId": "625b2a4390519cae452d2140", "state": {"color": "#000000", "touching": false}}}
alexwohlbruck commented 2 years ago

uPy error traceback #2

motion = 0
motion = 1
Unhandled exception in thread started by <bound_method>
Traceback (most recent call last):
  File "app/server.py", line 33, in listen
  File "app/uwebsockets/protocol.py", line 184, in recv
  File "app/uwebsockets/protocol.py", line 91, in read_frame
OSError: [Errno 104] ECONNRESET
motion = 0
Failed to send data: {"name": "SEND_LAMP_COMMAND", "data": {"lampId": "624cc0e6168796dd6d614190", "state": {"color": "#ff0000", "touching": false}}}
Failed to send data: {"name": "SEND_LAMP_COMMAND", "data": {"lampId": "624cc0e6168796dd6d614190", "state": {"color": "#ff0000", "touching": true}}}
Failed to send data: {"name": "SEND_LAMP_COMMAND", "data": {"lampId": "624cc0e6168796dd6d614190", "state": {"color": "#ff0000", "touching": false}}}
motion = 1
motion = 0
motion = 1