home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.13k stars 29.8k forks source link

ERROR during TUYA Setup #15607

Closed Coolie1101 closed 6 years ago

Coolie1101 commented 6 years ago

Home Assistant release with the issue: 0.74.0

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.): Hassbian

Component/platform: TUYA

Description of problem: Error during platform setup

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

tuya:
  username: !secret tuya_username
  password: !secret tuya_password
  country_code: 1

Traceback (if applicable):

2018-07-21 19:50:42 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform tuya
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/switch/tuya.py", line 48, in setup_platform
    config.get(CONF_LOCAL_KEY)
  File "/srv/homeassistant/lib/python3.5/site-packages/pytuya/__init__.py", line 249, in __init__
    super(OutletDevice, self).__init__(dev_id, address, local_key, dev_type)
  File "/srv/homeassistant/lib/python3.5/site-packages/pytuya/__init__.py", line 146, in __init__
    self.local_key = local_key.encode('latin1')
AttributeError: 'NoneType' object has no attribute 'encode'

Additional information:

fryguy04 commented 5 years ago

i was having same error, stumbed upon this closed issue with no fix/explanation .. for those who may encounter this ... our issue was that we created a "custom_component" for Tuya (which was the old way) and it was conflicting

Original solution post: https://community.home-assistant.io/t/0-74-tuya-cloudflare-dns-push-camera-and-users-ui/60562/28