Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Disarming Dufy Security Fails and Crashes Homebridge Server #52

Closed
cms365 opened this issue May 30, 2022 · 17 comments
Closed

[Bug]: Disarming Dufy Security Fails and Crashes Homebridge Server #52

cms365 opened this issue May 30, 2022 · 17 comments
Assignees
Labels
bug Something isn't working fixed in beta / next release this is a resolved issue which is fixed in current beta and will be fixed in next release

Comments

@cms365
Copy link

cms365 commented May 30, 2022

What happened?

When Eufy Security is switched from any status to disarmed/off from HomeKit, it fails and throws the below error. Also causes the HomeBridge server to crash and reboot. This issue did not exist prior to the 2.0 update.

Want to note that I love this plugin and am reporting this issue to help the community.

Device Type

Station (Supported)

Plugin Version

v2.0.x (Supported)

HomeBridge Version

v1.4.x (Supported)

NodeJS Version

v16 (Supported)

Operating System

Mac OS X 11+ (Supported)

Relevant log output

[5/29/2022, 10:33:06 PM] InvalidPropertyValueError: Value "NaN" isn't a valid value for property "guardMode"
    at validValue (/usr/local/lib/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/utils.ts:114:19)
    at Station.setGuardMode (/usr/local/lib/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/http/station.ts:484:19)
    at StationAccessory.handleSecuritySystemTargetStateSet (/usr/local/lib/node_modules/homebridge-eufy-security/src/accessories/StationAccessory.ts:212:24)
    at SecuritySystemTargetState.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1676:42)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
    at SecuritySystemTargetState.Characteristic.handleSetRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:824:38)
    at Bridge.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1810:29)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
[5/29/2022, 10:33:06 PM] Got SIGTERM, shutting down Homebridge...
[5/29/2022, 10:33:06 PM] [Harmony Hub Living Room] INFO - shutdown
[5/29/2022, 10:33:06 PM] [EufySecurity-2.0.0] WARN:  Push Closed!
[5/29/2022, 10:33:06 PM] [EufySecurity-2.0.0] INFO:  Finished shutdown!
@cms365 cms365 added the bug Something isn't working label May 30, 2022
@github-actions
Copy link

Did you check this Common Issues pages ?

@cms365
Copy link
Author

cms365 commented May 30, 2022

Did you check this Common Issues pages ?

Yes, I did. After reporting this bug I completely reinstalled the plugin and validated the behavior is the same. Wish the reinstall did the trick, but sadly it did not.

@thieren
Copy link
Contributor

thieren commented May 30, 2022

Hi @cms365

I've just added error handling for this error, so that this should prevent Homebridge from crashing. Please wait until #53 was merged.

However I cannot quite see why mode in your case is NaN. Could you please provide your json configuration without the personal information?

@cms365
Copy link
Author

cms365 commented May 30, 2022

Sure @thieren, here you go. Thanks for the response. I haven’t done anything fancy. Just mapped the HomeKit off status to the Eufy Disarmed status.

{
"bridge": {
"name": "Homebridge 519C",
"username": "",
"port": ,
"pin": ""
},
"accessories": [
{
"name": "Model 3",
"vin": "",
"username": "",
"password": "",
"waitMinutes": 1,
"disableDoors": true,
"disableSentryMode": true,
"accessory": "Tesla"
}
],
"platforms": [
{
"name": "Config",
"port": 8581,
"platform": "config"
},
{
"email": "",
"password": "”,
"name": "Garage Door",
"platform": "myQ"
},
{
"name": "Harmony Hub Living Room",
"hubName": "Harmony Hub Living Room",
"TVAccessory": true,
"mainActivity": "Watch TV",
"platform": "HarmonyHubWebSocket"
},
{
"name": "Wemo",
"platform": "Wemo"
},
{
"platform": "EufySecurity",
"username": "",
"password": "",
"country": "US",
"ignoreStations": [],
"ignoreDevices": [
"T8114P61212205F8",
"T8114P6121221852",
"T8900P0021320EAF",
"T8900P00213218DC",
"T8900P002138168C",
"T8900P00213218CD"
]
}
],
"disabledPlugins": [
"homebridge-tesla",
"homebridge-plugin-eufy-security"
]
}

@thieren
Copy link
Contributor

thieren commented May 31, 2022

Hi @cms365

I haven’t done anything fancy. Just mapped the HomeKit off status to the Eufy Disarmed status.

Where did you do that? I don't see anything in your config that represents that.

From your config and the plugin code I can't see where the issue lies.

Can you at least confirm that the latest beta prevents homebridge from crashing for you?

@cms365
Copy link
Author

cms365 commented Jun 1, 2022

Hi @cms365

I haven’t done anything fancy. Just mapped the HomeKit off status to the Eufy Disarmed status.

Where did you do that? I don't see anything in your config that represents that.

From your config and the plugin code I can't see where the issue lies.

Can you at least confirm that the latest beta prevents homebridge from crashing for you?

It is weird you don’t see these configurations in the json. Before v2.0 I set these all up in the HomeBridge UI. Screenshot attached.

Will get the beta up asap and report back!
8E2CF868-4323-4EBF-B16B-9435BA2A4299

@cms365
Copy link
Author

cms365 commented Jun 2, 2022

Beta installed! Crash does seem to be resolved here. However, the guard state change is still failing.

Here’s the log output:
[6/2/2022, 3:52:11 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Security System Current State': characteristic was supplied illegal value: number 63 exceeded maximum of 4. See https://homebridge.io/w/JtMGR for more info.
[6/2/2022, 3:52:11 PM] [homebridge-eufy-security] This plugin generated a warning from the characteristic 'Security System Target State': characteristic was supplied illegal value: number 63 exceeded maximum of 3. See https://homebridge.io/w/JtMGR for more info.
[6/2/2022, 3:52:19 PM] [EufySecurity-2.0.1-beta.3] INFO: Eufy Homebase Request to change station guard mode to: Home.
[6/2/2022, 3:52:32 PM] [EufySecurity-2.0.1-beta.3] ERROR: Error Setting security mode! Error: Could not convert guard mode value to valid number. Aborting guard mode change...
at StationAccessory.handleSecuritySystemTargetStateSet (/usr/local/lib/node_modules/homebridge-eufy-security/src/accessories/StationAccessory.ts:229:15)
at SecuritySystemTargetState. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1676:42)
at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
at new Promise ()
at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
at SecuritySystemTargetState.Characteristic.handleSetRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:824:38)
at Bridge. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1810:29)
at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
at new Promise ()
at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
at Bridge.Accessory.handleCharacteristicWrite (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1528:38)
at _loop_2 (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1677:12)

@ripple7511
Copy link

+1 to the above
I am experiencing the Homebridge crashing, as well as the InvalidPropertyValueError: Value "NaN" isn't a valid value for property "guardMode" error. Log below:

[02/06/2022, 15:18:03] InvalidPropertyValueError: Value "NaN" isn't a valid value for property "guardMode"
at validValue (/usr/local/lib/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/utils.ts:114:19)
at Station.setGuardMode (/usr/local/lib/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/http/station.ts:484:19)
at StationAccessory.handleSecuritySystemTargetStateSet (/usr/local/lib/node_modules/homebridge-eufy-security/src/accessories/StationAccessory.ts:212:24)
at SecuritySystemTargetState. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1676:42)
at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
at new Promise ()
at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
at SecuritySystemTargetState.Characteristic.handleSetRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:824:38)
[02/06/2022, 15:18:03] Got SIGTERM, shutting down Homebridge...

@thieren
Copy link
Contributor

thieren commented Jun 3, 2022

Hi @cms365
hi @ripple7511

have added a few debug messages in 2.0.1-beta.4 that should help in understanding this problem.
Please enable detailed logging in your config and test again. Then drop the logs here please.

Please ensure that you'll get the entire homebridge log after the last restart or at least one line from the startup that reads something like this: DEBUG: *yourstationname* Mapping for station modes: [...]. After that a range of +/- 5 lines before and after the error should suffice.

@cms365
Copy link
Author

cms365 commented Jun 3, 2022

So I think I found a workaround, that admittedly I should have thought of sooner. I switched the mapping for HomeKit Off to another Eufy guard status, saved and rebooted. Then, switched it back to my desired Disarmed guard status, saved and rebooted. That resolved the issue for me and now everything works as expected!

@thieren
Copy link
Contributor

thieren commented Jun 3, 2022

Hey @cms365

yeah that was my thought also but wanted first to confirm it with the debug log.
Nevertheless there seems to be a bug, since your config didn't have any hk status fields in it and so the default values should have been fine also.

Can you tell me to what values you have mapped it now?
Also I don't really get why you should have to restart multiple times. Are you sure this was necessary?

@cms365
Copy link
Author

cms365 commented Jun 4, 2022

Sure, @thieren!

Current mappings attached. Probably didn’t need the restarts but years of engineering work has trained me to reboot for good measure haha.
DD5B07FA-18A9-4C99-860F-5C461FB0D541

@thieren
Copy link
Contributor

thieren commented Jun 4, 2022

Can you provide your new json config?

For me it is not really clear why the plugin crashed for you without this setting.

@ripple7511
Copy link

ripple7511 commented Jun 7, 2022

Doing as @cms365 stated above (re-mapping disarm to something else, saving, rebooting, switching it back, saving and rebooting) worked for me as well.

Config here:

{
"platform": "EufySecurity",
"username": "",
"password": "
",
"country": "",
"ignoreStations": [],
"ignoreDevices": [
"
",
"
",
"
",
"
",
"
************"
],
"pollingIntervalMinutes": 30,
"hkHome": 1,
"hkAway": 0,
"hkNight": 3,
"hkOff": 63,
"enableDetailedLogging": false,
"CameraMaxLivestreamDuration": 30,
"cleanCache": true
}

(I blanked out username, password, country, and 'ignoreDevices')

@thieren
Copy link
Contributor

thieren commented Jun 7, 2022

Finally could reproduce and fix in 2.0.1-beta11

Closing this.

@thieren thieren closed this as completed Jun 7, 2022
@ripple7511
Copy link

Thank you!

@cms365
Copy link
Author

cms365 commented Jun 8, 2022

Agree! Appreciate the eagerness to figure this out. Thank you! Keep up the awesome work!

@thieren thieren self-assigned this Jul 19, 2022
@thieren thieren added the fixed in beta / next release this is a resolved issue which is fixed in current beta and will be fixed in next release label Jul 19, 2022
@thieren thieren mentioned this issue Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in beta / next release this is a resolved issue which is fixed in current beta and will be fixed in next release
Development

No branches or pull requests

3 participants