Einstein42 / udi-ecobee-poly

Ecobee Poly
MIT License
5 stars 2 forks source link

Crash on timeout error with 522 code #52

Closed jimboca closed 4 years ago

jimboca commented 4 years ago

Log shows this:

2020-03-16 17:00:26,578 [Controller] [DEBUG] Ecobee Controller:post: Sending: url=https://api.ecobee.com/token payload={}
2020-03-16 17:00:56,996 [Controller] [DEBUG] Ecobee Controller:reponse:post:  Got: code=522
2020-03-16 17:00:56,997 [Controller] [ERROR] Ecobee Controller:reponse:post: Unknown response 522: https://api.ecobee.com/token?grant_type=refresh_token&client_id=19j5o2QheoDIYeuwPGOCWV80hI07lbDC&refresh_token=ltTQtoNHJcG0TrHya53H8hwJz0SpkeGu <!DOCTYPE html>
<

Which results in:

: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/var/polyglot/nodeservers/Ecobee/pgSession.py", line 71, in response
    json_data = json.loads(response.text)
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2020-03-16 17:00:57,001 [Controller] [DEBUG] controller:set_ecobee_st: True=1
2020-03-16 17:00:57,008 [Controller] [ERROR] Exception in thread Controller:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/var/polyglot/.local/lib/python3.7/site-packages/polyinterface/polyinterface.py", line 858, in _parseInput
    self.longPoll()
  File "./ecobee-poly.py", line 204, in longPoll
    self.updateThermostats()
  File "./ecobee-poly.py", line 217, in updateThermostats
    thermostats = self.getThermostats()
  File "./ecobee-poly.py", line 453, in getThermostats
    'includesEquipmentStatus': True
  File "./ecobee-poly.py", line 439, in session_get
    if self._getRefresh() is True:
  File "./ecobee-poly.py", line 123, in _getRefresh
    if 'error' in res_data:
TypeError: argument of type 'bool' is not iterable
jimboca commented 4 years ago

Has not happened again, must be fixed.