Python plugin: Xiaomi Mi Robot Vacuum Topic is solved

Python and python framework

Moderator: leecollings

tonejay
Posts: 3
Joined: Sunday 01 October 2017 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tonejay »

wywywywy wrote: Wednesday 27 September 2017 23:38 Hi guys. I've run into a problem that I hope you guys can help with please.

So I've git cloned this and installed mirobo in the .vendor directory with all the requisites, and restarted Domoticz multiple times.

But, when I go to the Setup > Hardware screen, I'm not seeing the parameters for this plugin. Clicking on the Add button also does nothing.

It is as if Domoticz can't read the plugin.py correctly. This is no errors in the log, even with -verbose 2.

The PluginSystem is definitely started - "PluginSystem: Started, Python version '3.5.2'."

Any ideas please?

Image

This is the latest stable Domoticz v3.8153, on an Orange Pi Zero, with Ubuntu Server 16 LTS.

Apt update and upgrade were performed prior to installing this.

Many thanks!
Hi guys ! got the same problem ! any solution ??
wywywywy
Posts: 13
Joined: Wednesday 27 September 2017 23:32
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by wywywywy »

Hi,

Yes I've found the solution. For me anyway, I don't know if your problem is the same.

To cut a long story short, it is to do with the browser. Firefox / Firefox ESR / Chrome don't work. But for reasons IE11 does! IE! In 2017! I didn't try Edge or mobile browsers.

I am unsure why that happens, and it seems like other people don't have the same problem. There's no error in the console. I haven't dug deeper to check the DOM elements or JS code etc.
kluczus
Posts: 24
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by kluczus »

kluczus wrote: Friday 29 September 2017 13:41 How to check a status of the vacuum ? I installed plugin, everything works just fine. I was trying to define a blockly with notification when vacuum is comming back to home but without luck.
Blocky

Code: Select all

if vacuum-status = "Back to home" then ....
is not working
Anyone ?
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by deennoo »

kluczus wrote: Monday 02 October 2017 17:09
kluczus wrote: Friday 29 September 2017 13:41 How to check a status of the vacuum ? I installed plugin, everything works just fine. I was trying to define a blockly with notification when vacuum is comming back to home but without luck.
Blocky

Code: Select all

if vacuum-status = "Back to home" then ....
is not working
Anyone ?
That just a basic LUA event on a selector switch, nothing hard on this, all is explain on the wiki, and your question isn't Xiaomi Vaccum robot specific
Your best reading is : https://www.domoticz.com/wiki/Events
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
tonejay
Posts: 3
Joined: Sunday 01 October 2017 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tonejay »

wywywywy wrote: Monday 02 October 2017 0:28 Hi,

Yes I've found the solution. For me anyway, I don't know if your problem is the same.

To cut a long story short, it is to do with the browser. Firefox / Firefox ESR / Chrome don't work. But for reasons IE11 does! IE! In 2017! I didn't try Edge or mobile browsers.

I am unsure why that happens, and it seems like other people don't have the same problem. There's no error in the console. I haven't dug deeper to check the DOM elements or JS code etc.
Yes !!! It works now! Edge saved my life! 😅
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by deennoo »

There an easy tool to retrive your token if your an android user :

https://github.com/ultrara1n/MiToolkit/releases

This tool is a windows one, plug your android device on usb debug mode, run mitoolkit.exe and click "verbindung prûfen"

once done choose :

"Token auslesen"

Your phone will ask you to confirm "saving data", say yes and don't use a password. wait a bit, mihome app will open, and backup will start.

Then token list will be show in a separate windows.

This run with a Xiaomi robot fw : 3.3.9_03077

and then of course this run with this plugin !
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by DAVIZINHO »

hello,
It works fine for me but i have this message in log every minute

Error: Xiaomi Mi Robot Vacuum hardware (7) thread seems to have ended unexpectedly

any idea?

thanks a lot!
-David-
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by Dnpwwo »

@DAVIZINHO,

This message appears if the plugin heartbeat is set to greater than about 30 seconds.

Plugin functionality is not affected.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by DAVIZINHO »

Dnpwwo wrote: Saturday 07 October 2017 9:34 @DAVIZINHO,

This message appears if the plugin heartbeat is set to greater than about 30 seconds.

Plugin functionality is not affected.
ah, OK!!
thanks a lot
wywywywy
Posts: 13
Joined: Wednesday 27 September 2017 23:32
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by wywywywy »

I set the heartbeat to 30 sec and it seems to be crashing Domoticz a lot. Any ideas please?

Code: Select all

2017-10-17 21:50:55.979  (Robot Vacuum) Calling message handler 'onHeartbeat'.
2017-10-17 21:51:00.748  (Robot Vacuum) Poll: {"battery": 100, "clean_area": 5.6325, "fan_level": 38, "clean_seconds": 764, "state_code": 8}

2017-10-17 21:51:26.012  (Robot Vacuum) Calling message handler 'onHeartbeat'.
2017-10-17 21:51:30.834  (Robot Vacuum) Poll: {"fan_level": 38, "clean_seconds": 764, "battery": 100, "state_code": 8, "clean_area": 5.6325}

2017-10-17 21:51:56.000  (Robot Vacuum) Calling message handler 'onHeartbeat'.
2017-10-17 21:52:01.247  (Robot Vacuum) Poll: {"clean_area": 5.6325, "clean_seconds": 764, "battery": 100, "fan_level": 38, "state_code": 8}

2017-10-17 21:52:26.013  (Robot Vacuum) Calling message handler 'onHeartbeat'.
2017-10-17 21:52:31.300  (Robot Vacuum) Poll: {"clean_area": 5.6325, "state_code": 8, "clean_seconds": 764, "battery": 100, "fan_level": 38}

2017-10-17 21:52:56.012  (Robot Vacuum) Calling message handler 'onHeartbeat'.
2017-10-17 21:52:56.046  Error: Domoticz received fatal signal 11 !...
2017-10-17 21:52:56.065  Error:   /home/pi/domoticz/domoticz() [0x1cdc48]
2017-10-17 21:52:56.066  Error:   /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cdd00]
2017-10-17 21:52:56.066  Error:   /lib/arm-linux-gnueabihf/libc.so.6(+0x25260) [0xb6bef260]
Also today the plugin itself has crashed. It has happened quite a few times.

Code: Select all

2017-10-19 21:50:30.823 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:52:00.850 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:52:30.860 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:54:00.887 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:54:30.897 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:56:00.013 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:56:30.023 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:58:00.051 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 21:58:30.061 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly
2017-10-19 22:00:00.583 Error: Robot Vacuum hardware (4) thread seems to have ended unexpectedly 
crappy
Posts: 1
Joined: Saturday 04 November 2017 13:19
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by crappy »

I have also a strange issue. I get the message: wrong key lenght. I see on the instructions the key lenght should be 32 characters. Mine is 96. I follow all the instructions from an iOS backup through the use of ibackup and SQLLite. I get a key, but it appears te be to long?? Anyone else has this issue? My fw is 3.3.9_003077.
llheim
Posts: 8
Joined: Sunday 12 March 2017 15:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim »

I had the same problem and the python scripts found on other sites didn’t work so I used: http://aes.online-domain-tools.com/

As input paste your key (don’t forget to tick ‘hex’), the key is 32 zeros (00000000 etc, again don’t forget to tick ‘hex’)

Then click decrypt and your 32 character key will show in a box in the bottom right of your screen.
mrinner
Posts: 56
Joined: Tuesday 22 August 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belarus
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mrinner »

Plugin updated to 0.1.0

Added:
1. Care devices with status (Main Brush, Side Brush, Filter, Sensor)
2. Care reset control
Updated:
New communication way with python-miio. Now Domoticz plugin connects by tcp/ip to local server which communicate with robot, this way allows plugin works without blocking domoticz python system as was before.
kluczus
Posts: 24
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by kluczus »

Problem with a new version. Installed as described in wiki.

2017-11-06 00:07:23.357 Error: (xiaomi-mi-robot-vacuum) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/xiaomi-mirobot/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2017-11-06 00:07:23.357 Error: (Odkurzacz) Module Import failed, exception: 'ImportError'
2017-11-06 00:07:23.357 Error: (Odkurzacz) Module Import failed: ' Name: msgpack'
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!
mrinner
Posts: 56
Joined: Tuesday 22 August 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belarus
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mrinner »

Seems like I forgot to add one command in wiki.
All required libs need to be installed under virtualenv and then plugin should read .env folder:

Code: Select all

cd xiaomi-mirobot
virtualenv -p python3 .env

source .env/bin/activate # new command

# and after activating virtualenv:
pip3 install gevent msgpack-python python-miio==0.3.1
# after installing:
deactivate
Also you can run test script for check local miio-server. This script runs server and send 'status' command to this server:

Code: Select all

cd xiaomi-mirobot
python3 test.py ROBOT_IP  TOKEN
llheim
Posts: 8
Joined: Sunday 12 March 2017 15:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim »

I tried to install the new plugin but installing python-mio==0.3.1 gives an error:

error in cryptography setup command: Invalid environment marker: platform_python_implementation != 'PyPy'

I managed to install gevent and msgpack-python separately. The error in Domoticz keeps the same:

Module Import failed, exception: 'ImportError'
Module Import failed: ' Name: msgpack'
mrinner
Posts: 56
Joined: Tuesday 22 August 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belarus
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mrinner »

llheim wrote: Monday 06 November 2017 16:03 I tried to install the new plugin but installing python-mio==0.3.1 gives an error:
Google said what issue possible due outdated setuptools. Try this:

Code: Select all

sudo pip3 install -U setuptools
# also make sure you have installed:
sudo apt-get install libffi-dev libssl-dev
Also make sure you under virtualenv when installing packes:

Code: Select all

cd xiaomi-mirobot
source .env/bin/activate
pip3 install gevent msgpack-python python-miio==0.3.1
At the end of installation you can check installed libs in .env/lib/python[NUMBER]/site-packages. Folder msgpack, miio, cffi etc. should be there.
llheim
Posts: 8
Joined: Sunday 12 March 2017 15:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim »

Yes I found the same answer on Google :) Unfortunately upgrading didn't work, I already had installed the most recent packages. However when I checked the folder I noticed the msgpack files weren't installed so I tried installing msgpack-python again. That seemed to do the trick because the error in Domoticz changes to:

Error: Expected: myVar = Domoticz.Connection(Name="", Transport="", Protocol="", Address="", Port="", Baud=0)
Error: (Mi-en) 'CConnection_init' failed 'TypeError':'Required argument 'Protocol' (pos 3) not found'.

Progress!

The installation error for python--mio is now:

error in cryptography setup command: Invalid environment marker: python_version < '3'

Strange because I have python3.4.
llheim
Posts: 8
Joined: Sunday 12 March 2017 15:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim »

Ok found the answer. Upgrading the setuptools is the answer but you need to ugrade in the virtualenv. :oops:
llheim
Posts: 8
Joined: Sunday 12 March 2017 15:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim »

Last update for today. The installation now went without errors but it does't work (i also have python-miio installed and that does work so it is not a token issue). The error in Domoticz stays the same (see above) and an other error appears:

Error: CConnection_connect:, illegal operation, Plugin has not started yet.
Trying connect to MIIOServer 127.0.0.1:22222

From test.py gives:
trying connect to 127.0.0.1:22222
sent request to server [status]
reading response...

And there it hangs.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest