All Projects → mrin → domoticz-mirobot-plugin

mrin / domoticz-mirobot-plugin

Licence: other
Xiaomi Mi Robot Vacuum plugin for Domoticz

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to domoticz-mirobot-plugin

phpMyDomo
The ultimate Domotic web remote for the rest of us
Stars: ✭ 32 (-41.82%)
Mutual labels:  domoticz
reacticz
A Domoticz dashboard as a static web app, using MQTT and React
Stars: ✭ 16 (-70.91%)
Mutual labels:  domoticz
domoticz-homeautomation-workbook
Guide on how to build a Home Automation Solution, running on a Raspberry Pi with Domoticz.
Stars: ✭ 26 (-52.73%)
Mutual labels:  domoticz
Domoticz-Google-Assistant
Google Assistant for Domoticz
Stars: ✭ 81 (+47.27%)
Mutual labels:  domoticz
gigasetelements-cli
Gigaset Elements - python based command line interface
Stars: ✭ 30 (-45.45%)
Mutual labels:  domoticz
miThermoHygro
Xiaomi BLE Thermo- & Hygrometer implementation for Domoticz
Stars: ✭ 16 (-70.91%)
Mutual labels:  domoticz
homely
🏠 - A bunch of mosquittos. IoT wiring and notification framework, with an unix style.
Stars: ✭ 15 (-72.73%)
Mutual labels:  domoticz
domoticz gaspar
Get Gaspar smart meter index to domoticz
Stars: ✭ 23 (-58.18%)
Mutual labels:  domoticz
Mi Flower mate plugin
A plugin for Domoticz, the open source home automation software, which allows it to easily connect to Xiaomi Mi Flower Mate devices
Stars: ✭ 13 (-76.36%)
Mutual labels:  domoticz

Xiaomi Mi Robot Vacuum - Domoticz Python plugin

This plugin uses the Python-miio library.

See this link for more information on the Domoticz plugins.

How it works

Plugin provides: Status, Control, Fan Level, Battery, Care status devices

Status: show current status in readable layout of switch. Status updates by polls (interval) and when you click Control device (for instant status change).

Control: for sending commands.

Fan Level: for adjusting suction power. (MiHome app related: Quiet=38, Balanced=60, Turbo=77, Max=90)

Battery: since 0.0.4 as new device

Care: since 0.1.0 new 5 devices (care status + reset tool)

Since 0.1.0 plugin uses wrapper-server for python-miio lib. It helps to use this plugin in Domoticz without blocking mode.

Since 0.1.2 wrapper-server (MIIO Server) runs outside plugin due limits of domoticz python plugin system.

Installation

Before installation plugin check the python3, python3-dev, pip3 is installed for Domoticz plugin system:

sudo apt-get install python3 python3-dev python3-pip

Make sure you have libffi and openssl headers installed, you can do this on Debian-based systems (like Rasperry Pi) with:

sudo apt-get install libffi-dev libssl-dev.

Also do note that the setuptools version is too old for installing some requirements, so before trying to install this package you should update the setuptools with:

sudo pip3 install -U setuptools.

Also need to install virtualenv:

sudo pip3 install -U virtualenv.

Then go to plugins folder and clone repository:

cd domoticz/plugins
git clone https://github.com/mrin/domoticz-mirobot-plugin.git xiaomi-mirobot
cd xiaomi-mirobot
virtualenv -p python3 .env
source .env/bin/activate

# and then:
pip3 install -r pip_req.txt 
# or pip3 install gevent msgpack-python python-miio==0.3.1

Since 0.1.2 need some prepare of MIIO Server to run as service:

  1. Open and edit miio_server.sh by vi/nano:
nano miio_server.sh

# 1. Check and update absolute path to miio_server.py
# 2. Update IP and TOKEN for robot
# 3. Optional. Change MIIO server host-port bindings if need it

# file miio_server.sh
DAEMON_USER=root
DAEMON=/home/pi/domoticz/plugins/xiaomi-mirobot/miio_server.py
DAEMON_ARGS="192.168.1.12 476e6b70343055483230644c53707a12"
DAEMON_ARGS="$DAEMON_ARGS --host 127.0.0.1 --port 22222"
#
  1. Check path to python3 which python3. By default is /usr/bin/python3. If your path different than default, update miio_server.py first line with your path.
#!/usr/bin/python3
  1. For run as system service:
sudo chmod +x miio_server.py
sudo chmod +x miio_server.sh

# check your path here:
sudo ln -s /home/pi/domoticz/plugins/xiaomi-mirobot/miio_server.sh /etc/init.d/miio_server

# add to startup
sudo update-rc.d miio_server defaults
sudo systemctl daemon-reload

# if you want to remove from startup
sudo update-rc.d -f miio_server remove
  1. Run server and test script:
sudo service miio_server start
sudo chmod +x test.py
sudo ./test.py

# to stop miio server service
sudo service miio_server stop

Also you can run MIIO Server manually and look log output:

sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222

# then you can run test
sudo ./test.py

If server and test is ok, time to restart the Domoticz:

sudo service domoticz.sh restart

Now go to Setup -> Hardware in your Domoticz interface and add type with name Xiaomi Mi Robot Vacuum.

Field Information
Data Timeout Keep Disabled
MIIOServer host:port by default 127.0.0.1:22222
Update interval In seconds, this determines with which interval the plugin polls the status of Vacuum. Suggested is no lower then 5 sec due timeout in python-mirobo lib, but you can try any.
Fan Level Type Standard - standard set of buttons (values supported by MiHome); Slider - allow to set custom values, up to 100 (in standard Max=90) (values not supported by MiHome)
Debug When set to true the plugin shows additional information in the Domoticz log

After clicking on the Add button the new devices are available in Setup -> Devices.

If you want to change Fan Level Type just disable hardware, update type and enable again. Old device can be deleted manually in Devices menu.

How to update plugin

cd domoticz/plugins/xiaomi-mirobot
git pull

Restart the Domoticz service

sudo service domoticz.sh restart

Screenshots

status_unit control_unit

fan_level fan_level2

care1 care2

bat

How to obtain device Token

Check the instruction

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].