This Eufy Clean repo provides an interface to interact with Eufy cleaning devices. It includes functionalities to login, pair new devices, and manage cleaning operations through cloud and MQTT connections.
- Clone the repository:
git clone https://github.com/martijnpoppen/eufy-clean.git
- Navigate to the project directory:
cd eufy-clean
- Install dependencies:
yarn
To use the EufyClean class, you need to initialize it with your Eufy account credentials.
import { EufyClean } from './src/eufy-clean';
const eufyClean = new EufyClean('your-email@example.com', 'your-password');
await eufyClean.init();
init()
Initializes the EufyClean instance and logs in to the Eufy API.
await eufyClean.init();
getCloudDevices()
Fetches the list of cloud-connected devices. (These devices are Tuya based)
const cloudDevices = await eufyClean.getCloudDevices();
getMqttDevices()
Fetches the list of MQTT-connected devices.
const mqttDevices = await eufyClean.getMqttDevices();
getAllDevices()
Fetches the list of all devices (both cloud and MQTT).
const allDevices = await eufyClean.getAllDevices();
initDevice(deviceConfig)
Initializes a specific device based on the provided configuration. The device Id can be found with one of the above methods.
const deviceConfig = { deviceId: 'your-device-id' };
const device = await eufyClean.initDevice(deviceConfig);
Here's an example of how to use the EufyClean class in a script:
import { EufyClean } from './eufy-clean';
async function main() {
const eufyClean = new EufyClean('your-email@example.com', 'your-password');
await eufyClean.init();
const allDevices = await eufyClean.getAllDevices();
console.log(allDevices);
const deviceConfig = { deviceId: 'your-device-id' };
const device = await eufyClean.initDevice(deviceConfig);
await device.connect();
await device.setCleanParam({ cleanType: 'MOP_ONLY', cleanExtent: 'NARROW', mopMode: 'HIGH' });
await device.sceneClean(10);
}
main();
Eufy Clean can still be used locally via TuyAPI:
import { EufyClean } from './eufy-clean';
async function main() {
const eufyClean = new EufyClean('your-email@example.com', 'your-password');
await eufyClean.init();
const allDevices = await eufyClean.getAllDevices();
console.log(allDevices);
const deviceConfig = { deviceId: 'your-device-id', localKey: 'abcdefghijk' };
const device = await eufyClean.initDevice(deviceConfig);
await device.connect();
await device.setCleanParam({ cleanType: 'MOP_ONLY', cleanExtent: 'NARROW', mopMode: 'HIGH' });
await device.sceneClean(10);
}
main();
For any questions or issues, please open an issue on the GitHub repository.
Happy Cleaning! 🧹✨