Registry / security / eufy-security-ws

eufy-security-ws

JSON →
library2.1.0jsnpmunverified

A Node.js WebSocket server that wraps the eufy-security-client library, providing programmatic access to Eufy Security devices (cameras, doorbells, locks, sensors). Version 2.1.0 requires Node >=20.0.0 and uses CJS modules. It exposes a WebSocket API for controlling and receiving events from Eufy devices, designed for integration into custom smart home systems. The project is community-maintained and not affiliated with Anker/Eufy.

npm install eufy-security-ws
INSTALL
IMPORT
SIG · EUFY-SECURITY-WS
E
eufy-security-ws
securityjavascriptv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ const EufySecurityWS = require('eufy-security-ws');
✗ import EufySecurityWS from 'eufy-security-ws';
Package uses CommonJS. ESM imports are not supported.

Shows how to instantiate the WebSocket server with a pre-shared key, start it, and how a client connects and sends a login command.

const EufySecurityWS = require('eufy-security-ws'); const server = new EufySecurityWS({ port: 3000, psk: process.env.PSK ?? 'my-secret-psk', }); server.start().then(() => { console.log('WebSocket server started on ws://localhost:3000'); }).catch(err => console.error(err)); // On another WebSocket client, connect and authenticate: // ws://localhost:3000?psk=my-secret-psk // Then send a JSON command like: // {"messageId":"1","command":"login","data":{"username":"...","password":"..."}} // See full API docs at https://bropat.github.io/eufy-security-ws/
Debug
Known issues
gotchaThe package is CJS-only — do not use ESM `import` syntax.
fix
Use `const EufySecurityWS = require('eufy-security-ws');` instead of `import`.
affects: >=1.0.0
gotchaSecure WebSocket (wss) is not supported natively — must be proxied via HTTPS.
fix
Use a reverse proxy like nginx to terminate TLS and forward to the WS server.
affects: >=1.0.0
deprecatedThe `psk` property in the constructor options is deprecated; use `authentication` with a token callback.
fix
Replace `psk` with `authentication: (request) => request.url.searchParams.get('psk') === 'my-secret-psk'`.
affects: >=2.0.0
gotchaNode.js >=20.0.0 required – earlier versions not supported.
fix
Upgrade Node.js to v20 or later.
affects: >=2.0.0
Errors
Common errors & fixes
Error: listen EADDRINUSE :::3000
Port already in use by another server or previous instance.
fix
Kill the process using the port or change port in options.
Error: PSK must be a string
Missing or invalid pre-shared key when using deprecated psk option.
fix
Provide a string PSK via options.psk or switch to authentication callback.
TypeError: EufySecurityWS is not a constructor
Using ESM import on a CJS-only module.
fix
Use `require` instead of `import`.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
eufy-security-clientrequiredCore library for communicating with Eufy Security devices
Agent activity
18 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
eufy-security-ws — npm install eufy-security-ws · libregistry