Python plugin: Xiaomi Mi Robot Vacuum Topic is solved

Python and python framework
tonejay
Posts: 3
Joined: Sunday 01 October 2017 15:58
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tonejay » Sunday 01 October 2017 16:01

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: 11
Joined: Wednesday 27 September 2017 23:32
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by wywywywy » 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.

kluczus
Posts: 23
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by kluczus » 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 ?
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

deennoo
Posts: 937
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by deennoo » Monday 02 October 2017 18:36

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 / ESP8266 / MQTT / BLE
http://domo-attitude.fr

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

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tonejay » Monday 02 October 2017 21:16

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: 937
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by deennoo » Tuesday 03 October 2017 8:57

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 / ESP8266 / MQTT / BLE
http://domo-attitude.fr

DAVIZINHO
Posts: 158
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Spain
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by DAVIZINHO » Friday 06 October 2017 16:51

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: 728
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by Dnpwwo » 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.
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: 158
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Spain
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by DAVIZINHO » Saturday 07 October 2017 10:10

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: 11
Joined: Wednesday 27 September 2017 23:32
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by wywywywy » Thursday 19 October 2017 23:00

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 14:19
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by crappy » Saturday 04 November 2017 14:23

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 16:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim » Sunday 05 November 2017 17:40

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: 58
Joined: Tuesday 22 August 2017 20:50
Target OS: Raspberry Pi
Domoticz version:
Location: Belarus
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mrinner » Sunday 05 November 2017 23:42

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: 23
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by kluczus » Monday 06 November 2017 1:22

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: 58
Joined: Tuesday 22 August 2017 20:50
Target OS: Raspberry Pi
Domoticz version:
Location: Belarus
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mrinner » Monday 06 November 2017 8:22

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 16:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim » Monday 06 November 2017 17:03

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: 58
Joined: Tuesday 22 August 2017 20:50
Target OS: Raspberry Pi
Domoticz version:
Location: Belarus
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mrinner » Monday 06 November 2017 17:34

llheim wrote:
Monday 06 November 2017 17: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 16:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim » Monday 06 November 2017 18:34

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 16:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim » Monday 06 November 2017 18:57

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 16:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by llheim » Monday 06 November 2017 19:38

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 3 guests