smarthomej / addons

SmartHome/J addons for openHAB
Eclipse Public License 2.0
59 stars 23 forks source link

Tuya Things Not Connecting after migration to openHAB 3.3.0M4 #363

Closed BigGeorgeTx closed 2 years ago

BigGeorgeTx commented 2 years ago

After migrating to M4 yesterday, I noticed that two Tuya Things were not coming on line. Both the these devices were working fine in previous versions, and are not the ones I had had trouble with previously. After migrating, I removed the Tuya addon and readded it to get the current version. I also tried the current Develop version and got the same result.

I set the log to DEBUG and disabled/enabled one of the Things:

2022-05-02 08:32:49.450 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from UNINITIALIZED (DISABLED) to INITIALIZING ==> /var/log/openhab/openhab.log <== 2022-05-02 08:32:49.456 [INFO ] [a.internal.handler.TuyaDeviceHandler] - Configuring IP address 'DeviceInfo{ip='192.168.1.206', version='3.3'}' for thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw'. ==> /var/log/openhab/events.log <== 2022-05-02 08:32:49.458 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from INITIALIZING to UNKNOWN ==> /var/log/openhab/openhab.log <== 2022-05-02 08:32:49.717 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.226', deviceId='ebb442e79ea9c02fb35xs8', active=2, ability=0, mode=0, encrypt=true, productKey='keytg5kq8gvkv9dh', version='3.3'}'} ==> /var/log/openhab/events.log <== 2022-05-02 08:32:49.863 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GeorgesiPhoneiPhone13Pro_Online' changed from ON to OFF 2022-05-02 08:32:49.866 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'GeorgePresentAllDevices' changed from ON to OFF through Presence_Mobile_George 2022-05-02 08:32:49.868 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Presence_Mobile_George' changed from ON to OFF 2022-05-02 08:32:49.870 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GeorgesiPhoneiPhone13Pro_Latency' changed from 62 ms to UNDEF ==> /var/log/openhab/openhab.log <== 2022-05-02 08:32:51.102 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP, content='DiscoveryMessage{ip='192.168.1.247', deviceId='36802558840d8e95f3c4', active=2, ability=0, mode=0, encrypt=true, productKey='pJnpT0XcM5FTRjOd', version='3.1'}'} 2022-05-02 08:32:51.461 [DEBUG] [nding.tuya.internal.local.TuyaDevice] - ebb8edc2de0ce2e480xkxw: Failed to connect: connection timed out: /192.168.1.206:6668 ==> /var/log/openhab/events.log <== 2022-05-02 08:32:51.463 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from UNKNOWN to OFFLINE

Then I changed the log level to TRACE and cycled it: 2022-05-02 08:40:06.222 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from OFFLINE to UNINITIALIZED 2022-05-02 08:40:06.232 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from UNINITIALIZED to UNINITIALIZED (DISABLED) ==> /var/log/openhab/openhab.log <== 2022-05-02 08:40:06.244 [TRACE] [.internal.local.handlers.TuyaDecoder] - ebf3cb07f3574a9688z4oy/192.168.1.148:6668: Received encoded '000055AA00000000000000090000000C00000000B051AB030000AA55' 2022-05-02 08:40:06.245 [TRACE] [.internal.local.handlers.TuyaDecoder] - ebf3cb07f3574a9688z4oy//192.168.1.148:6668: Decoded raw payload: 2022-05-02 08:40:06.246 [DEBUG] [.internal.local.handlers.TuyaDecoder] - ebf3cb07f3574a9688z4oy//192.168.1.148:6668: Received MessageWrapper{commandType=HEART_BEAT, content=''} 2022-05-02 08:40:06.247 [TRACE] [rnal.local.handlers.HeartbeatHandler] - ebf3cb07f3574a9688z4oy/192.168.1.148:6668: Received pong ==> /var/log/openhab/events.log <== 2022-05-02 08:40:07.383 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GeorgesiPhoneiPhone13Pro_Latency' changed from 46 ms to 491 ms ==> /var/log/openhab/openhab.log <== 2022-05-02 08:40:07.813 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA0000000000000013000000CC00000000D09766676F3369EB10B5E9F132FD802AE33F0A22D663644012FC8D872BCF03D07B64C8DD4401899000716D5170D1858B0B1B576FA1E157538A210ED25F4C31067256F992EF0BB3C9946F6CA8E2E148532E0DBC9A92C3317286EBF238BE57978641CBF9244804CF3DC911CADA0E75770803BF05AC9D8E6CCA4A3B9E5968A55B0DCC37291424EC2B5401F4F50D7EB6A63204AF131AE1CD3F0E4AB9A53DA72F98A860AA2C49651FE3647EC7D0F2B59EED6BD482232E3BD3BF5CF00BC08816559FD63AEB11330000AA55' 2022-05-02 08:40:07.814 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.246","gwId":"eb755c84e755bbd761ymwj","active":2,"ablilty":0,"encrypt":true,"productKey":"keyyj3fy8x98arty","version":"3.3","lan_cap":5000,"lan_seq":27,"token":true} 2022-05-02 08:40:07.816 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.246', deviceId='eb755c84e755bbd761ymwj', active=2, ability=0, mode=0, encrypt=true, productKey='keyyj3fy8x98arty', version='3.3'}'} 2022-05-02 08:40:07.837 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802AFC41B78182A5D63EE2972DC4C24AF26DEB231811511651D6030733901EC3C44AF3AFEDCA50D58DBC2B584825DCE135647256F992EF0BB3C9946F6CA8E2E148532E0DBC9A92C3317286EBF238BE5797868092865457F0696695F897C5D1D5127EF3FA80099F694CCB1412FB4BF23282687A23E3B2249F5ADF48A714F851AAF4392877DE100000AA55' 2022-05-02 08:40:07.839 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.148","gwId":"ebf3cb07f3574a9688z4oy","active":2,"ablilty":0,"encrypt":true,"productKey":"keygg897krt5kk4t","version":"3.3"} 2022-05-02 08:40:07.840 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.148', deviceId='ebf3cb07f3574a9688z4oy', active=2, ability=0, mode=0, encrypt=true, productKey='keygg897krt5kk4t', version='3.3'}'} 2022-05-02 08:40:08.999 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802A3EDB2FB5FEFF0568F68195638EDEDF92FC42CFBC87C56B05EADFF8A6A44376C01AC8F3F3C78B01106FB63E08EE964D247256F992EF0BB3C9946F6CA8E2E148532E0DBC9A92C3317286EBF238BE5797868092865457F0696695F897C5D1D5127EF3FA80099F694CCB1412FB4BF23282687A23E3B2249F5ADF48A714F851AAF439EB3C8AB40000AA55' 2022-05-02 08:40:09.002 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.180","gwId":"eb3c82adf880a32bbe5ivy","active":2,"ablilty":0,"encrypt":true,"productKey":"keygg897krt5kk4t","version":"3.3"} 2022-05-02 08:40:09.005 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.180', deviceId='eb3c82adf880a32bbe5ivy', active=2, ability=0, mode=0, encrypt=true, productKey='keygg897krt5kk4t', version='3.3'}'} 2022-05-02 08:40:09.009 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802AB5CC3CB4691A94082F96F1F413ADCDFD204C082BA5001B8F04F84D572A6D06012FD49AE1EB2FED8853E642A618B5ED077256F992EF0BB3C9946F6CA8E2E148532E0DBC9A92C3317286EBF238BE579786F4C1F700BD0A36716389950D991E16BAA2647AE2696B993AD82600478BF988287A23E3B2249F5ADF48A714F851AAF439014E4A910000AA55' 2022-05-02 08:40:09.011 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.236","gwId":"eb349b6012eb05c13103yh","active":2,"ablilty":0,"encrypt":true,"productKey":"keydqydsydtu759x","version":"3.3"} 2022-05-02 08:40:09.018 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.236', deviceId='eb349b6012eb05c13103yh', active=2, ability=0, mode=0, encrypt=true, productKey='keydqydsydtu759x', version='3.3'}'} 2022-05-02 08:40:09.133 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000000000009F000000007B226970223A223139322E3136382E312E323437222C2267774964223A223336383032353538383430643865393566336334222C22616374697665223A322C226162696C697479223A302C226D6F6465223A302C22656E6372797074223A747275652C2270726F647563744B6579223A22704A6E70543058634D354654526A4F64222C2276657273696F6E223A22332E31227D157010A20000AA55' 2022-05-02 08:40:09.135 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP, content='DiscoveryMessage{ip='192.168.1.247', deviceId='36802558840d8e95f3c4', active=2, ability=0, mode=0, encrypt=true, productKey='pJnpT0XcM5FTRjOd', version='3.1'}'} ==> /var/log/openhab/events.log <== 2022-05-02 08:40:09.455 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from UNINITIALIZED (DISABLED) to INITIALIZING ==> /var/log/openhab/openhab.log <== 2022-05-02 08:40:09.463 [INFO ] [a.internal.handler.TuyaDeviceHandler] - Configuring IP address 'DeviceInfo{ip='192.168.1.206', version='3.3'}' for thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw'. ==> /var/log/openhab/events.log <== 2022-05-02 08:40:09.466 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from INITIALIZING to UNKNOWN ==> /var/log/openhab/openhab.log <== 2022-05-02 08:40:10.060 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802A54D88E00A3B4A4A2204F34DE830A29ED2E7325F499B9E9A8648DCA37AF2A0B57E739C6263C39E3377EBF023BC95EDF927256F992EF0BB3C9946F6CA8E2E148532E0DBC9A92C3317286EBF238BE579786C53E2EC89795E9175FE31010E9BBE1E894A8C1D46E5D4AFF82F9EE5AB2265C147A23E3B2249F5ADF48A714F851AAF43904714B620000AA55' 2022-05-02 08:40:10.063 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.226","gwId":"ebb442e79ea9c02fb35xs8","active":2,"ablilty":0,"encrypt":true,"productKey":"keytg5kq8gvkv9dh","version":"3.3"} 2022-05-02 08:40:10.065 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.226', deviceId='ebb442e79ea9c02fb35xs8', active=2, ability=0, mode=0, encrypt=true, productKey='keytg5kq8gvkv9dh', version='3.3'}'} 2022-05-02 08:40:11.469 [DEBUG] [nding.tuya.internal.local.TuyaDevice] - ebb8edc2de0ce2e480xkxw: Failed to connect: connection timed out: /192.168.1.206:6668 ==> /var/log/openhab/events.log <== 2022-05-02 08:40:11.472 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:ebb8edc2de0ce2e480xkxw' changed from UNKNOWN to OFFLINE

BigGeorgeTx commented 2 years ago

I was able to resolve this by: 1) Removing the device from the Smart Life App 2) Removing the Thing from openHAB 3) Adding the device to the Smart Life App, and 4) Adding a new Thing from the inbox in openHAB UI 5) Linking the previous items to the Thing

In troubleshooting, I found that I could always operate the device from the Smart Life app. But it was offline in openHAB. I logged in my Tuya Cloud account and unsurprisingly, it was offline there. It doesn't make sense to me that the Tuya Smart Life app was working perfectly to control it, yet the Tuya Cloud showed it was offline.

So it appears that it is working now as expected. Probably didn't have anything to do with the binding. Glad to have it working. It does have a different device ID now. Not surprisingly, the device did not work in the Alexa App either. I deleted the device and then rediscovered it and it is working.

J-N-K commented 2 years ago

Maybe this is related to a firmware update on the device. If it‘s working again and the binding behaves similar to the cloud it looks ok for me.

BigGeorgeTx commented 2 years ago

Could be a firmware update. I think it looked a little different in Smart Life, so probably that is it.