hannseman / homebridge-mi-hygrothermograph

Homebridge plugin for the Xiaomi Mi Bluetooth Temperature and Humidity Sensor
MIT License
266 stars 52 forks source link

Cipher error when adding LYWSD03MMC #121

Closed ux-lic closed 3 years ago

ux-lic commented 3 years ago

I originally had the LYWSD02 sensor connected and working for a few months with no issues, upon adding the LYWSD03MMC sensor I am now seeing this cipher error and this is stopping all devices in HomeKit app.

Any help would be greatly appriciated.

Steps to Reproduce (for bugs)

Added LYWSD03MMC sensor with encryption key (bindKey) and MAC address to config Added MAC address for existing sensor LYWSD02 Saved config and Restarted server

Versions

Configuration

"accessories": [
        {
            "accessory": "Hygrotermograph",
            "name": "House",
            "address": "4C:65:A8:D9:AC:FD"
        },
        {
            "accessory": "Hygrotermograph",
            "name": "Nursery",
            "address": "A4:C1:38:3E:6A:FC",
            "bindKey": "####################"
        }
    ],

I've hidden the bindKey obtained using Telink

Homebridge Log / Command Output

[11/18/2020, 11:56:23] [Nursery] Error: Unsupported state or unable to authenticate data
    at Decipheriv.final (internal/crypto/cipher.js:172:29)
    at Parser.decryptPayload (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:191:14)
    at Parser.parse (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:59:12)
    at Scanner.parseServiceData (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:171:52)
    at Scanner.onDiscover (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:92:25)
    at Noble.emit (events.js:322:22)
    at Noble.onDiscover (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/noble.js:196:10)
    at NobleBindings.emit (events.js:310:20)
    at NobleBindings.onDiscover (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:169:10)
    at Gap.emit (events.js:310:20)
    at Gap.onHciLeAdvertisingReport (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/gap.js:244:10)
    at Hci.emit (events.js:310:20)
    at Hci.processLeAdvertisingReport (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/hci.js:656:12)
    at Hci.processLeMetaEvent (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/hci.js:612:10)
    at Hci.onSocketData (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/hci.js:483:12)
    at BluetoothHciSocket.emit (events.js:310:20)
hannseman commented 3 years ago

Hi!

I don't have this device myself so I'm not really sure how to start debugging this. But it's weird that the error brings down homebridge, it should really just log the errors..

Anyway this is a duplicate of https://github.com/hannseman/homebridge-mi-hygrothermograph/issues/101, some people have had success by readding the device through the app and using a new bindkey. Look in that issue for more details.