homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
166 stars 24 forks source link

[Bug]: Smart Lock R10 - 'Characteristic was supplied illegal value" #465

Closed btrfs-d closed 5 months ago

btrfs-d commented 10 months ago

What happened?

Trying to use my Eufy Smart Lock R10 with HomeKit. I just want to be able to lock/unlock from my phone. See log detail below for relevant information.

Device Type

other (UnSupported)

Plugin Version

beta (Best Effort)

HomeBridge Version

v1.6.x (Supported)

NodeJS Version

v18 (Supported)

Operating System

Ubuntu 18.04+ (Supported)

Relevant log output

[11/3/2023, 5:51:41 PM] [HB Supervisor] Restarting Homebridge...
[11/3/2023, 5:51:41 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[11/3/2023, 5:51:41 PM] [HB Supervisor] Started Homebridge v1.6.1 with PID: 5997
[11/3/2023, 5:51:42 PM] Loaded config.json with 0 accessories and 2 platforms.
[11/3/2023, 5:51:42 PM] Loaded 0 cached accessories from cachedAccessories.
[11/3/2023, 5:51:42 PM] ---
[11/3/2023, 5:51:42 PM] Loaded plugin: homebridge-eufy-security@2.3.5
[11/3/2023, 5:51:42 PM] Registering platform 'homebridge-eufy-security.EufySecurity'
[11/3/2023, 5:51:42 PM] ---
[11/3/2023, 5:51:42 PM] Loading 2 platforms...
[11/3/2023, 5:51:42 PM] [EufySecurity] Initializing EufySecurity platform...
[11/03/2023, 17:51:42]  [EufySecurity]  WARN    warning: planned changes, see https://github.com/homebridge-eufy-security/plugin/issues/1
[11/03/2023, 17:51:42]  [EufySecurity]  INFO    ffmpegPath?: /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg
[11/03/2023, 17:51:42]  [EufySecurity]  INFO    ffmpegPath set: /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg
[11/03/2023, 17:51:42]  [EufySecurity]  INFO    Country set: US
[11/03/2023, 17:51:42]  [EufySecurity]  INFO    Finished initializing!
Setup Payload:
X-HM://00244S19XY3J0
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 400-53-109 │     
    └────────────┘     

[11/3/2023, 5:51:42 PM] Homebridge v1.6.1 (HAP v0.11.1) (Homebridge EC1A) is running on port 51155.
[Front Door@Front Door@Battery Level] Characteristic not in required or optional characteristic section for service LockMechanism. Adding anyway.
[11/03/2023, 17:51:51]  [EufySecurity]  INFO    Registering new accessory: Front Door
[11/03/2023, 17:51:53]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/03/2023, 17:51:53]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/3/2023, 5:51:53 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[11/03/2023, 17:52:28]  [EufySecurity]  INFO    Looking for old cached accessories that seem to be outdated...
[11/03/2023, 17:52:28]  [EufySecurity]  INFO    No outdated cached accessories found.
[11/03/2023, 17:52:47]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/03/2023, 17:52:47]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/3/2023, 5:52:47 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[11/03/2023, 17:52:52]  [EufySecurity]  INFO    Front Door Lock target state set to: 0
[11/03/2023, 17:52:57]  [EufySecurity]  INFO    Front Door Lock target state set to: 1
[11/03/2023, 17:53:03]  [EufySecurity]  INFO    Front Door Lock target state set to: 0
[11/03/2023, 17:53:03]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/03/2023, 17:53:03]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/3/2023, 5:53:03 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[11/03/2023, 17:53:12]  [EufySecurity]  INFO    Front Door Lock target state set to: 0
[11/03/2023, 17:53:18]  [EufySecurity]  INFO    Front Door Lock target state set to: 1
[11/03/2023, 17:53:18]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/03/2023, 17:53:18]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/3/2023, 5:53:18 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[11/03/2023, 17:53:22]  [EufySecurity]  INFO    Front Door Lock target state set to: 0
[11/03/2023, 17:53:23]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/03/2023, 17:53:23]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/3/2023, 5:53:23 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[11/03/2023, 17:54:08]  [EufySecurity]  INFO    Front Door Lock target state set to: 0
[11/03/2023, 17:56:32]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/03/2023, 17:56:32]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[11/3/2023, 5:56:32 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.

config

{
    "bridge": {
        "name": "Homebridge EC1A",
        "username": "0E:2E:B1:F4:EC:1A",
        "port": 51155,
        "pin": "400-53-109",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "username": "user@domain.tld",
            "password": "password",
            "country": "US",
            "deviceName": "arc-homelab-dev01",
            "platform": "EufySecurity",
            "ignoreStations": [
                "T8410P4223026D1A",
                "T8503Q10214812E9"
            ],
            "ignoreDevices": [
                "T8410P4223026D1A"
            ],
            "locks": [
                {
                    "serialNumber": "T8503Q10214812E9"
                }
            ],
            "cleanCache": true
        }
    ],
    "disabledPlugins": []
}
github-actions[bot] commented 10 months ago

Did you check this Common Issues pages ?

sparsematrix commented 8 months ago

I also saw this error when trying a 2.3.x release. I do not see it with v2.2.21. However there has been a long running issue with Eufy locks not responding when using Apple Home to request an action (lock/unlock). So, you might see if v2.2.21 resolves the error you see but don't get your hopes up on it actually doing anything useful.

nicholastripp commented 8 months ago

@sparsematrix How long has that issue with the lock/unlock request from Home been going on? That's the only thing I'm really using this plugin for so if it doesn't work I'm stuck.

EvoSems commented 6 months ago

[homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1.

if I downgrade to 2.2.21 I get the following

[EufySecurity] WARN This accessory is not compatible with HomeBridge Eufy Security plugin: Front Door Type: 180

lenoxys commented 6 months ago

hey if you're not using streaming video. you can try 2.3.11 (see https://github.com/homebridge-eufy-security/plugin/wiki/RC---Beta-Version)

nicholastripp commented 6 months ago

hey if you're not using streaming video. you can try 2.3.11 (see https://github.com/homebridge-eufy-security/plugin/wiki/RC---Beta-Version)

This does allow me to control the lock, but the status of the lock is listed as "Unknown".

[03/15/2024, 13:19:52] [EufySecurity] INFO Front Door Lock target state set to: 0 [03/15/2024, 13:20:04] [EufySecurity] INFO Front Door Lock target state set to: 1 [03/15/2024, 13:20:04] [EufySecurity] WARN Front Door Unknown lock status feedback [03/15/2024, 13:20:04] [EufySecurity] WARN Front Door Unknown lock status feedback [3/15/2024, 1:20:04 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.

andrewfluck commented 5 months ago

I see this with my locks as well, using LOCK_BLE and LOCK_8530 for rear and front doors.

[03/16/2024, 16:33:41]  [EufySecurity]  INFO    Front Door Lock target state set to: 0
[03/16/2024, 16:33:45]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/16/2024, 16:33:45]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/16/2024, 4:33:45 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[03/16/2024, 16:33:50]  [EufySecurity]  INFO    Front Door Lock target state set to: 1
[03/16/2024, 16:33:51]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:33:51]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/16/2024, 16:33:51]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:33:51]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/16/2024, 4:33:51 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Battery Level': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:33:51 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:33:51 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[03/16/2024, 16:33:57]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/16/2024, 16:33:57]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/16/2024, 4:33:57 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[03/16/2024, 16:34:59]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:34:59]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/16/2024, 16:34:59]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:34:59]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/16/2024, 4:34:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Battery Level': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:34:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:34:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[03/16/2024, 16:35:59]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:35:59]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/16/2024, 16:35:59]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:35:59]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/16/2024, 4:35:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Battery Level': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:35:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:35:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[03/16/2024, 16:36:59]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:36:59]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/16/2024, 16:36:59]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/16/2024, 16:36:59]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/16/2024, 4:36:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Battery Level': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:36:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/16/2024, 4:36:59 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
lenoxys commented 5 months ago

is this 2.3.11 logs version ? can you enable debug on global settings ?

andrewfluck commented 5 months ago

is this 2.3.11 logs version ? can you enable debug on global settings ?

Yes, mine are being pulled in on the latest version, 2.3.11.

[3/17/2024, 3:15:01 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/17/2024, 3:15:01 PM] [homebridge-eufy-security] Error: 
    at LockTargetState.Characteristic.characteristicWarning (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at LockTargetState.Characteristic.validateUserInput (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2927:14)
    at LockTargetState.<anonymous> (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2405:24)
    at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
    at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
    at fulfilled (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:166:62)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[03/17/2024, 15:16:01]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/17/2024, 15:16:01]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[03/17/2024, 15:16:01]  [EufySecurity]  WARN    Back Door Unknown lock status feedback
[03/17/2024, 15:16:01]  [EufySecurity]  WARN    Front Door Unknown lock status feedback
[3/17/2024, 3:16:01 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Battery Level': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[3/17/2024, 3:16:01 PM] [homebridge-eufy-security] Error: 
    at BatteryLevel.Characteristic.characteristicWarning (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at BatteryLevel.Characteristic.validateUserInput (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2903:14)
    at BatteryLevel.<anonymous> (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2405:24)
    at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
    at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
    at fulfilled (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:166:62)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[3/17/2024, 3:16:01 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/17/2024, 3:16:01 PM] [homebridge-eufy-security] Error: 
    at LockTargetState.Characteristic.characteristicWarning (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at LockTargetState.Characteristic.validateUserInput (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2927:14)
    at LockTargetState.<anonymous> (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2405:24)
    at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
    at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
    at fulfilled (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:166:62)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[3/17/2024, 3:16:01 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Lock Target State': characteristic was supplied illegal value: number 3 exceeded maximum of 1. See https://homebridge.io/w/JtMGR for more info.
[3/17/2024, 3:16:01 PM] [homebridge-eufy-security] Error: 
    at LockTargetState.Characteristic.characteristicWarning (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at LockTargetState.Characteristic.validateUserInput (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2927:14)
    at LockTargetState.<anonymous> (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2405:24)
    at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
    at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
    at fulfilled (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:166:62)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

I'm also willing to debug this with you as well.

andrewfluck commented 5 months ago

Looks like boolean values are missing from the state mapping here and instead should be:

    const lockStatusMap: Record<number | boolean, CharacteristicValue> = {
      true: this.platform.Characteristic.LockCurrentState.SECURED,
      false: this.platform.Characteristic.LockCurrentState.UNSECURED,
      4: this.platform.Characteristic.LockCurrentState.SECURED,
      3: this.platform.Characteristic.LockCurrentState.UNSECURED,
      5: this.platform.Characteristic.LockCurrentState.JAMMED,
    };

I attempted to reproduce jammed states, but not sure if my lock reports that properly, as it only seems to report target states. The other approach might be to adapt the boolean values into their respective state.

lenoxys commented 5 months ago

can you try 2.3.14? In fact JAMMED event should be handled another way. I've implemented and now we rely on isLocked() instead of trying to decode ourself.

andrewfluck commented 5 months ago

can you try 2.3.14? In fact JAMMED event should be handled another way. I've implemented and now we rely on isLocked() instead of trying to decode ourself.

Sorry for the late reply, I've been swamped with PI planning meetings at work and have been exhausted. Seems to have been fixed after the update for me. I won't speak for the others here, but I am seeing the proper states being reproduced in Homebridge and Home Assistant. Thanks for the quick fix, and being quick to integrate 3.0 of the Eufy security library!

nicholastripp commented 5 months ago

can you try 2.3.14? In fact JAMMED event should be handled another way. I've implemented and now we rely on isLocked() instead of trying to decode ourself.

This is working for me as well. Thanks for this!