Page 7 of 16

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Thursday 01 March 2018 22:46
by Geitje
Hi, I have already reinstalled everything, but keep getting this error:

2018-03-01 22:37:48.027 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'.
2018-03-01 22:37:48.027 Error: (Robotstofzuiger Xiaomi) Module Import failed, exception: 'ImportError'
2018-03-01 22:37:48.027 Error: (Robotstofzuiger Xiaomi) Module Import failed: ' Name: msgpack'
2018-03-01 22:37:48.027 Error: (Robotstofzuiger Xiaomi) Error Line details not available.

I know my Python path is different. I I type: "which python3" I get: /home/pi/domoticz/plugins/xiaomi-mirobot/.env/bin/python3
I pasted this path in miio_server.py. But I keep getting this error! Hop someone can help....

Any ideas? I'm on Stretch, Domoticz newest beta.

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Tuesday 06 March 2018 1:29
by Geitje
I already found out.
See this post: http://www.domoticz.com/forum/viewtopic ... ck#p163889.

Note: insert:
sys.path.append('/usr/local/lib/python3.5/site-packages')

after "import domoticz" in the plugin.py file.

so WITHOUT the and /b codes mentioned in the post, if you insert them too it does nog work I found out!

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 24 March 2018 21:46
by DAVIZINHO
its posible to obtain the map afther the vacuum finish the cleaning?

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Sunday 25 March 2018 16:03
by Whuzz
I have two Mii Vacuums at home (and a Neato, but that's not a connected one). The server config in the plugin only allows for one set of IP + Token... Is there a way (other than me rewriting the code ;) ) to support two vacuums?

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Monday 26 March 2018 11:33
by MarcE85
Hey, i get the following error messages.

Code: Select all

2018-03-26 11:30:09.214 (Staubsauger) Calling message handler 'onHeartbeat'.
2018-03-26 11:30:09.215 Error: (Staubsauger) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'Connecting''.
2018-03-26 11:30:09.215 Error: (Staubsauger) ----> Line 383 in /home/pi/domoticz/plugins/xiaomi-mirobot/plugin.py, function onHeartbeat
2018-03-26 11:30:09.215 Error: (Staubsauger) ----> Line 289 in /home/pi/domoticz/plugins/xiaomi-mirobot/plugin.py, function onHeartbeat
Any ideas on this?

Regards Marc

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Tuesday 27 March 2018 11:59
by remb0

how nice :) because of this great plugin!!

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 14 April 2018 11:26
by StasDemydiuk
Guys, if anyone prefer using docker and its containers (such as me) I've created docker container with miio server for this plugin:
https://hub.docker.com/r/demydiuk/mirobot-miio-server/

Additionally have checked this plugin with Xiaomi Mi Robot, 2nd generation and it works well

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 14 April 2018 16:16
by gijsje
I am trying to get this to work.
I have installed the latest beta domoticz on a pi
Did all the steps and it works, but only one time. :evil:
when i restart the pi the python script is gone from the list
when i test with sudo ./test.py i can still see the vacuum b but i can not select the vacuum from the hardware list.
It is still there from the first time it worked but the type is empty and the is no vacuum to select
The files are also still there


The deceives where created on the first try
Image

After a reboot the type is not showing anymore
Image

the files are still there
Image

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 14 April 2018 16:20
by gijsje
This is the output i i run sudo ./test.py

Code: Select all

pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo ./test.py
test: python modules path: ././.env/lib/python3.5/site-packages

test: trying connect to 127.0.0.1:22222
test: sent request to server [status]
test: reading response...
test: got server reply {'error': None, 'state_code': 8, 'battery': 100, 'clean_seconds': 0, 'clean_area': 1.125, 'fan_level': 60, 'cmd': 'status'}
So it can see the vacuum only the plugin is not loading somehow

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 14 April 2018 17:19
by gijsje
Found it

There seems to be a function in settings to disable all plugins :D

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Sunday 15 April 2018 10:13
by whatisk
I had the vacuum working fine in Domoticz on Ubuntu 16.04. I upgraded to Ubuntu 17.10 due to needing an updated version of Python for another app.
Everything is working fine except for the vacuum in Domoticz.
I have re-done the installation steps at: https://github.com/mrin/domoticz-mirobot-plugin

When running the test script I get the following:

Code: Select all

test: python modules path: ././.env/lib/python3.6/site-packages
test: python modules path: ././.env/lib/python3.5/site-packages
test: trying connect to 127.0.0.1:22222
Traceback (most recent call last)
File "./test.py", line 22, in 
client = socket.create_connection((args.host, args.port))
File "/usr/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
I saw a couple of pages back someone had a similar issue and so did what they suggested. Uninstall and reinstall python-miio. When I went to uninstall I got a message saying it wasn't installed. Once installed I then went through the steps again from the github page and received the same error as above.

If I do the manual test: sudo ./miio_server.py 192.168.1.15 xxxxxxxxxxxxxxxxxxxxxxxxxx --host 127.0.0.1 --port 22222 I get the following:

Code: Select all

server: Starting server on 127.0.0.1 22222
server: connected ('127.0.0.1', 35486)
server: got socket msg: ['status']
server: vac result {'error': None, 'state_code': 8, 'battery': 100, 'fan_level': 60, 'clean_seconds': 0, 'clean_area': 0.0, 'cmd': 'status'}
server: send reply ('127.0.0.1', 35486)
server: got socket msg: ['status']
server: vac result {'error': None, 'state_code': 8, 'battery': 100, 'fan_level': 60, 'clean_seconds': 0, 'clean_area': 0.0, 'cmd': 'status'}
server: send reply ('127.0.0.1', 35486)
server: got socket msg: ['status']
server: vac result {'error': None, 'state_code': 8, 'battery': 100, 'fan_level': 60, 'clean_seconds': 0, 'clean_area': 0.0, 'cmd': 'status'}
server: send reply ('127.0.0.1', 35486)
Which seems to indicate the manual test is working without issue?
Hoping someone may be able to assist.

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Monday 16 April 2018 19:50
by joostnl
I try to install the plugin only after the following command i get two error i think:
Raspberry 2B

Wich python is really recommend? (I did all command from beginning and have allready 3.5 running if i'm correct)

virtualenv -p python3 .env


Error 1:

Code: Select all

(.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ virtualenv -p python3 .env
Running virtualenv with interpreter /home/pi/domoticz/plugins/xiaomi-mirobot/.env/bin/python3
Please use the *system* python to run this script
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 2349, in <module>
    main()
  File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 927, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/home/pi/domoticz/plugins/xiaomi-mirobot/.env/lib/python3.5/posixpath.py", line 357, in abspath
    if not isabs(path):
  File "/home/pi/domoticz/plugins/xiaomi-mirobot/.env/lib/python3.5/posixpath.py", line 64, in isabs
    return s.startswith(sep)
AttributeError: 'NoneType' object has no attribute 'startswith'
I'm not sure if a both is really an error but the next command gives an error. (I think because of above failing)

Tried:
pip3 install -r pip_req.txt

And

pip3 install gevent msgpack-python python-miio==0.3.1

Can someone point me the good direction im not an linux expert

Error:

Code: Select all

(.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ pip3 install gevent msgpack-python python-miio==0.3.1
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting gevent
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Could not fetch URL https://pypi.python.org/simple/gevent/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/gevent/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/gevent/
  Could not fetch URL https://www.piwheels.hostedpi.com/simple/gevent/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='www.piwheels.hostedpi.com', port=443): Max retries exceeded with url: /simple/gevent/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Could not find a version that satisfies the requirement gevent (from versions: )
No matching distribution found for gevent

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Thursday 03 May 2018 21:41
by andreaburlizzi
Sorry for the noob question, but there is a way to use this plugin with a Windows 10 installation of domoticz?

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Friday 11 May 2018 9:39
by corederoma82
Hi,
can you say me how are the compatible vacuum cleaner model?


Thanks

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Friday 11 May 2018 22:01
by molnaratti
RichardBokker wrote: Wednesday 14 February 2018 10:37 I got the script working, but had to convert the Robot - state with tostring().

Here is my case-construction that i'm using.

Code: Select all

-- Using TimeBetween script in main LUA script folder
package.path = package.path .. ';' .. '/home/pi/domoticz/scripts/lua/script_time_TimeBetween.lua'
local TimeBetween = require('timebetween')
time = os.date("*t")

commandArray = {}

-- Possible state's of Robot Vacuum:  Charging / Paused / Cleaning / Waiting / Back to home / Sleeping
-- Selector witch Robot Vacuum:       Clean(10) / Home(20) / Spot(30) / Pauze(40) / Stop(50) / Find(60)

---- Variabele to use
-- StoffieState      (uservariable)
-- AtHome            (uservariable)
-- Stoffie - Control (device)
-- Stoffie - Status  (device)

local stoffie 			= 'Stoffie - Status'
--    print(otherdevices_svalues[stoffie] .. " dit is de actuele status")

-- Required to convert State to Stringvalue
StoffieStatus = tostring(otherdevices_svalues[stoffie]);

-- IDLE
if (uservariables['StoffieState'] == 'IDLE') then
    print ("Stoffie is idle");
   
    if timebetween("08:00","16:00") then   -- Run's only during day hours.
        if (uservariables['AtHome'] == 'NO') then -- Run's only when nobody is at home
        commandArray['SendNotification']='Stoffie is Starting'
        commandArray['Variable:StoffieState']='STARTING'
        
        -- Start Robot command, command send once.
        commandArray['Stoffie - Control'] = 'Set Level 10'
        end
    end
end

-- STARTING
if (uservariables['StoffieState'] == 'STARTING') then

    if StoffieStatus == 'Cleaning' then  -- If robot is cleaning, continu to next step
        commandArray['SendNotification']='Stoffie is Running'
        commandArray['Variable:StoffieState']='RUNNING'
    end
    
    if timebetween("16:00","08:00") then  -- is program hangs, to executed state
        commandArray['Variable:StoffieState']='EXECUTED'
    end

end

-- RUNNING
if (uservariables['StoffieState'] == 'RUNNING') then

    if StoffieStatus == 'Back to home' then  -- If robot is going back to home, continu to next step 
        commandArray['SendNotification']='Stoffie is Stopping'
        commandArray['Variable:StoffieState']='STOPPING'
    end
end

-- STOPPING
if (uservariables['StoffieState'] == 'STOPPING') then

    if StoffieStatus == 'Charging' then  -- if robot is Charging, continu to next step
        commandArray['SendNotification']='Stoffie is Executed'
        commandArray['Variable:StoffieState']='EXECUTED'
        
        -- Stop Robot command, command send once.
        commandArray['Stoffie - Control'] = 'Set Level 50'
    end
end

-- EXECUTED
if (uservariables['StoffieState'] == 'EXECUTED') then

    if timebetween("23:55","23:56") then   -- Runs only once a day. Reset at end of day.
        commandArray['SendNotification']='Stoffie going to Idle'
        commandArray['Variable:StoffieState']='IDLE'
    end
end

return commandArray
Very good, thanks. You would share the time between.lua script?

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 12 May 2018 0:08
by Peggy
andreaburlizzi wrote: Thursday 03 May 2018 21:41 Sorry for the noob question, but there is a way to use this plugin with a Windows 10 installation of domoticz?
Same question here.
Furthermore I'd like to know if python-miio would work under windows.

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Wednesday 16 May 2018 11:16
by corederoma82
corederoma82 wrote: Friday 11 May 2018 9:39 Hi,
can you say me how are the compatible vacuum cleaner model?


Thanks

Somebody can answer me?

Thanks

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Thursday 17 May 2018 16:56
by Jheronymus
Geitje wrote: Tuesday 06 March 2018 1:29 I already found out.
See this post: http://www.domoticz.com/forum/viewtopic ... ck#p163889.

Note: insert:
sys.path.append('/usr/local/lib/python3.5/site-packages')

after "import domoticz" in the plugin.py file.

so WITHOUT the and /b codes mentioned in the post, if you insert them too it does nog work I found out!


Hi, I have a similar problem, but the solution didn't work for me.
When I try to add the line, domoticz won't boot (ie. the browser keeps indicating domoticz is offline or not available)

The error in the domoticz log (without the line)

Code: Select all

Error: (xiaomi-mi-robot-vacuum) failed to load 'plugin.py', Python Path used was '/home/jeroen/domoticz/plugins/xiaomi-robot/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.

Error: (Robottest) Module Import failed, exception: 'ImportError'

Error: (Robottest) Module Import failed: ' Name: msgpack'
I've added this:

Code: Select all

sys.path.append('/usr/local/lib/python3.4/dist-packages')
FYI:
I get this response for searching for msgpack:

Code: Select all

jeroen@Domoticz:~ $ sudo find / -name msgpack*

[sudo] password for jeroen:

/home/jeroen/domoticz/plugins/xiaomi-robot/.env/lib/python3.4/site-packages/pip/_vendor/msgpack

/home/jeroen/.cache/pip/wheels/62/f3/0d/f77f20fce259496b053d6c0dc0eea7114527cf0a7da115a980/msgpack_python-0.4.8-cp34-cp34m-linux_armv6l.whl

/usr/local/lib/python3.4/dist-packages/msgpack_python-0.4.8-py3.4.egg-info

/usr/local/lib/python3.4/dist-packages/msgpack
I've no idea how to debug this at this point. When I run the test script:
jeroen@Domoticz:~/domoticz/plugins/xiaomi-robot $ sudo ./test.py
test: python modules path: ././.env/lib/python3.4/site-packages
test: trying connect to 127.0.0.1:22222
Traceback (most recent call last):
File "./test.py", line 22, in <module>
client = socket.create_connection((args.host, args.port))
File "/usr/lib/python3.4/socket.py", line 509, in create_connection
raise err
File "/usr/lib/python3.4/socket.py", line 500, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
jeroen@Domoticz:~/domoticz/plugins/xiaomi-robot $
But if I start the server from the command line and run the test.py from another console, I can get valid output.
sudo python3 miio_server.py 192.168.1.43 token
server: Starting server on 127.0.0.1 22222
server: connected ('127.0.0.1', 42656)
server: got socket msg: ['status']
server: vac result {'clean_area': 62.4725, 'error': None, 'battery': 100, 'cmd': 'status', 'state_code': 8, 'clean_seconds': 4418, 'fan_level': 60}
server: send reply ('127.0.0.1', 42656)
server: closed connection ('127.0.0.1', 42656)

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Saturday 19 May 2018 12:34
by corederoma82
corederoma82 wrote: Wednesday 16 May 2018 11:16
corederoma82 wrote: Friday 11 May 2018 9:39 Hi,
can you say me how are the compatible vacuum cleaner model?


Thanks

Somebody can answer me?

Thanks
This message is invisible :D
Nice.

Re: Python plugin: Xiaomi Mi Robot Vacuum

Posted: Sunday 20 May 2018 12:11
by Jheronymus
corederoma82 wrote: Saturday 19 May 2018 12:34
corederoma82 wrote: Wednesday 16 May 2018 11:16
corederoma82 wrote: Friday 11 May 2018 9:39 Hi,
can you say me how are the compatible vacuum cleaner model?


Thanks

Somebody can answer me?

Thanks
This message is invisible :D
Nice.
No it's not.
As the name of the topic suggest and you can read on the linked github in the first post; it's for the Xiaomi Mi Robot Vacuum.
http://www.mi.com/roomrobot/

The only question you can ask next is if the newer V2 model is compatible. I think no one reported using that one yet and nothing is mentioned on the python-miio page, but I from the looks of it, it is using the same miio interface and i would guess it will work.