Failed to connect to Eufy Cloud: TypeError: Cannot read properties of undefined (reading 'login')
at EufySecurity.connect (C:\Users\Yarin\node_modules\eufy-security-client\build\eufysecurity.js:740:24)
at Object.<anonymous> (C:\Users\Yarin\anaconda3\envs\eufy\Lib\site-packages\eufy_security\eufy_js.js:12:14)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
When running:
// Import the EufySecurity class from the library
const { EufySecurity } = require("eufy-security-client");
// Define your Eufy Cloud login credentials
const username = "example@gmail.com";
const password = "example";
// Create an instance of the EufySecurity class
const eufySecurity = new EufySecurity(username, password);
console.log("Starting...");
// Connect to Eufy Cloud
eufySecurity.connect().then(() => {
console.log("Connected to Eufy Cloud!");
// Get all devices associated with the Eufy Cloud account
const devices = eufySecurity.getDevices();
// Log the devices
console.log(devices);
}).catch((error) => {
console.error("Failed to connect to Eufy Cloud:", error);
});
You are initialising the EufySecurity class incorrectly (the constructor has been declared private, and you are also passing the wrong parameters).
See here for the correct method.
Here you can find some projects as an example of how to use this library:
Client version
2.9.1
Node version
20.11.0
Operating System type
Windows
Operating system version
Windows 10
Describe the bug
When running:
To reproduce
Run the code with your credintials
Screenshots & Logfiles
No response
Additional context
No response