Files
eufy_robovac/README.md

163 lines
4.1 KiB
Markdown

# Table of Contents <!-- omit in toc -->
- [Compiling](#compiling)
- [Requirements](#requirements)
- [Instructions](#instructions)
- [Configuration](#configuration)
- [Examples](#examples)
- [Command-line](#command-line)
- [Config file](#config-file)
- [Usage](#usage)
- [Obtaining device credentials](#obtaining-device-credentials)
- [tl;dr](#tldr)
- [Instructions:](#instructions-1)
- [With docker](#with-docker)
- [1. Enter a shell within an ubuntu docker container](#1-enter-a-shell-within-an-ubuntu-docker-container)
- [2. Set up your environment](#2-set-up-your-environment)
- [3. Clone the repo](#3-clone-the-repo)
- [4. Install requirements](#4-install-requirements)
- [5. Get your credentials](#5-get-your-credentials)
# eufy_robovac <!-- omit in toc -->
This is a cli script adapted from [Richard Mitchell's work](https://github.com/mitchellrj/eufy_robovac_). It abandons all the code for integrating with homeassistant in lieu of creating a portable binary to control the thing - either manually or with cron job.
# Compiling
This python script can be compiled to a single executable binary.
## Requirements
- linux machine
- git
- docker
## Instructions
```
git clone https://gitea.raer.me/freyjagp/eufy_robovac.git
cd eufy_robovac
chmod +x compile
./compile
```
This will create a docker image then use it to compile an executable binary to `eufy_robovac/dist/vac`.
# Configuration
The device ID, ip address, and local code are required for this to work. They may be passed as arguments, or through a config file. The defalt path for the config file is `/etc/robovac.conf`. This can be altered with the `-c` or `--config` flags.
## Examples
### Command-line
Set config file to any arbitrary location:
```
robovac --config=/home/user/robovac.conf
```
Provide credentials inline:
```
robovac --device_id=DEVICE_ID --ip=192.168.1.1 --local_code=LOCAL_CODE
```
### Config file
```
[robovac]
device_id=DEVICE_ID
ip=192.168.1.1
local_code=LOCAL_CODE
```
[see here](config/robovac.conf.example)
# Usage
```
usage: vac [-h] [-c CONFIG] [--device_id DEVICE_ID] [--ip IP] [--local_code LOCAL_CODE] [--time TIME] [--pause] [--home] [--debug] [--verbose] [--quiet]
Control a Robovac device.
options:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
Path to config file
--device_id DEVICE_ID
Device ID
--ip IP Device IP address
--local_code LOCAL_CODE
Secret key obtained from eufy
--time TIME, -t TIME Cleaning time in minutes
--pause, -p Pause vacuum
--home, -b Go home
--debug, -d Enter debugging mode (won't send commands to vacuum)
--verbose, -v Enable verbose logs
--quiet, -q Quiet logs
```
# Obtaining device credentials
## tl;dr
use [this](https://github.com/markbajaj/eufy-device-id-python) repo and follow the instructions.
## Instructions:
You'll need to install git, python3, build-essential, pipenv, libffi-dev, python3-dev, and libssl-dev with your package manager. Then you can do
```
git clone https://github.com/markbajaj/eufy-device-id-python
cd eufy-device-id-python
pipenv install
pipenv shell
python -m eufy_local_id_grabber "YOUR_EUFY_EMAIL" "YOUR_EUFY_PASSWORD"
```
This might not work and requires installing packages you may or may not want/need on your base os. We can do better.
### With docker
#### 1. Enter a shell within an ubuntu docker container
```
docker run -it ubuntu:latest bash
```
#### 2. Set up your environment
```
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y git python3 python3-venv python3-pip build-essential pipenv libffi-dev python3-dev libssl-dev
```
#### 3. Clone the repo
```
git clone https://github.com/markbajaj/eufy-device-id-python.git
cd eufy-device-id-python
```
#### 4. Install requirements
```
pipenv install
```
#### 5. Get your credentials
```
pipenv shell
python -m eufy_local_id_grabber "YOUR_EUFY_EMAIL" "YOUR_EUFY_PASSWORD"
```
Output:
```
Home: <home ID>
Device: RoboVac, device ID <DEVICE_ID>, local key <LOCAL_KEY>
```