Hello everyone,
I'm trying to add smart sockets via this integration but I get 2 errors. I'll briefly explain the situation and then I'll attach the error logs.
I own 6 smart sockets from 2 different brand, teckin and bakibo both have the possibility to track the energy consumption and both brands works fine the official "Tuya" integration.
I obtained, via the tuya developer account both the Device ID and the product ID (or the Local key) list of all my product (How will I proceed once the trial will end?)
I firstly removed the official Tuya Integration and then, after reboot, I installed the integration via HACS, rebooted, and, via the auto discovery feature, try to add my sockets, it found but when I tried to config it gets an error. Here it's the error in the GUI:
I'm sure both the Devide ID and the product ID are exact (direct copy).
On the logs I got:
Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:429
Integration: LocalTuya integration (documentation, issues)
First occurred: 22:59:15 (1 occurrences)
Last logged: 22:59:15
[031530xxxxxxxxxxxxx] Failed to get status: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/config/custom_components/localtuya/pytuya/__init__.py", line 466, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 429, in status
if "dps" in status:
TypeError: argument of type 'NoneType' is not iterable
and also:
Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/pytuya/__init__.py:429
Integration: LocalTuya integration (documentation, issues)
First occurred: 22:59:15 (1 occurrences)
Last logged: 22:59:15
Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/localtuya/config_flow.py", line 238, in async_step_basic_info
self.dps_strings = await validate_input(self.hass, user_input)
File "/config/custom_components/localtuya/config_flow.py", line 173, in validate_input
detected_dps = await interface.detect_available_dps()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 466, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 429, in status
if "dps" in status:
TypeError: argument of type 'NoneType' is not iterable
--------------EDIT:
Sometimes, at the first try it gives me "An unknown error occurred. See log for details."
in the logs:
Unable to find referenced entities switch.xxxxxxxxxxxxxxxxxxxxx
[xxxxxxxxxxxxxxxxxxxxxxxxx] Failed to get status: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/config/custom_components/localtuya/pytuya/__init__.py", line 466, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 429, in status
if "dps" in status:
TypeError: argument of type 'NoneType' is not iterable
Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/localtuya/config_flow.py", line 238, in async_step_basic_info
self.dps_strings = await validate_input(self.hass, user_input)
File "/config/custom_components/localtuya/config_flow.py", line 173, in validate_input
detected_dps = await interface.detect_available_dps()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 466, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 429, in status
if "dps" in status:
TypeError: argument of type 'NoneType' is not iterable
[xxxxxxxxxxxxxxxxxxxxxxxx] Failed to get status: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/config/custom_components/localtuya/pytuya/__init__.py", line 466, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 428, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 413, in exchange
payload = self._decode_payload(msg.payload)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 515, in _decode_payload
return json.loads(payload)
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/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)
---------------------------------- finish edit------------------
So I tried the traditional way:
and I get:
Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:593
Integration: LocalTuya integration (documentation, issues)
First occurred: 23:12:54 (3 occurrences)
Last logged: 23:13:03
Connect to 192.168.178.47 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 141, in _make_connection
self._interface = await pytuya.connect(
File "/config/custom_components/localtuya/pytuya/__init__.py", line 593, in connect
_, protocol = await loop.create_connection(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionResetError: [Errno 104] Connect call failed ('192.168.178.47', 6668)
and also:
Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:429
Integration: LocalTuya integration (documentation, issues)
First occurred: 23:13:04 (3 occurrences)
Last logged: 23:13:19
Connect to 192.168.178.47 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 151, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 429, in status
if "dps" in status:
TypeError: argument of type 'NoneType' is not iterable
as you can see I tried also another socket.
Anyone could help me?
Thank you