Skip to content

martijnpoppen/eufy-clean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eufy-Clean

Overview

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.

Installation

  1. Clone the repository:
git clone https://github.com/martijnpoppen/eufy-clean.git
  1. Navigate to the project directory:
cd eufy-clean
  1. Install dependencies:
yarn

Usage

Initialization

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();

Methods

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);

Example

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();

Local Example

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();

Contact

For any questions or issues, please open an issue on the GitHub repository.



Happy Cleaning! 🧹✨