xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
203 stars 21 forks source link

[Bug]: Device Discovered, but no datapoints could be found [Anko Wifi Sunset Light] #204

Closed collateral127 closed 1 week ago

collateral127 commented 1 week ago

LocalTuya Version

3.2.5.1

Home Assistant Version

2024.4.3

Environment

What happened?

Tried to add an Anko Sunset Wifi Light (au product, made by mirabella for kmart, uses tuya under the hood - works in tuya smart without issue) and I've pulled the local key from tuya iot using the api explorer - it discovers the device but can't pull any datapoints

If i 'trick' the integration by setting dps to 0, and sleep to 900, it adds without issues, but i can't interact with it, it's permanently unavailable

Steps to reproduce.

  1. Used add new device
  2. Input details
  3. Click submit, wait, error flags

Relevant log output

2024-04-23 12:05:45.252 WARNING (MainThread) [custom_components.localtuya.common] [bfe...07u] Connect to 192.168.1.231 failed: 
2024-04-23 12:20:37.301 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: type_0a)
2024-04-23 12:20:37.302 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838837"}'
2024-04-23 12:20:37.302 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 waiting for seq. number 1
2024-04-23 12:20:42.303 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 timed out waiting for sequence number 1
2024-04-23 12:20:42.421 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: type_0a)
2024-04-23 12:20:42.421 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838842"}'
2024-04-23 12:20:42.421 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 waiting for seq. number 1
2024-04-23 12:20:47.422 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 timed out waiting for sequence number 1
2024-04-23 12:20:47.534 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: type_0d)
2024-04-23 12:20:47.534 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838847","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}'
2024-04-23 12:20:47.534 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 13 waiting for seq. number 1
2024-04-23 12:20:48.254 DEBUG (SyncWorker_12) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:20:52.536 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 13 timed out waiting for sequence number 1
2024-04-23 12:20:52.651 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] 3.4 or 3.5 device: negotiating a new session key
2024-04-23 12:20:52.651 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 3: b'0123456789abcdef'
2024-04-23 12:20:52.651 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102
2024-04-23 12:20:52.760 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: [Errno 104] Connection reset by peer
2024-04-23 12:20:54.302 DEBUG (SyncWorker_26) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:20:57.654 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102
2024-04-23 12:20:57.654 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None), fetch new one - 1 retries remaining
2024-04-23 12:20:57.654 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102
2024-04-23 12:21:00.425 DEBUG (SyncWorker_25) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:02.657 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102
2024-04-23 12:21:02.657 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None) but out of recv retries, giving up
2024-04-23 12:21:02.657 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1
2024-04-23 12:21:02.657 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: v3.4)
2024-04-23 12:21:02.657 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838862"}'
2024-04-23 12:21:02.657 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 16: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838862"}'
2024-04-23 12:21:02.658 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 waiting for seq. number 2
2024-04-23 12:21:06.465 DEBUG (SyncWorker_13) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:07.660 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 timed out waiting for sequence number 2
2024-04-23 12:21:07.739 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] 3.4 or 3.5 device: negotiating a new session key
2024-04-23 12:21:07.739 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 3: b'0123456789abcdef'
2024-04-23 12:21:07.739 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000001000000030000002c3031323334353637383961627179b034f3de18ef80fde4200388bc5ce2277515b4b6fc02b27837b322f1472a00009966'
2024-04-23 12:21:07.739 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102
2024-04-23 12:21:07.747 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: [Errno 104] Connection reset by peer
2024-04-23 12:21:07.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None
2024-04-23 12:21:12.503 DEBUG (SyncWorker_0) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:12.742 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102
2024-04-23 12:21:12.742 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None), fetch new one - 1 retries remaining
2024-04-23 12:21:12.742 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102
2024-04-23 12:21:12.765 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None
2024-04-23 12:21:17.743 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102
2024-04-23 12:21:17.743 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None) but out of recv retries, giving up
2024-04-23 12:21:17.743 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1
2024-04-23 12:21:17.744 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: v3.5)
2024-04-23 12:21:17.744 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838877"}'
2024-04-23 12:21:17.744 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 16: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838877"}'
2024-04-23 12:21:17.744 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000002000000100000008e3031323334353637383961623a6ae5708e8f0ce29aa6e3270389ba029f9bc7271389fb4a0174695457bea23722ef760011f5b509d6c52851c03034d41b2f1a71c971ce6f442fec67f16dc40d0e7da140ef4762fa485ff11e6ea0ecfad1ca15045a6ae3ba5f83c8c4f7ea82f54c0f9baf9ee5ad4be73c9265cb253b3010c1dbb438c81b5454ad94fd0cd9c605455200009966'
2024-04-23 12:21:17.744 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 waiting for seq. number 2
2024-04-23 12:21:17.749 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None
2024-04-23 12:21:18.247 DEBUG (SyncWorker_2) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:22.747 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 timed out waiting for sequence number 2
2024-04-23 12:21:22.747 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] 3.4 or 3.5 device: negotiating a new session key
2024-04-23 12:21:22.747 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 3: b'0123456789abcdef'
2024-04-23 12:21:22.747 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000003000000030000002c3031323334353637383961627179b034f3de18ef80fde4200388bc5cf4428cb4444e8dbbbe1dd200b994c61000009966'
2024-04-23 12:21:22.747 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102
2024-04-23 12:21:24.373 DEBUG (SyncWorker_27) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:27.749 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102
2024-04-23 12:21:27.749 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None), fetch new one - 1 retries remaining
2024-04-23 12:21:27.749 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102
2024-04-23 12:21:30.408 DEBUG (SyncWorker_15) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None) but out of recv retries, giving up
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: v3.5)
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838892"}'
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 16: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713838892"}'
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000004000000100000008e3031323334353637383961623a6ae5708e8f0ce29aa6e3270389ba029f9bc7271389fb4a0174695457bea23722ef760011f5b509d6c52851c03034d41b2f1a71c971ce6f442fec67f16dc40d0e7da140ef4762fa485ff11e6ea0ecfad1ca15045a6ae3ba5f83c8c4f7ea82f54c0f9baf9ee5ad4be73c9265cb25353510c1c42995d7475bb03f0ff3480482c2758f00009966'
2024-04-23 12:21:32.751 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 waiting for seq. number 4
2024-04-23 12:21:36.450 DEBUG (SyncWorker_31) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:37.753 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 timed out waiting for sequence number 4
2024-04-23 12:21:37.754 DEBUG (MainThread) [custom_components.localtuya.config_flow] No DPS able to be detected 
2024-04-23 12:21:37.754 DEBUG (MainThread) [custom_components.localtuya.config_flow] Detected DPS: {}
2024-04-23 12:21:37.754 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Closing connection
2024-04-23 12:21:42.484 DEBUG (SyncWorker_3) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:48.322 DEBUG (SyncWorker_19) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:21:54.358 DEBUG (SyncWorker_16) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:00.392 DEBUG (SyncWorker_18) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:06.447 DEBUG (SyncWorker_6) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:12.572 DEBUG (SyncWorker_21) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:18.307 DEBUG (SyncWorker_22) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:24.338 DEBUG (SyncWorker_26) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:30.379 DEBUG (SyncWorker_17) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:36.414 DEBUG (SyncWorker_8) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast
2024-04-23 12:22:42.461 DEBUG (SyncWorker_0) [custom_components.localtuya.common] [bfe...07u] Disconnected: waiting for discovery broadcast

Diagnostics information.

No response

xZetsubou commented 1 week ago

Your integration version is old... Update to the latest beta version "check beta from HACS then switch to any then again select latest beta manually."

You can't use the "device sleep" option if the isn't meant for it. if you updated to the latest beta version just insert "0" in manual DPS if the device reachable it will connect without sleep option.

If you tested above and still no datapoints found: You don't seems using the cloud API with localtuya so if the device actually doesn't return it status then you will need to manually insert the DPS of your device which you can also get from cloud API.

collateral127 commented 1 week ago

ty! i pulled the dp ids and tried setting them manually, still no dice i tried setting the DPS to 0 and manually configuring from there, but the device created is still permanently unavailable

here are the debug logs from an attempt where i included the DPS info:

2024-04-23 15:45:28.291 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: type_0a) DPS: None 2024-04-23 15:45:28.291 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851128"}' 2024-04-23 15:45:28.291 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 waiting for seq. number 1 2024-04-23 15:45:33.292 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 timed out waiting for sequence number 1 2024-04-23 15:45:33.408 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: type_0a) DPS: None 2024-04-23 15:45:33.408 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851133"}' 2024-04-23 15:45:33.408 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 waiting for seq. number 1 2024-04-23 15:45:38.410 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 10 timed out waiting for sequence number 1 2024-04-23 15:45:38.524 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: type_0d) DPS: None 2024-04-23 15:45:38.524 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851138","dps":{"1":null,"2":null,"3":null,"4":null,"5":null,"6":null,"7":null,"8":null,"9":null,"10":null}}' 2024-04-23 15:45:38.524 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 13 waiting for seq. number 1 2024-04-23 15:45:43.525 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 13 timed out waiting for sequence number 1 2024-04-23 15:45:43.640 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] 3.4 or 3.5 device: negotiating a new session key 2024-04-23 15:45:43.641 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 3: b'0123456789abcdef' 2024-04-23 15:45:43.641 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102 2024-04-23 15:45:43.749 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: [Errno 104] Connection reset by peer 2024-04-23 15:45:48.643 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102 2024-04-23 15:45:48.643 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None), fetch new one - 1 retries remaining 2024-04-23 15:45:48.643 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102 2024-04-23 15:45:53.644 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102 2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None) but out of recv retries, giving up 2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1 2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: v3.4) DPS: None 2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851153"}' 2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 16: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851153"}' 2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 waiting for seq. number 2 2024-04-23 15:45:58.647 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 timed out waiting for sequence number 2 2024-04-23 15:45:58.684 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] 3.4 or 3.5 device: negotiating a new session key 2024-04-23 15:45:58.684 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 3: b'0123456789abcdef' 2024-04-23 15:45:58.685 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000001000000030000002c3031323334353637383961627179b034f3de18ef80fde4200388bc5ce2277515b4b6fc02b27837b322f1472a00009966' 2024-04-23 15:45:58.685 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102 2024-04-23 15:45:58.744 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None 2024-04-23 15:46:03.686 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102 2024-04-23 15:46:03.686 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None), fetch new one - 1 retries remaining 2024-04-23 15:46:03.686 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102 2024-04-23 15:46:03.800 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None 2024-04-23 15:46:08.688 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102 2024-04-23 15:46:08.688 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None) but out of recv retries, giving up 2024-04-23 15:46:08.688 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1 2024-04-23 15:46:08.688 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: v3.5) DPS: None 2024-04-23 15:46:08.689 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851168"}' 2024-04-23 15:46:08.689 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 16: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851168"}' 2024-04-23 15:46:08.689 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000002000000100000008e3031323334353637383961623a6ae5708e8f0ce29aa6e3270389ba029f9bc7271389fb4a0174695457bea23722ef760011f5b509d6c52851c03034d41b2f1a71c971ce6f442fec67f16dc40d0e7da140ef4762fa485ff11e6ea0ecfad1ca15045a6ae3ba5f83c8c4f7ea82f54c0f9baf9ee5ad4be73c9263c22c3a3f10c133e483bf21a524e2d7b73c4a32e0c1de00009966' 2024-04-23 15:46:08.689 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 waiting for seq. number 2 2024-04-23 15:46:08.717 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None 2024-04-23 15:46:08.723 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Connection lost: None 2024-04-23 15:46:13.690 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 timed out waiting for sequence number 2 2024-04-23 15:46:13.691 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] 3.4 or 3.5 device: negotiating a new session key 2024-04-23 15:46:13.691 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 3: b'0123456789abcdef' 2024-04-23 15:46:13.691 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000003000000030000002c3031323334353637383961627179b034f3de18ef80fde4200388bc5cf4428cb4444e8dbbbe1dd200b994c61000009966' 2024-04-23 15:46:13.691 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102 2024-04-23 15:46:18.693 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102 2024-04-23 15:46:18.693 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None), fetch new one - 1 retries remaining 2024-04-23 15:46:18.693 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 waiting for seq. number -102 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 3 timed out waiting for sequence number -102 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] received null payload (None) but out of recv retries, giving up 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending command 10 (device type: v3.5) DPS: None 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Sending payload: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851183"}' 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] final payload for cmd 16: b'{"gwId":"bfecec865b7414fd2fa07u","devId":"bfecec865b7414fd2fa07u","uid":"bfecec865b7414fd2fa07u","t":"1713851183"}' 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] payload encrypted=b'00006699000000000004000000100000008e3031323334353637383961623a6ae5708e8f0ce29aa6e3270389ba029f9bc7271389fb4a0174695457bea23722ef760011f5b509d6c52851c03034d41b2f1a71c971ce6f442fec67f16dc40d0e7da140ef4762fa485ff11e6ea0ecfad1ca15045a6ae3ba5f83c8c4f7ea82f54c0f9baf9ee5ad4be73c9263c22c343410c147e20e0104cbe5dad82ad7ae9a4223ea00009966' 2024-04-23 15:46:23.695 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 waiting for seq. number 4 2024-04-23 15:46:28.698 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Command 16 timed out waiting for sequence number 4 2024-04-23 15:46:28.698 DEBUG (MainThread) [custom_components.localtuya.config_flow] No DPS able to be detected 2024-04-23 15:46:28.698 DEBUG (MainThread) [custom_components.localtuya.config_flow] Detected DPS: {} 2024-04-23 15:46:28.698 DEBUG (MainThread) [custom_components.localtuya.config_flow] Manual DPS Setting: 20,21,24,25,26,27,28,29,31,32,33,34 (['20', '21', '24', '25', '26', '27', '28', '29', '31', '32', '33', '34']) 2024-04-23 15:46:28.698 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] Closing connection

xZetsubou commented 1 week ago

try auto protocol version it test all of them. because from the logs the device doesn't responses. keep in mid if the localkey device won't response but will connect.

2024-04-23 15:45:53.645 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bfe...07u] session key negotiation failed on step 1

collateral127 commented 1 week ago

i've definitely been selecting auto protocol each time, and telnetting on 6668 to the light works, so there's no network connectivity issues

xZetsubou commented 1 week ago

Yes, the localtuya reached the device however the device doesn't responses back then it most be something wrong. That doesn't let the device responses back which can be protocol version, device id or localkey.

collateral127 commented 1 week ago

would anything change if i put the light in pairing mode?

collateral127 commented 1 week ago

the local key has special characters in it - as i understand, most local keys don't - could that have something to do with it?

xZetsubou commented 1 week ago

If you disconnected the device from smart life then it will disconnect from your local network as well this won't let localtuya reach the device. Maybe something went wrong the device information you retrieved that's something else. so re-pairing to smart life, the device would change the device ID and localkey.

the local key has special characters in it - as i understand, most local keys don't - could that have something to do with it?

It's fine if the localkey has special characters, I did made test on my one of devices and it raise the same error as yours when I insert incorrect localkey. this is one of my devices as an example. however I didn't manually put the information since I'm using cloud API.

note: the discovery module only detect "host, device id and protocol version"

collateral127 commented 1 week ago

oh ok; that's interesting - i pulled the local key directly from the tuya IOT platform, and i do have the cloud api configured, it just doesn't pick up anything in the autodiscover - i do have my home assistant on a separate vlan to these, but i do allow traffic to pass between the lights and my home assistant instance; could the vlan setup have something to do with it?

xZetsubou commented 1 week ago

Having the devices and Home Assistant of different VLANs the discovery module won't works and wont detect the devices automatically however if you set-up cloud API on localkey it's still possible to pull data by only inserting the device ID

Example

This is just help I made for those who doesn't have Tuya Devices and Home Assistant within the same VLAN because discovery module only works if they both within the same VLAN. note that cloud API only retrieve the localkey for you the rest is exposed by your device locally. ![fields auto-correction](https://github.com/xZetsubou/hass-localtuya/assets/46300268/68db3e87-c842-4808-9ac9-023f72310450)

I do know that having the devices on different VLAN that doesn't have internet access may results some issues if it blocked incorrectly, but assuming you said Cloud Tuya works then I guess you aren't blocking it.

collateral127 commented 1 week ago

well i'm an idiot you were 100% right - i was using the wrong local key, i had my devices mixed up as far as the local ip went and was authenticating with the wrong details i got all the lights added once i ran tinytuya wizard to map individual local ips to the correct device id and local key thanks heaps for all of your help and patience