Tuya integration stopped working 2d ago - **SOLVED**

I noticed this integration stopped working 2 days ago, coincidentally when Smart Life upgraded their app to 3.12.3 (on IOS). Or perhaps when I upgraded Hass.io to 188 also around the same time.

Hass.io supervisor

|Version|188|
|Latest version|188|

Anyone have any fixes? The app works fine, but I get this in HA:

2019-09-24%2015_10_27-Home%20Assistant
And this in the log:

Log Details (ERROR)
Tue Sep 24 2019 01:29:42 GMT-0700 (Pacific Daylight Time)
Error during setup of component tuya
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 334, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x72d74b70>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='px1.tuyaus.com', port=443): Max retries exceeded with url: /homeassistant/auth.do (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x72d74b70>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 172, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 62, in setup
    tuya.init(username, password, country_code, platform)
  File "/usr/local/lib/python3.7/site-packages/tuyaha/tuyaapi.py", line 44, in init
    self.get_access_token()
  File "/usr/local/lib/python3.7/site-packages/tuyaha/tuyaapi.py", line 59, in get_access_token
    'from': 'tuya'
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='px1.tuyaus.com', port=443): Max retries exceeded with url: /homeassistant/auth.do (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x72d74b70>: Failed to establish a new connection: [Errno 111] Connection refused'))

when I try to connect to https://px1.tuyaus.com I get a 404 error

Jeff

I downgraded Hass.io from 99.2 (I think that’s what I had upgraded to ( it was 2 days ago) and it started working again:

Home Assistant 0.99.2 is available and you are currently running Home Assistant **0.98.5**.

So, 98.5 works with my Tuya switches, 99.2 does NOT.

Please be sure to open an issue about your issue.

Happy to but I don’t see Hass.io anywhere…

That’s because you’re confused :wink:

Hass.io is the install method for Home Assistant - see the FAQ.

Easily confused. Got it. I’ll attempt to open an issue about Home Assistant