Closed KixMan28 closed 3 years ago
@rospogrigio Is there anyone who can help me with this issue?
@ultratoto14 Is there anyone who can help me with this issue?
Hi, sorry for the late reply. It looks like the device is not responding, I would suggest to double check that the localKey is correct. You could also try to launch the tuyadebug script you find mentioned in the readme page. Also, make sure that your Tuya app is closed (or disconnect your phone), because some devices don't allow multiple connections (I would suggest to use the Jinvoo app in this case, that seems to allow those instead). Good luck, hope I have been helpful....
@rospogrigio Thank you for your reply. I have checked the localKey was correct. I used the debug process described in the readme page (setting the logger to log the localtuya in debug mode). I have inserted the debug messages in my initial post. I don't know what do you mean by the tuyadebug script. I am currently using the Tuya app, but I will try the Jinvoo app too.
I mean using this: https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump
@rospogrigio Thank you. Here is the outcome:
INFO:localtuya:localtuya version 1.0.0
INFO:localtuya:Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device 601175472462ab427c47 [192.168.1.29], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"601175472462ab427c47","devId":"601175472462ab427c47"}'
DEBUG:localtuya.pytuya:DATA RECEIVED!
DEBUG:localtuya.pytuya:decode payload=b'{\x97cP\xbd\xa0\x044\x16\xd7D\xdb\xf4$f\xb2\xdc\x85\x9e\xed\x98\x02\xb8P@\xab\x10+\xce4\x0et)\xb2\xed\\\xde=\xce\x80KG\x8d9\x8c\xff\x83\xb2x\xc93\xf5\x1dg\xb0\xd2\x93\x1fQ\x9f\x0ex\xb2\xad~uF\xa4ix\xe2^\xeb\x12\x9a\x17\xab>cS'
DEBUG:localtuya.pytuya:decrypted result='{"devId":"601175472462ab427c47","dps":{"1":false,"7":0,"101":false}}'
AVAILABLE DPS ARE [{'1': False, '7': 0, '101': False}]
INFO:localtuya:COMPLETE response from device 601175472462ab427c47 [192.168.1.29] .
**** deviceInfo returned OK ****
TuyaDebug (Tuya DPs dump) [1.0.0]
Device 601175472462ab427c47 at 192.168.1.29 key b88615bdc5ddbdad protocol 3.3 dev_type type_0a:
DPS [1] VALUE [False]
DPS [7] VALUE [0]
DPS [101] VALUE [False]
Currently the device is liked to Tuya app. In the app I can use it as intended.
If I try to integrate it in localTuya in HA, I get this error:
Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:557
Integration: LocalTuya (documentation, issues)
First occurred: 10:03:15 AM (1 occurrences)
Last logged: 10:03:15 AM
[601...c47] Failed to get status: 'utf-8' codec can't decode byte 0x97 in position 1: invalid start byte
Traceback (most recent call last):
File "/config/custom_components/localtuya/pytuya/__init__.py", line 510, in detect_available_dps
data = await self.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 457, in exchange
payload = self._decode_payload(msg.payload)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 557, in _decode_payload
payload = payload.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 1: invalid start byte
What to do next?
Well, at least it works. Hard to tell... can you share your YAML configuration, assuming you are using YAML? I believe your main DP is 7, and has 0-1-2 possible values. Maybe also @postlund can give some support if he's not too busy at the moment.
@rospogrigio Which YAML configuration are you referring to?
You have 2 ways to setup your device: using YAML or config flow, please refer to the README. I believe you are using config flow and for some reason it's not working, so I would give YAML a try.
@rospogrigio Yes, so far I tried to setup the device using config flow. My other devices all worked fine with that method. I will try setting up the garage door using YAML. I am reading now about this topic (Wofea WG-088) on the Tasmota repository. I am trying to identify which DPS doing what and how to set them up in the YAML config.
It looks like the DPS 1 is a switch (actualy kind of momentary switch), DPS 101 is the reed sensor and they couldn't identify DPS 7. Do you have any hint how my YAML config should look like?
By the way my garage door opener is this one: https://www.aliexpress.com/item/32997953761.html?spm=a2g0s.9042311.0.0.27424c4dmGtouE
You should operate the device (open / close) manually or with the app and see how the DPs change during the operations. I am expecting DP 7 to change to 1 and 2 but it can also be some other values. If it's 1 and 2 I think you have to patch the code to make it work, and I can make a PR for you once you manage to make it work.
@rospogrigio I have tested my garage opener and here is the outcome: 1) if the garage door is open both DPS 1 and DPS 101 are TRUE, DPS 7 is 0 2) if the garage door is closed both DPS 1 and DPS 101 are FALSE, DPS 7 is 0
If I set a countdown timer in the app, the DPS 7 will have the value of this timer in seconds. Each time when I run the test.py it will show a different value for the DPS 7, according to the current value of the timer.
Can you provide me a sample YAML config for my case which I could then refine for my use case?
Mmm, I mean you need to get the values DURING opening, not when it's stopped. We need to understand the DPs status for the 3 situations: opening, closing, stopped. Then we can discuss about configuration and coding.
As long as the reed sensor is open, both DPS 1 and DPS 101 will show TRUE, regardless if the garage door is stopped in the middle (is half open) or fully open and they stay TRUE until the reed sensor gets closed, when both will display FALSE.
What should I try else?
I have tried to create a YAML configuration. This is what I came up with:
localtuya:
- host: 192.168.1.XX
device_id: XXX
local_key: XXX
friendly_name: Garage Door
protocol_version: "3.3"
entities:
- platform: binary_sensor
friendly_name: Garage Door Status
id: 101
state_on: "open" # Optional
state_off: "closed" # Optional
- platform: cover
friendly_name: Garage Door
id: 1
After HA restart, these are the error messages>
2021-01-29 19:06:53 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Garage Door (YAML) for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 321, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 144, in async_unload_entry
return await hass.data[DOMAIN].async_unload_entry(entry)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry
raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
2021-01-29 19:06:53 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Garage Door (YAML) for cover
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 321, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/cover/__init__.py", line 164, in async_unload_entry
return await hass.data[DOMAIN].async_unload_entry(entry)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry
raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
2021-01-29 19:06:53 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Garage Door (YAML) for localtuya
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 321, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File "/config/custom_components/localtuya/__init__.py", line 269, in async_unload_entry
hass.data[DOMAIN][entry.entry_id][UNSUB_LISTENER]()
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 418, in <lambda>
return lambda: self.update_listeners.remove(weak_listener)
ValueError: list.remove(x): x not in list
Any hint to go further?
@rospogrigio do you have any idea what else to try?
@KixMan28 I found the same problem when adding my WG-088. I managed to get it to work when using localTuya versions v3.0.x, once upgrading to v3.1.0 and v3.2.0 the same problem came back. So something must have changed between v3.0.3 and v3.1.0.
@stanvx Thank you for the hint. I will try to downgrade my localTuya to the version you mentioned and give it a try.
@rospogrigio Do you have anything to add this topic?
Frankly no... let's try to downgrade and see if it works, and if it does we need to find the differences to see where is the issue.
@rospogrigio I have downgraded localtuya to ver 3.0.3 and when I try to add my garage door via the Integrations page, i get this error:
2021-02-12 09:49:13 ERROR (MainThread) [custom_components.localtuya.pytuya] [601175472462ab427c47] 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
2021-02-12 09:49:13 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
Any suggestions?
No sorry, maybe @postlund can give a hand....
From you DPS dump, you have only 3 DPs available, the DP 1 can have value true or false, it's more like a switch than a cover. Seems that in the code, cover is managing on/off, open/close but not true/false
Ensure to remove all the devices belonging to the garage door from integration > localtuya
Replace you config by something really minimal as this:
localtuya:
- host: 192.168.1.XX
device_id: XXX
local_key: XXX
friendly_name: Garage Door
protocol_version: "3.3"
entities:
- platform: switch
friendly_name: Garage Door Switch
id: 1
Then you can try to see if with this switch you can control your garage door. As you have the device set up, you can then use the service localtuya.set_dp to play with your device.
As a general remark, you should always check with the latest code as it's really time consuming to debug an old version. So stay with latest.
@ultratoto14 Thank you for your suggestions. I will try to do what you have recommended. I downgraded to ver 3.0.3 based on @rospogrigio advice. I will update localtuya to the latest version and will report back on the result.
@KixMan28 no problem, I read the thread, it's a good advice to get back and check on old version, it is always a good thing to see if the new versions introduce a problem. I ment if the test is non conclusive, get back to latest 😄
@ultratoto14 I have tested, as promised, in both old version and news version, and both in YAML and integration. Currently i have set it up as YAML in the latest version and the device is sometimes available and sometimes not.
The current error message is the following:
Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:557
Integration: LocalTuya (documentation, issues)
First occurred: February 13, 2021, 11:07:20 PM (3425 occurrences)
Last logged: 10:12:37 AM
[601...c47] Connect to 192.168.1.18 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 149, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 457, in exchange
payload = self._decode_payload(msg.payload)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 557, in _decode_payload
payload = payload.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 1: invalid start byte
Do you have any hint what to do?
It would be helpful to go into debug mode (see README) for localtuya and get the messages that the component failed to decode.
@ultratoto14 Hi! Finally I succeeded to run the Debug mode. My garage door opener has the IP address: 192.168.1.18. Please see below the debug report:
2021-02-17 18:38:18 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.25', 'gwId': '6c87dd06cc41909c22osyf', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'keym......rvs', 'version': '3.3'}
2021-02-17 18:38:18 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.25', 'gwId': '6c87dd06cc41909c22osyf', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'keym......rvs', 'version': '3.3'}
2021-02-17 18:38:18 DEBUG (MainThread) [custom_components.localtuya.discovery] Listening to broadcasts on UDP port 6666 and 6667
2021-02-17 18:38:19 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.4', 'gwId': '6c8a8bda874bbe1b1blb4j', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'teuu......rxm', 'version': '3.3'}
2021-02-17 18:38:19 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.4', 'gwId': '6c8a8bda874bbe1b1blb4j', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'teuu.......rxm', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.9', 'gwId': '7310738124a16009e0af', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keymu......7kkk', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 7310738124a16009e0af found with IP 192.168.1.9
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [731...0af] Connecting to 192.168.1.9
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.9', 'gwId': '7310738124a16009e0af', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key.......7kkk', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 7310738124a16009e0af found with IP 192.168.1.9
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.2', 'gwId': '6c6cfd71a40cec027c5b72', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'teuu........rxm', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 6c6cfd71a40cec027c5b72 found with IP 192.168.1.2
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [6c6...b72] Connecting to 192.168.1.2
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.2', 'gwId': '6c6cfd71a40cec027c5b72', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'teuu.......rxm', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 6c6cfd71a40cec027c5b72 found with IP 192.168.1.2
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.18', 'gwId': '601175472462ab427c47', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'b1uk4ftduaqopxv1', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 601175472462ab427c47 found with IP 192.168.1.18
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [601...c47] Connecting to 192.168.1.18
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.18', 'gwId': '601175472462ab427c47', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'b1uk4ftduaqopxv1', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 601175472462ab427c47 found with IP 192.168.1.18
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.light] [070...52c] Adding light.wall_light_front with configuration: {'brightness_lower': 29, 'brightness_upper': 1000, 'color_temp_min_kelvin': 2700, 'color_temp_max_kelvin': 6500, 'music_mode': False, 'friendly_name': 'Wall Light Front', 'id': 1, 'platform': 'light'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.light] [070...52c] Adding light.wall_light_back with configuration: {'brightness_lower': 29, 'brightness_upper': 1000, 'color_temp_min_kelvin': 2700, 'color_temp_max_kelvin': 6500, 'music_mode': False, 'friendly_name': 'Wall Light Back', 'id': 2, 'platform': 'light'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.light] [6c8...syf] Adding light.desk_lamp_kinga with configuration: {'brightness_lower': 29, 'brightness_upper': 1000, 'color_temp_min_kelvin': 2700, 'color_temp_max_kelvin': 6500, 'music_mode': False, 'friendly_name': 'Desk Lamp Kinga', 'id': 1, 'platform': 'light'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Started heartbeat loop
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Sending command heartbeat (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Send payload: b'{}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Waiting for sequence number -100
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [601...c47] Retrieving initial state
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Sending command status (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Send payload: b'{"gwId":"601175472462ab427c47","devId":"601175472462ab427c47"}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Waiting for sequence number 1
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Started heartbeat loop
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Sending command heartbeat (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Send payload: b'{}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Waiting for sequence number -100
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [6c6...b72] Retrieving initial state
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Sending command status (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Send payload: b'{"gwId":"6c6cfd71a40cec027c5b72","devId":"6c6cfd71a40cec027c5b72"}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Waiting for sequence number 1
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Got heartbeat response
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Dispatching message TuyaMessage(seqno=1, cmd=10, retcode=1, payload=b'\xebB\x1b8\xde\xfe\xc5}\xb9V\x9c\xe2\x00\x81\x03\x18\xd3\xe5lhD\x96\xd3\xb5\xce\x1dn\r\xed\x15\xeb\xf2', crc=3332173225)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Dispatching sequence number 1
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Got heartbeat response
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Dispatching message TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'{\x97cP\xbd\xa0\x044\x16\xd7D\xdb\xf4$f\xb2\xdc\x85\x9e\xed\x98\x02\xb8P@\xab\x10+\xce4\x0et)\xb2\xed\\\xde=\xce\x80KG\x8d9\x8c\xff\x83\xb2x\xc93\xf5\x1dg\xb0\xd2\x93\x1fQ\x9f\x0ex\xb2\xad~uF\xa4ix\xe2^\xeb\x12\x9a\x17\xab>cS', crc=271989284)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Dispatching sequence number 1
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.23', 'gwId': '6ce8fe207cfd557bafwbwg', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'keym9qkuywghyrvs', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 6ce8fe207cfd557bafwbwg found with IP 192.168.1.23
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [6ce...bwg] Connecting to 192.168.1.23
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.23', 'gwId': '6ce8fe207cfd557bafwbwg', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'keym9qkuywghyrvs', 'version': '3.3'}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya] Device 6ce8fe207cfd557bafwbwg found with IP 192.168.1.23
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Started heartbeat loop
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Sending command heartbeat (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Send payload: b'{}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Waiting for sequence number -100
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Decrypted payload: {}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] switching to dev_type type_0d
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Re-send status due to device type change (type_0a -> type_0d)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Sending command status (device type: type_0d)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Send payload: b'{"devId":"6c6cfd71a40cec027c5b72","uid":"6c6cfd71a40cec027c5b72","t":"1613583500","dps":{"1":null,"18":null,"19":null,"20":null}}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Waiting for sequence number 2
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Decrypted payload: {}
2021-02-17 18:38:20 ERROR (MainThread) [custom_components.localtuya.common] [601...c47] Connect to 192.168.1.18 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 149, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 457, in exchange
payload = self._decode_payload(msg.payload)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 557, in _decode_payload
payload = payload.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 1: invalid start byte
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Closing connection
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Got heartbeat response
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [731...0af] Retrieving initial state
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Sending command status (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Send payload: b'{"gwId":"7310738124a16009e0af","devId":"7310738124a16009e0af"}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Waiting for sequence number 1
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Stopped heartbeat loop
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Dispatching message TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00\x05\xd5\x00\x00\x00\x01\xae\xf4\xe4jO\xd9\xcep\xea\x82\x01\x9a\xaa\x18\xbeL\xb2n2\x92\x9e\xd9\xc0\x13\xbcG\x96\xb1\xfc\x7f\xfe0\x14(w~b\x15\xfc\x9fp\xfa\xedc\xa4\x1f\xec2\xd8w0\x13b\x88xN\xe7\xee\xd3\xa8=\xd8\x85\xae', crc=2124670478)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Got status update
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Decrypted payload: {"dps":{"1":true,"18":0,"19":0,"20":2356},"t":1613583499}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Dispatching message TuyaMessage(seqno=2, cmd=13, retcode=0, payload=b'', crc=2380353348)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c6...b72] Dispatching sequence number 2
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [601...c47] Connection lost: None
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.common] [601...c47] Disconnected - waiting for discovery broadcast
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Decrypted payload: {}
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Dispatching message TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\x06B\x01\x04\xb6E\xcd\xc3\x98\x19-\xd9l`\xaf.P\x81\xa4\x12;\xf0\x8b\x1b\xd0N\x9c\x06\xa9\xd7\x8d|9c\xfd\xe3<\xe4B\x88\xf5\xe6Za\xc1z{lG\xb8\xf5\xd5\x12\x97\xf5c\x0blk3\x8c\xaec\xed|O\xf8l\xc4\x89w\xc4\x08\r\x96\x9fyGw\x1a\x04\x15\x07\x87\xe0\xc1\x91\xcbv?\xb8\x02Q\xe3%\xb3\xae\x08\x1d\xf1\xa97s\xd1\x01\xd4\xb3\x11ba\x99\x1f', crc=486043301)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [731...0af] Dispatching sequence number 1
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6ce...bwg] Started heartbeat loop
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6ce...bwg] Sending command heartbeat (device type: type_0a)
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6ce...bwg] Send payload: b'{}'
2021-02-17 18:38:20 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6ce...bwg] Waiting for sequence number -100
Any idea why I have this issue?
@ultratoto14 Can you advise something?
@ultratoto14 Hi! I have been using the device in the previous days with your YAML config. Sometimes it works as intended, but most of the time is "Unavailable" and in the logs I see the error message displayed above. Do you have any suggestion?
@ultratoto14 Here is a screenshot of the availability of the device.
Mine comes up as a switch and can open and close the door based on the yaml config @ultratoto14 posted, using version 3.3 (latest).
Cannot configure via the gui setup.
Happy to help porvide any logs so we can get this going.
I also set up the garage door opener with the YAML code provided by @ultratoto14. sometimes works and most of the time is unavailable. I don't know what to do with it. Maybe I will try to flash it with Tasmota, as I can see here it is supported by the latest version.
I also set up the garage door opener with the YAML code provided by @ultratoto14. sometimes works and most of the time is unavailable. I don't know what to do with it. Maybe I will try to flash it with Tasmota, as I can see here it is supported by the latest version.
Thanks for the link, I'll have a look at tasmota. I've never flashed anything to tasmota, so will see what guides I can find. With nabu casa purchasing esphome I might even just wait for that option
I flashed almost all my Tuya compatiblec devicesc with Tuya Convert and uploded to them ESPhome firmware. I am also looking forward to this Nabu Casa deal, but I couldn't find any relevant info about the future of ESPhome. Maybe we will learn more on the next Home Assistant live stream.
hello all did anyone get this one working? I have it unavailable at all time....
This is my current setting
I also set up the garage door opener with the YAML code provided by @ultratoto14. sometimes works and most of the time is unavailable. I don't know what to do with it. Maybe I will try to flash it with Tasmota, as I can see here it is supported by the latest version.
@highlandtran No luck so far. I already removed my Garage door from HA as it was unavailable all the time, and it was spamming my log with errors and warnings. It work fine in my Tuya app so I am using it there (as I have in there other devices too). Until I am not taking out of the cloud all my other devices, I keep my setup as is today. If you happen to flash Tasmota on your Wofea, it would be nice if you could report back the result here.
@highlandtran @eatoff8 @stanvx @ultratoto14 @rospogrigio Hi All! If nothing happens here, at least please support this enhancement request related to the Tuya V2 integration for Home Assistant.
This device isn't real garage door opener (like mine). It's a switch with sensor. I managed it to work with little tweaking tho. In localtuya set new device trough gui with one switch on dp1 and one binary sensor on dp 101 (see pic). Then use template to convert it to cover:
cover:
- platform: template
covers:
garage_door:
device_class: garage
friendly_name: "Garage Door"
value_template: "{{ is_state('binary_sensor.garage_door_status', 'on') }}"
open_cover:
service: switch.turn_on
entity_id: switch.garage_door_switch
close_cover:
service: switch.turn_off
entity_id: switch.garage_door_switch
Hope this helps...
This device isn't real garage door opener (like mine). It's a switch with sensor. I managed it to work with little tweaking tho. In localtuya set new device trough gui with one switch on dp1 and one binary sensor on dp 101 (see pic).
Then use template to convert it to cover:
Hope this helps...
Hi mate, not realy work for me, what is your setting on this?
i only have 1 tick
Do not set it as cover, but switch. and second entity as binary sensor
EDIT: To add second entity, after setup first (switch) untick "Do not add..." and you can add next entity to device...
@patrik-malina Thank you for your input. I will give it a try. My biggest problem is that this device is recognized only by the Tuya app (as garage door opener with countdown feature). None of the integrations (localtuya, HA Tuya nor HA Tuya V2) will recognize it automatically, although it is listed in the Tuya Developer devices.
Work perfectly for me now, thank you @patrik-malina @KixMan28 should work with Localtuya
@patrik-malina Thank you for the hint. So far it works for me too. As this device has also a dp7, which should be a timer, can I do anything with it?
You could add it as sensor (not binary) without class: Then change it with service, for exmple:
service: localtuya.set_dp
data:
device_id: -YOURDEVICEID-
dp: 7
value: 1800
@patrik-malina Thank you. I will test it.
So far the @patrik-malina solution works. Thank you again for the hint
I am running HA on a RPI 3B+, with HA ver 2021.1.4, HassOS I have installed the latest localtuya V3.2.0.
I have several smart sockets and, wall switch and a garage door opener in my Tuya app. I could integrate all devices in localtuya, except the garage door opener. When I try to add it to localtuya, I get the following errors:
and this error:
What is the problem? What should I do to have this integrated in localtuya?