homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
168 stars 23 forks source link

[Bug]: TypeError: device.getStationSerial is not a function #86

Closed LunaticMuch closed 2 years ago

LunaticMuch commented 2 years ago

What happened?

A bug happened! I am using EufySecurity with homebridge on a docker container, and I get a weird error which seems related just to the homebridge plugin code.

It keeps crashing. My config is just

        {
            "platform": "EufySecurity",
            "username": "**********",
            "password": "**********"
            "country": "GB",
            "ignoreStations": [],
            "ignoreDevices": []
        }

Device Type

Doorbell (Supported)

Plugin Version

v2.0.x (Supported)

HomeBridge Version

v1.4.x (Supported)

NodeJS Version

v16 (Supported)

Operating System

Docker (UnSupported)

Relevant log output

[6/18/2022, 9:08:07 PM] TypeError: device.getStationSerial is not a function
    at /homebridge/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/eufysecurity.ts:517:56
    at Array.forEach (<anonymous>)
    at /homebridge/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/eufysecurity.ts:516:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at EufySecurity.getDevices (/homebridge/node_modules/homebridge-eufy-security/node_modules/eufy-security-client/src/eufysecurity.ts:312:13)
    at EufySecurityPlatform.discoverDevices (/homebridge/node_modules/homebridge-eufy-security/src/platform.ts:258:25)
    at EufySecurityPlatform.pluginSetup (/homebridge/node_modules/homebridge-eufy-security/src/platform.ts:167:5)
    at HomebridgeAPI.<anonymous> (/homebridge/node_modules/homebridge-eufy-security/src/platform.ts:146:7)
github-actions[bot] commented 2 years ago

Did you check this Common Issues pages ?

thieren commented 2 years ago

Hi @LunaticMuch

I have a suspicion that this is related to an update of the eufy-security-client library.

Could you provide some more info:

Thx

LunaticMuch commented 2 years ago

Hey @thieren

the security client has version 2.1.0

The debug does not really give us any clue. I guess the failure is at the early stage of the plugin start, so it stops immediately.

{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5590,"level":40,"msg":"warning: planned changes, see https://github.com/homebridge-eufy-security/plugin/issues/1","time":"2022-06-19T09:44:46.011Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5590,"level":30,"msg":"Country set: GB","time":"2022-06-19T09:44:46.016Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5590,"level":30,"msg":"Finished initializing!","time":"2022-06-19T09:44:46.016Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5590,"level":50,"msg":"Error while shutdown :  TypeError: Cannot read properties of undefined (reading 'close')\n    at EufySecurityPlatform.pluginShutdown (/homebridge/node_modules/homebridge-eufy-security/src/platform.ts:173:23)\n    at HomebridgeAPI.<anonymous> (/homebridge/node_modules/homebridge-eufy-security/src/platform.ts:149:18)\n    at HomebridgeAPI.emit (node:events:539:35)\n    at HomebridgeAPI.signalShutdown (/usr/local/lib/node_modules/homebridge/src/api.ts:279:10)\n    at BridgeService.teardown (/usr/local/lib/node_modules/homebridge/src/bridgeService.ts:571:14)\n    at Server.teardown (/usr/local/lib/node_modules/homebridge/src/server.ts:183:24)\n    at signalHandler (/usr/local/lib/node_modules/homebridge/src/cli.ts:93:12)\n    at process.emit (node:events:527:28)\n    at process.emit (/usr/local/lib/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)","time":"2022-06-19T09:44:46.292Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5662,"level":40,"msg":"warning: planned changes, see https://github.com/homebridge-eufy-security/plugin/issues/1","time":"2022-06-19T09:45:03.057Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5662,"level":30,"msg":"Country set: GB","time":"2022-06-19T09:45:03.063Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5662,"level":30,"msg":"Finished initializing!","time":"2022-06-19T09:45:03.063Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5662,"level":30,"msg":"You're using guest admin account with this plugin! This is recommanded way!","time":"2022-06-19T09:45:25.469Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5662,"level":30,"msg":"Finished shutdown!","time":"2022-06-19T09:45:32.773Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5807,"level":40,"msg":"warning: planned changes, see https://github.com/homebridge-eufy-security/plugin/issues/1","time":"2022-06-19T09:45:48.236Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5807,"level":30,"msg":"Country set: GB","time":"2022-06-19T09:45:48.241Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5807,"level":30,"msg":"Finished initializing!","time":"2022-06-19T09:45:48.242Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5807,"level":30,"msg":"You're using guest admin account with this plugin! This is recommanded way!","time":"2022-06-19T09:46:10.560Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5807,"level":30,"msg":"Finished shutdown!","time":"2022-06-19T09:46:17.991Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5929,"level":40,"msg":"warning: planned changes, see https://github.com/homebridge-eufy-security/plugin/issues/1","time":"2022-06-19T09:46:31.681Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5929,"level":30,"msg":"Country set: GB","time":"2022-06-19T09:46:31.686Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5929,"level":30,"msg":"Finished initializing!","time":"2022-06-19T09:46:31.688Z","v":0}
{"name":"[EufySecurity-2.0.0]","hostname":"homebridge","pid":5929,"level":30,"msg":"You're using guest admin account with this plugin! This is recommanded way!","time":"2022-06-19T09:46:53.837Z","v":0}
thieren commented 2 years ago

Yeah I thought that. We had problems with 2.1.0 and therefore had to roll back to 2.0.1 on latest beta.

This bug is also already fixed in Eufy-security-client develop branch, but not yet pulled into master.

To mitigate you could use the beta meanwhile. That should work.

thieren commented 2 years ago

We added a patch in 2.0.1 so this should no longer happen.

LunaticMuch commented 2 years ago

I confirm this issue has been solved. I am observing two different problems now, although the device seems working. I will keep on eye and check/report eventually.