You can always try and see what happens, it’s a bit unclear what works and not. But I guess you have to link devices to two accounts if you want to use both integrations and not run into problems.
Ahahaha @postlund , your trout is a f*ckin’ good developer then!!! Where did you find it? And I thought it was you, all this time!!!
Pink bow tie and yellow hat… hmmm… RGB themes may well not work well for you…
The trout, definitely!
I’m not sure, maybe I’m trout…
Just wanted to say I’ve now been using this for nearly a week on a power monitoring plug that I couldn’t flash as there’s no ESP. With the steps in place to get the magic keys I have it running and HA tracking the power consumption and weekly and monthly totals. It’s not missed a beat in the whole week, tracking the power usage nicely and switching instantly (like, Tasmota instant!).
Great job guys, it’s perfect for non-esp hardware. This is on 3.0.1
I am attempting to add the devices with the device configuration uitility using auto discovery. Manually adding the lights has never worked for me.I get this error when trying to add it with protocol 3.1
The following is the error with 3.3
The picture below is the info on the back of the light switch:
See #402 above. You need to get the unique Local Key. A bit of a process to go through.
I have hidden the key for privacy reasons.
Enable debug logs and attach them here so we can see what’s going on:
Please see below for logs:
2020-11-02 11:59:43 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-11-02 12:09:23 ERROR (MainThread) [homeassistant.helpers.entity] Update for cover.eb3ff773a13cee206arirc fails
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 670, in urlopen
httplib_response = self._make_request(
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 426, in _make_request
six.raise_from(e, None)
File “”, line 3, in raise_from
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 421, in _make_request
httplib_response = conn.getresponse()
File “/usr/local/lib/python3.8/http/client.py”, line 1347, in getresponse
response.begin()
File “/usr/local/lib/python3.8/http/client.py”, line 307, in begin
version, status, reason = self._read_status()
File “/usr/local/lib/python3.8/http/client.py”, line 276, in _read_status
raise RemoteDisconnected(“Remote end closed connection without”
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/requests/adapters.py”, line 439, in send
resp = conn.urlopen(
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 726, in urlopen
retries = retries.increment(
File “/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py”, line 403, in increment
raise six.reraise(type(error), error, _stacktrace)
File “/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py”, line 734, in reraise
raise value.with_traceback(tb)
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 670, in urlopen
httplib_response = self._make_request(
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 426, in _make_request
six.raise_from(e, None)
File “”, line 3, in raise_from
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 421, in _make_request
httplib_response = conn.getresponse()
File “/usr/local/lib/python3.8/http/client.py”, line 1347, in getresponse
response.begin()
File “/usr/local/lib/python3.8/http/client.py”, line 307, in begin
version, status, reason = self._read_status()
File “/usr/local/lib/python3.8/http/client.py”, line 276, in _read_status
raise RemoteDisconnected(“Remote end closed connection without”
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 278, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 471, in async_device_update
await self.hass.async_add_executor_job(self.update) # type: ignore
File “/usr/local/lib/python3.8/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 255, in update
self._tuya.update()
File “/usr/local/lib/python3.8/site-packages/tuyaha/devices/base.py”, line 42, in update
success, response = self.api.device_control(
File “/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py”, line 150, in device_control
response = self._request(action, namespace, devId, param)
File “/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py”, line 163, in _request
response = self.requestSession.post(
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 578, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 530, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 643, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.8/site-packages/requests/adapters.py”, line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))
2020-11-02 12:13:53 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-11-02 12:13:53 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-11-02 12:13:58 DEBUG (MainThread) [custom_components.localtuya.discovery] Listening to broadcasts on UDP port 6666 and 6667
2020-11-02 12:13:59 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.228’, ‘gwId’: ‘56166540cc50e379be6c’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘IaA6oFXfDu3tm1Pc’, ‘version’: ‘3.3’}
2020-11-02 12:13:59 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.38’, ‘gwId’: ‘eb1fb11da772c621aatcct’, ‘active’: 2, ‘ablilty’: 0, ‘encrypt’: True, ‘productKey’: ‘pswjx0wszilfkvdg’, ‘version’: ‘3.3’}
2020-11-02 12:14:00 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.207’, ‘gwId’: ‘02240033dc4f227ac901’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘IaA6oFXfDu3tm1Pc’, ‘version’: ‘3.3’}
2020-11-02 12:14:00 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.197’, ‘gwId’: ‘eb764c5bfb6eed765egh47’, ‘active’: 2, ‘ablilty’: 0, ‘encrypt’: True, ‘productKey’: ‘pswjx0wszilfkvdg’, ‘version’: ‘3.3’}
2020-11-02 12:14:00 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.18’, ‘gwId’: ‘02240033ecfabc5fec26’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘IaA6oFXfDu3tm1Pc’, ‘version’: ‘3.3’}
2020-11-02 12:14:01 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.134’, ‘gwId’: ‘eb474e452bb5291490ixl3’, ‘active’: 2, ‘ablilty’: 0, ‘encrypt’: True, ‘productKey’: ‘pswjx0wszilfkvdg’, ‘version’: ‘3.3’}
2020-11-02 12:14:01 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.231’, ‘gwId’: ‘56166540cc50e379bcfe’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘IaA6oFXfDu3tm1Pc’, ‘version’: ‘3.3’}
2020-11-02 12:14:02 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.83’, ‘gwId’: ‘18857573dc4f22b75092’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘9ZzvEHiUp4XwJBlS’, ‘version’: ‘3.3’}
2020-11-02 12:14:02 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.126’, ‘gwId’: ‘eb472376e2e6c1792dhjyh’, ‘active’: 2, ‘ablilty’: 0, ‘encrypt’: True, ‘productKey’: ‘pswjx0wszilfkvdg’, ‘version’: ‘3.3’}
2020-11-02 12:14:03 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.82’, ‘gwId’: ‘02240033dc4f227ac5a4’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘IaA6oFXfDu3tm1Pc’, ‘version’: ‘3.3’}
2020-11-02 12:14:03 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {‘ip’: ‘192.168.1.248’, ‘gwId’: ‘02240033bcddc2b72afc’, ‘active’: 2, ‘ability’: 0, ‘mode’: 0, ‘encrypt’: True, ‘productKey’: ‘IaA6oFXfDu3tm1Pc’, ‘version’: ‘3.3’}
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Started heartbeat loop
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Sending command heartbeat (device type: type_0a)
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Send payload: b’{}’
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Waiting for sequence number -100
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Sending command status (device type: type_0a)
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Send payload: b’{“gwId”:“56166540cc50e379bcfe”,“devId”:“56166540cc50e379bcfe”}’
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Waiting for sequence number 1
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Connection lost: [Errno 104] Connection reset by peer
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Closing connection
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Wait was aborted for seqno 1
2020-11-02 12:15:40 ERROR (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] 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
2020-11-02 12:15:40 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Closing connection
2020-11-02 12:15:40 ERROR (MainThread) [custom_components.localtuya.config_flow] 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
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Started heartbeat loop
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Sending command heartbeat (device type: type_0a)
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Send payload: b’{}’
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Waiting for sequence number -100
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Sending command status (device type: type_0a)
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Send payload: b’{“gwId”:“56166540cc50e379bcfe”,“devId”:“56166540cc50e379bcfe”}’
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Waiting for sequence number 1
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b’’, crc=2958142211)
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Got heartbeat response
2020-11-02 12:15:46 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Decrypted payload: {}
2020-11-02 12:15:51 ERROR (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Failed to get status:
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 407, in exchange
msg = await self.dispatcher.wait_for(seqno)
File “/config/custom_components/localtuya/pytuya/init.py”, line 206, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File “/usr/local/lib/python3.8/asyncio/tasks.py”, line 490, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
2020-11-02 12:15:51 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Closing connection
2020-11-02 12:15:51 ERROR (MainThread) [custom_components.localtuya.config_flow] 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 428, in status
status = await self.exchange(STATUS)
File “/config/custom_components/localtuya/pytuya/init.py”, line 407, in exchange
msg = await self.dispatcher.wait_for(seqno)
File “/config/custom_components/localtuya/pytuya/init.py”, line 206, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File “/usr/local/lib/python3.8/asyncio/tasks.py”, line 490, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
2020-11-02 12:15:51 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Connection lost: None
2020-11-02 12:15:51 DEBUG (MainThread) [custom_components.localtuya.pytuya] [56166540cc50e379bcfe] Closing connection
Please fix the formatting as it’s impossible to read now (use tripe backquotes). Also disable/remove the regular tuya integration before testing as you can’t have both running at the same time.
i see so many tuya local’s on github? can somepoint point me to a stable/good one? also is it on HACS maybe? i am new in this thread, its like 474 posts long
i need it for to control 3 x led strips + 1 power plug with energy monitoring
also if someone as an easy guide to find the id for local devices? its welcome
@rospogrigio , ok did some reading, i added this as a custom repository, then installed 3.0.3 , rebooted HA
but if i click on the + for integrations , Localtuya is not listed?
although its loaded :
2020-11-05 21:28:21 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
why dont i see it in the integtations? i have the official Tuya also installe, do i need to remove it first?
It’s likely a cache issue. Try forcing a refresh or clear your cache and try again. You should also remove the tuya integration before using localtuya or you will most likely encounter problems.
yeah , did an F5 , and now its working and visible
gonna use yaml method now, any1 got an idea i need to use for a RGB ledstrip ?
hmm, yaml method is not working, i need to comment out all lines , except one, otherwise i have error below
localtuya:
- host: !secret tuya_led_alessio_ip
device_id: !secret tuya_led_alessio_id
local_key: !secret tuya_led_alessio_key
friendly_name: Led Alessio2
protocol_version: "3.3"
entities:
- platform: light
friendly_name: Led Alessio2
id: 20 # Usually 1 or 20
# color_mode: 2 # Optional, usually 2 or 21, default: "none"
# brightness: 3 # Optional, usually 3 or 22, default: "none"
# color_temp: 4 # Optional, usually 4 or 23, default: "none"
# color: 5 # Optional, usually 5 (RGB_HSV) or 24(HSV), default: "none"
# brightness_lower: 0 # Optional, usually 0 or 29, default: 29
# brightness_upper: 255 # Optional, usually 255 or 1000, default: 1000
# color_temp_min_kelvin: 2700 # Optional, default: 2700
# color_temp_max_kelvin: 6500 # Optional, default: 6500
error:
Invalid config for [localtuya]: extra keys not allowed @ data['localtuya'][0]['entities'][0]['brightness']. Got 3
extra keys not allowed @ data['localtuya'][0]['entities'][0]['brightness_lower']. Got 0
extra keys not allowed @ data['localtuya'][0]['entities'][0]['brightness_upper']. Got 255
extra keys not allowed @ data['localtuya'][0]['entities'][0]['color']. Got 5
extra keys not allowed @ data['localtuya'][0]['entities'][0]['color_mode']. Got 2
extra keys not allowed @ data['localtuya'][0]['entities'][0]['color_temp']. Got 4
extra keys not allowed @ data['localtuya'][0]['entities'][0]['color_temp_max_kelvin']. Got 6500
extra keys not allowed @ data['localtuya'][0]['entities'][0]['color_temp_min_kelvin']. Got 2700
value is not allowed for dictionary value @ data['localtuya'][0]['entities'][0]['platform']. Got 'light'. (See /config/configuration.yaml, line 348).
You need to check out master
from git to use those features in the light platform as no release contains them yet.
ah 3.0.3 is behind master then ? i need to select master then in hacs?