smarthomej / addons

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

Decryption of MQ failed: Input length not multiple of 16 bytes / #319, #577 #578

Open florianrohde opened 1 month ago

florianrohde commented 1 month ago

Referencing Issues #319 and #577 which seem to be the same.

Tuya Account is connected and device discovery working. Channels were added manually. I can see communication to the Tuya Gateway on my network but the status is not updated. Device is shown ONLINE indeed.

Environment: OpenHAB 4.0.3, Binding 4.0.2 Platform: Windows

Things and Items were deleted and recreated without success. Local Key did not change in this process on OH side.

Strange: The dev platform of tuya does show an EMPTY local key, but OH does have an key and does not accept "empty" local key. Maybe because this is 434 mhz sub device of the gateway?

From TUYA #API Explorer: { "result": { "active_time": 1715696606, "bind_space_id": "192111482", "category": "sfkzq", "create_time": 1715692336, "custom_name": "vorne", "icon": "smart/icon/bay1604286101943tD7U/1709028379af92bea864c.png", "id": "bf82e49de2093a8687dkfm", "ip": "", "is_online": true, "lat": "xxx", "local_key": "", "lon": "xxx", "model": "TTV203W", "name": "WiFi intelligente Zwei-Wege Bewässerung Timing Ventil", "product_id": "pjnbcfv3bzwg4yyo", "product_name": "TTV203FRF_wifi智能双路灌溉定时阀", "sub": true, "time_zone": "+02:00", "update_time": 1715697660, "uuid": "bf82e49de2093a8687dkfm" }, "success": true, "t": 1715963057681, "tid": "e87bbda6146911efb2424a20391ad943" }

From OH Error Log:

2024-05-17 18:10:43.622 [WARN ] [.internal.local.handlers.TuyaDecoder] - bff710b97b3242e7dbbl4b/10.10.23.25:6668 failed to parse JSON: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ 2024-05-17 18:10:47.501 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Input length not multiple of 16 bytes 2024-05-17 18:10:47.502 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Invalid AES key length: 1 bytes 2024-05-17 18:10:47.591 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Input length not multiple of 16 bytes 2024-05-17 18:10:47.593 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Invalid AES key length: 1 bytes 2024-05-17 18:10:49.832 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Input length not multiple of 16 bytes 2024-05-17 18:10:49.834 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Invalid AES key length: 1 bytes 2024-05-17 18:10:50.217 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Invalid AES key length: 1 bytes 2024-05-17 18:10:50.220 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Input length not multiple of 16 bytes 2024-05-17 18:10:51.253 [DEBUG] [rnal.influx1.InfluxDB1RepositoryImpl] - query returned no series 2024-05-17 18:10:56.168 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Input length not multiple of 16 bytes 2024-05-17 18:10:56.170 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Invalid AES key length: 1 bytes 2024-05-17 18:10:56.547 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Input length not multiple of 16 bytes 2024-05-17 18:10:56.548 [WARN ] [inding.tuya.internal.util.CryptoUtil] - Decryption of MQ failed: Invalid AES key length: 1 bytes

florianrohde commented 1 month ago

Update: The local key discovered is the gateway's local key which looks fine. Both gateway and sub device are not working (channels showing NULL)

florianrohde commented 1 month ago

TRACE Log:

2024-05-17 18:43:40.111 [TRACE] [rnal.local.handlers.HeartbeatHandler] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Sending ping 2024-05-17 18:43:40.112 [DEBUG] [.internal.local.handlers.TuyaEncoder] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Sending HEART_BEAT, payload {devId=bfe6ea39c92052273ayrch, uid=bfe6ea39c92052273ayrch, t=1715964220, dps=, gwId=bfe6ea39c92052273ayrch} 2024-05-17 18:43:40.112 [TRACE] [.internal.local.handlers.TuyaEncoder] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Sending encoded '000055AA0000001400000009000000817B226465764964223A2262666536656133396339323035323237336179726368222C22756964223A2262666536656133396339323035323237336179726368222C2274223A313731353936343232302C22647073223A22222C2267774964223A2262666536656133396339323035323237336179726368227D4B3E5F1B0000AA55' 2024-05-17 18:43:40.116 [TRACE] [.internal.local.handlers.TuyaDecoder] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Received encoded '000055AA00000000000000090000000C00000000B051AB030000AA55' 2024-05-17 18:43:40.116 [TRACE] [.internal.local.handlers.TuyaDecoder] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Decoded raw payload: 2024-05-17 18:43:40.116 [DEBUG] [.internal.local.handlers.TuyaDecoder] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Received MessageWrapper{commandType=HEART_BEAT, content='[B@6a27a953'} 2024-05-17 18:43:40.116 [TRACE] [rnal.local.handlers.HeartbeatHandler] - bfe6ea39c92052273ayrch/10.10.23.27:6668: Received pong