smarthomej / addons

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

Tuya addon no longer works after update to OH 3.4.1 #453

Closed mikama-org closed 1 year ago

mikama-org commented 1 year ago

Moin,

the Tuya addon no longer works after update to OH 3.4.1. Devices that have already been integrated show online, but do not work. Adding new devices via the scan function does not find any new devices. I've already tried uninstalling and reinstalling the addon, but to no avail.

My system: Ubuntu jammy (22.04.1 LTS) 64Bit Devices: Dual mode Bluetooth WIFI Touch Smart Curtain Switch Timing Remote Control (WF-CS01)

/var/log/openhab/openhab.log shows the following warnings: 2023-02-02 06:58:51.008 [WARN ] [.internal.local.handlers.TuyaDecoder] - bff8dbb469e033256eXXX//192.168.56.250:6668 failed to parse JSON: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ 2023-02-02 06:59:13.787 [WARN ] [.internal.local.handlers.TuyaDecoder] - bf00cabb039c0d11a2XXX//192.168.56.249:6668 failed to parse JSON: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ 2023-02-02 07:03:52.373 [WARN ] [.internal.local.handlers.TuyaDecoder] - bf01d867c57c941040XXX//192.168.56.251:6668 failed to parse JSON: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ ...

J-N-K commented 1 year ago

Can you please set the log level of org.smarthomej.binding.tuya to TRACE and show the entries for this device? Thanks.

mikama-org commented 1 year ago

Here is the log: opehbah.log.gz

J-N-K commented 1 year ago

Thanks, unfortunately this is exactly the wrong part :-) It starts with the error message, but I need to see what happens before the error message (something goes wrong when parsing the response from the device, but I have to see what is returned by the device).

mikama-org commented 1 year ago

So here is the complete log file since openhab started: openhab.log.gz

mikama-org commented 1 year ago

Ok, restarted OH with log level TRACE: openhab.log.gz

J-N-K commented 1 year ago

Decoded raw payload: љX��Y���#۽��`t��{�ä�
�/&H�```

This doesn't look right. Did you re-pair the device with the app? It looks like the encryption key is wrong.
hyzteric commented 1 year ago

Hi, I've got a similar situation. Previously paired devices still work well. But I cannot add new ones I just received. The discovery won't discover anything. The new devices do show in the tuya iot cloud website

hyzteric commented 1 year ago

Yesterday I unplugged the new devices because I had no more time for this. This morning, they were in the things inbox! I added them but they are offline for config error :-/

2023-02-09 07:49:46.154 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:tuya-detecteur-2' changed from UNINITIALIZED (DISABLED) to INITIALIZING

2023-02-09 07:49:46.167 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:tuya-detecteur-2' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): No channels added and schema not found.

hyzteric commented 1 year ago

Ok well, I tried one thing: I noticed that the things I added were still also in the inbox. I deleted the things that had "config error" and then I added them again from the inbox, but this time I chose "Add as thing" and NOT "Add as thing (with custom ID)"

It worked instantly!

J-N-K commented 1 year ago

Interesting. It should also work with a custom id, but ONLY if there is one thing per device. It'll not work if you have more than one thing per device, because the Tuya devices only allow one local connection (this is also the reason why it'll not work if you use the App with local control and the binding at the same time.

dariocdj commented 1 year ago

Hello, i've recently bought a wifi tuya door/window sensor. Do your binding support it with OH 3.4.1? App is SmartLife.... and found a Contact Sensor (and it works) Thanks

J-N-K commented 1 year ago

If it's battery powered it'll not work at the moment.