kovapatrik / homebridge-midea-platform

Homebridge plugin for Midea devices
https://www.npmjs.com/package/homebridge-midea-platform
Apache License 2.0
28 stars 2 forks source link

Exception in Log "TypeError: The "key" argument ... " - no functional issue visible #100

Closed andreasgruener closed 1 month ago

andreasgruener commented 2 months ago

I see an Error in the Log each time when starting child bridge. But everything works as expected.

To Reproduce:

not sure how to reproduce.

Expected behavior:

Everything works as expected.

Logs:

8/18/2024, 8:32:58 PM] [homebridge-midea-platform] [Entfeuchter] Restoring existing accessory from cache: Entfeuchter
[8/18/2024, 8:32:58 PM] [homebridge-midea-platform] [Entfeuchter] Cached device, using token/key from config file
[8/18/2024, 8:33:00 PM] [homebridge-midea-platform] [Entfeuchter] Starting network listener.
[8/18/2024, 8:33:00 PM] [homebridge-midea-platform] [Entfeuchter | refresh_status] Recoverable error:
TypeError: The "key" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView, KeyObject, or CryptoKey. Received undefined
    at prepareSecretKey (node:internal/crypto/keys:596:11)
    at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:138:9)
    at new Cipheriv (node:internal/crypto/cipher:243:3)
    at createCipheriv (node:crypto:147:10)
    at LocalSecurity.aes_cbc_encrpyt (/homebridge/node_modules/homebridge-midea-platform/src/core/MideaSecurity.ts:169:34)
    at LocalSecurity.encode_8370 (/homebridge/node_modules/homebridge-midea-platform/src/core/MideaSecurity.ts:241:34)
    at MideaA1Device.send_message_v3 (/homebridge/node_modules/homebridge-midea-platform/src/core/MideaDevice.ts:207:42)
    at MideaA1Device.send_message (/homebridge/node_modules/homebridge-midea-platform/src/core/MideaDevice.ts:181:18)
    at MideaA1Device.build_send (/homebridge/node_modules/homebridge-midea-platform/src/core/MideaDevice.ts:214:16)
    at MideaA1Device.refresh_status (/homebridge/node_modules/homebridge-midea-platform/src/core/MideaDevice.ts:227:22)
    at MideaPlatform.addDevice (/homebridge/node_modules/homebridge-midea-platform/src/platform.ts:187:24)
[8/18/2024, 8:33:00 PM] [homebridge-midea-platform] [Entfeuchter] Invalid payload length: 29628 (0x73bc)
[8/18/2024, 8:33:06 PM] [homebridge-midea-platform] All configured devices added to Homebridge
[8/18/2024, 8:33:10 PM] [homebridge-midea-platform] Child bridge process ended
[8/18/2024, 8:33:10 PM] [homebridge-midea-platform] Process Ended. Code: 1, Signal: null
[8/18/2024, 8:33:17 PM] [homebridge-midea-platform] Restarting Process..

Plugin Config:

{
    "devices": [
        {
            "type": "Dehumidifier",
            "name": "Entfeuchter",
            "id": 153931628269071,
            "advanced_options": {
                "ip": "10.0.xx.xx",
                "token": "token",
                "key": "key"
            },
            "A1_options": {
                "temperatureSensor": true,
                "waterTankSensor": "Leak Sensor"
            }
        }
    ],
    "_bridge": {
        "username": "0E:38:.....",
        "port": 41600
    },
    "platform": "midea-platform"
}

Screenshots:

Environment:


kovapatrik commented 2 months ago

Could you please try this with the latest beta version, v1.1.2-beta.5?

andreasgruener commented 1 month ago

Hi - thanks for the quick reaction. I tested it with 1.2.0-beta3 - error is gone:

[9/1/2024, 5:46:02 PM] [homebridge-midea-platform] Loaded homebridge-midea-platform v1.2.0-beta.3 child bridge successfully
[9/1/2024, 5:46:03 PM] [homebridge-midea-platform] Loading accessory from cache: Entfeuchter
[9/1/2024, 5:46:03 PM] [homebridge-midea-platform] Start device discovery...
[9/1/2024, 5:46:03 PM] [homebridge-midea-platform] Discovered device: {"ip":"10.x.x.x","port":6444,"id":153931628269071,"model":"00000Q12","sn":"000000P00XXXXXX","name":"net_a1_D1F0","type":161,"version":3}
[9/1/2024, 5:46:03 PM] [homebridge-midea-platform] [Entfeuchter] Restoring existing accessory from cache: Entfeuchter
[9/1/2024, 5:46:03 PM] [homebridge-midea-platform] [Entfeuchter] Cached device, using token/key from config file
[9/1/2024, 5:46:05 PM] [homebridge-midea-platform] [Entfeuchter] Does not supports the protocol MessageQuerySubtype, ignored, error: Error: [Entfeuchter | refresh_status] Error when receiving data from device.
[9/1/2024, 5:46:06 PM] [homebridge-midea-platform] [Entfeuchter] Does not supports the protocol MessageQuery, ignored, error: Error: [Entfeuchter | refresh_status] Error when receiving data from device.
[9/1/2024, 5:46:06 PM] [homebridge-midea-platform] [Entfeuchter] Refresh failed.
[9/1/2024, 5:46:07 PM] [homebridge-midea-platform] [Entfeuchter] Does not supports the protocol MessageQuerySubtype, ignored, error: Error: [Entfeuchter | refresh_status] Error when receiving data from device.
[9/1/2024, 5:46:07 PM] [homebridge-midea-platform] [Entfeuchter] Starting network listener.
[9/1/2024, 5:46:11 PM] [homebridge-midea-platform] All configured devices added to Homebridge
kovapatrik commented 1 month ago

I'm glad to hear it!

I see you also have the same warnings as in #93. I will close this issue, and if you are interested in that one, please follow the other issue.