Closed collateral127 closed 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.
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
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
i've definitely been selecting auto protocol each time, and telnetting on 6668 to the light works, so there's no network connectivity issues
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.
would anything change if i put the light in pairing mode?
the local key has special characters in it - as i understand, most local keys don't - could that have something to do with it?
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"
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?
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
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.
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
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.
Relevant log output
Diagnostics information.
No response