Try the updated version 0.1.1 of plugin.
Also test.py updated for better error handling.
Thanks!
Moderator: leecollings
However when i wanted to open Domoticz I got an offline message. Running systemctl status it showed 'exited'. Restarting the service didn't help so I renamed the xiaomi-robot folder and tried again. That didn't work. I than rebooted my rpi and that got Domoticz up and running again however without the Domoticz webserver. Strangely enough the xioami-robot server was running. Only after removing the complete xiaomi-robot directory and rebooting the Domotics webserver started again.test: python modules path: ./.env/lib/python3.4/site-packages
test: starting server.py process
test: wait server starting... 5 seconds
server: Starting server on 127.0.0.1 22222
test: trying connect to 127.0.0.1:22222
test: sent request to server [status]
test: reading response...
server: connected ('127.0.0.1', 39072)
server: got socket msg: ['status']
server: vac result {'error': None, 'clean_seconds': 47, 'cmd': 'status', 'state_code': 8, 'fan_level': 60, 'clean_area': 0.6525, 'battery': 100}
test: got server reply {'cmd': 'status', 'state_code': 8, 'clean_area': 0.6525, 'error': None, 'battery': 100, 'fan_level': 60, 'clean_seconds': 47}
test: kill servery.py pid: 1181
Active: active (running) since di 2017-11-07 14:18:59 CET; 55s ago
Process: 621 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/domoticz.service
└─1108 python3 /home/pi/domoticz/plugins/xiaomi-mirobot.back/./ser...
Thanks for the debug! Now plugin looks much better than yesterday (tests works).
test: python modules path: ./.env/lib/python3.4/site-packages
test: starting server.py process
test: wait server starting... 5 seconds
server: Starting server on 127.0.0.1 22222
Traceback (most recent call last):
File "././.env/lib/python3.4/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "././.env/lib/python3.4/site-packages/gevent/baseserver.py", line 360, in serve_forever
self.start()
File "././.env/lib/python3.4/site-packages/gevent/baseserver.py", line 304, in start
self.init_socket()
File "././.env/lib/python3.4/site-packages/gevent/server.py", line 127, in init_socket
self.socket = self.get_listener(self.address, self.backlog, self.family)
File "././.env/lib/python3.4/site-packages/gevent/server.py", line 138, in get_listener
return _tcp_listener(address, backlog=backlog, reuse_addr=cls.reuse_addr, family=family)
File "././.env/lib/python3.4/site-packages/gevent/server.py", line 229, in _tcp_listener
sock.bind(address)
OSError: [Errno 98] Address already in use: ('127.0.0.1', 22222)
Wed Nov 8 14:55:07 2017 <Greenlet at 0x760d2e90: <bound method StreamServer.serve_forever of <StreamServer at 0x760e89f0 address=127.0.0.1:22222 handle=<function socket_incoming_connection at 0x760e1c90>>>> failed with OSError
Traceback (most recent call last):
File "./server.py", line 198, in <module>
services.join()
File "././.env/lib/python3.4/site-packages/gevent/pool.py", line 552, in join
result = self._empty_event.wait(timeout=timeout)
File "././.env/lib/python3.4/site-packages/gevent/event.py", line 219, in wait
return self._wait(timeout)
File "././.env/lib/python3.4/site-packages/gevent/event.py", line 129, in _wait
gotit = self._wait_core(timeout)
File "././.env/lib/python3.4/site-packages/gevent/event.py", line 106, in _wait_core
result = self.hub.switch()
File "././.env/lib/python3.4/site-packages/gevent/hub.py", line 630, in switch
return RawGreenlet.switch(self)
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x760c9da0 epoll default pending=0 ref=0 fileno=3>)
test: trying connect to 127.0.0.1:22222
test: sent request to server [status]
test: reading response...
('test: got server reply', {u'exception': u'python-miio: hasattr(): attribute name must be string', u'cmd': 'status'})
test: kill servery.py pid: 13107
1. Firstly disable the plugin hardware.
Code: Select all
test: python modules path: ./.env/lib/python3.4/site-packages
test: starting server.py process
test: wait server starting... 5 seconds
server: Starting server on 127.0.0.1 22222
test: trying connect to 127.0.0.1:22222
test: sent request to server [status]
test: reading response...
server: connected ('127.0.0.1', 39888)
server: got socket msg: ['status']
Got error when receiving: timed out
Retrying with incremented id, retries left: 3
server: vac result {'fan_level': 90, 'error': None, 'cmd': 'status', 'clean_area': 0.0, 'state_code': 8, 'battery': 100, 'clean_seconds': 5}
test: got server reply {'clean_seconds': 5, 'cmd': 'status', 'battery': 100, 'state_code': 8, 'error': None, 'fan_level': 90, 'clean_area': 0.0}
test: kill servery.py pid: 1670
When sending a clean commando (but the vacuum stays silent):2017-11-09 16:44:39.931 (Sophie) Calling message handler 'onHeartbeat'.
2017-11-09 16:44:39.932 (Sophie) Trying connect to MIIOServer 127.0.0.1:22222
2017-11-09 16:44:39.932 (Sophie) Transport set to: 'TCP/IP', 127.0.0.1:22222.
2017-11-09 16:44:39.932 PluginSystem: Starting I/O service thread.
2017-11-09 16:44:39.932 (Sophie) Connect directive received, action initiated successfully.
2017-11-09 16:44:39.983 (Sophie) Calling message handler 'onConnect'.
2017-11-09 16:44:39.983 (Sophie) MIIOServer connection status is [0] [Success]
2017-11-09 16:44:54.913 (Sophie) Calling message handler 'onHeartbeat'.
2017-11-09 16:44:54.914 (Sophie) Sending 19 bytes of data:
2017-11-09 16:44:54.914 (Sophie) 91 b1 63 6f 6e 73 75 6d 61 62 6c 65 5f 73 74 61 74 75 73 .. ��consumable_status
2017-11-09 16:44:54.914 (Sophie) Sending 8 bytes of data:
2017-11-09 16:44:54.914 (Sophie) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status
Settings in hardware:2017-11-09 16:46:04.346 (Sophie) Calling message handler 'onCommand'.
2017-11-09 16:46:04.347 (Sophie) onCommand called for Unit 2: Command 'Set Level', Level: 10
2017-11-09 16:46:04.347 (Sophie) Sending 7 bytes of data:
2017-11-09 16:46:04.347 (Sophie) 91 a5 73 74 61 72 74 .. .. .. .. .. .. .. .. .. .. .. .. .. ��start
2017-11-09 16:46:09.957 (Sophie) Calling message handler 'onHeartbeat'.
2017-11-09 16:46:09.957 (Sophie) Sending 8 bytes of data:
2017-11-09 16:46:09.957 (Sophie) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status
Test is OK.
Hi,
The following things should not be attempted using the Python Framework:
- Use of asynchronous code or libraries. This will not work the way you expect.
- Use of call back functions. This will not work the way you expect.
- Waiting or sleeping. Plugins are single threaded so the whole plugin system will wait.
Code: Select all
2017-11-18 17:20:39.388 (Xiaomi Robot) Calling message handler 'onHeartbeat'.
2017-11-18 17:20:39.389 (Xiaomi Robot) Sending 8 bytes of data:.
2017-11-18 17:20:39.389 (Xiaomi Robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status
2017-11-18 17:20:39.993 (Xiaomi Robot) Received 86 bytes of data:.
2017-11-18 17:20:39.994 (Xiaomi Robot) 87 a9 66 61 6e 5f 6c 65 76 65 6c 5a a3 63 6d 64 a6 73 74 61 ��fan_levelZ�cmd�sta
2017-11-18 17:20:39.994 (Xiaomi Robot) 74 75 73 aa 73 74 61 74 65 5f 63 6f 64 65 08 a7 62 61 74 74 tus�state_code.�batt
2017-11-18 17:20:39.994 (Xiaomi Robot) 65 72 79 64 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 00 a5 eryd�clean_seconds.�
2017-11-18 17:20:39.994 (Xiaomi Robot) 65 72 72 6f 72 c0 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 00 00 error��clean_area�..
2017-11-18 17:20:39.994 (Xiaomi Robot) 00 00 00 00 00 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ......
2017-11-18 17:20:39.994 (Xiaomi Robot) Calling message handler 'onMessage'.
2017-11-18 17:20:39.994 Error: (Xiaomi Robot) 'onMessage' failed 'TypeError':'onMessage() takes 2 positional arguments but 4 were given'
i have the same problem. do you solved?markcame wrote: ↑Saturday 18 November 2017 17:22 @mrinner thanks for the developing of the plugin, i've decided to upgrade to the last version today but i ran in some problems.
First as already described i have to manually run the server.py because the domoticz cannot run as subprocess.
as second it seems that now i can send command but nont recive status from the robot, the server recive all correctly but passing to plugin somethings goes wrong attached the log of domoticz.
Code: Select all
2017-11-18 17:20:39.388 (Xiaomi Robot) Calling message handler 'onHeartbeat'. 2017-11-18 17:20:39.389 (Xiaomi Robot) Sending 8 bytes of data:. 2017-11-18 17:20:39.389 (Xiaomi Robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status 2017-11-18 17:20:39.993 (Xiaomi Robot) Received 86 bytes of data:. 2017-11-18 17:20:39.994 (Xiaomi Robot) 87 a9 66 61 6e 5f 6c 65 76 65 6c 5a a3 63 6d 64 a6 73 74 61 ��fan_levelZ�cmd�sta 2017-11-18 17:20:39.994 (Xiaomi Robot) 74 75 73 aa 73 74 61 74 65 5f 63 6f 64 65 08 a7 62 61 74 74 tus�state_code.�batt 2017-11-18 17:20:39.994 (Xiaomi Robot) 65 72 79 64 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 00 a5 eryd�clean_seconds.� 2017-11-18 17:20:39.994 (Xiaomi Robot) 65 72 72 6f 72 c0 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 00 00 error��clean_area�.. 2017-11-18 17:20:39.994 (Xiaomi Robot) 00 00 00 00 00 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ...... 2017-11-18 17:20:39.994 (Xiaomi Robot) Calling message handler 'onMessage'. 2017-11-18 17:20:39.994 Error: (Xiaomi Robot) 'onMessage' failed 'TypeError':'onMessage() takes 2 positional arguments but 4 were given'
Code: Select all
2017-11-26 12:28:39.946 Build Hash: c1c42b4b, Date: 2017-11-26 07:53:56
2017-11-26 12:28:39.946 Startup Path: /home/pi/domoticz/
2017-11-26 12:28:39.999 EventSystem: reset all events...
2017-11-26 12:28:40.156 PluginSystem: Started, Python version '3.5.3'.
2017-11-26 12:28:40.166 WebServer(HTTP) started on address: :: with port 8080
2017-11-26 12:28:40.171 WebServer(SSL) started on address: :: with port 443
2017-11-26 12:28:40.173 Proxymanager started.
2017-11-26 12:28:40.175 TCPServer: shared server started...
2017-11-26 12:28:40.175 RxQueue: queue worker started...
2017-11-26 12:28:40.226 Incoming connection from: 192.168.1.68
2017-11-26 12:28:42.175 Hardware Monitor: Started
2017-11-26 12:28:42.228 Wunderground: Worker started...
2017-11-26 12:28:42.228 (Petit Robot) Started.
2017-11-26 12:28:42.229 EventSystem: reset all events...
2017-11-26 12:28:42.230 EventSystem: reset all device statuses...
2017-11-26 12:28:42.385 Python EventSystem: Initalizing event module.
2017-11-26 12:28:42.385 EventSystem: Started
2017-11-26 12:28:42.385 EventSystem: Queue thread started...
2017-11-26 12:28:42.500 PluginSystem: Entering work loop.
2017-11-26 12:28:42.679 (Petit Robot) Entering work loop.
2017-11-26 12:28:42.679 (Petit Robot) Initialized version 0.1.2, author 'mrin'
Code: Select all
2017-11-26 12:38:07.477 (Petit Robot) Received 88 bytes of data:
2017-11-26 12:38:07.477 (Petit Robot) 87 a7 62 61 74 74 65 72 79 64 a3 63 6d 64 a6 73 74 61 74 75 ��batteryd�cmd�statu
2017-11-26 12:38:07.477 (Petit Robot) 73 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 40 41 d8 51 eb 85 1e s�clean_area�@A�Q�.
2017-11-26 12:38:07.477 (Petit Robot) b8 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 09 41 aa 73 ��clean_seconds�.A�s
2017-11-26 12:38:07.477 (Petit Robot) 74 61 74 65 5f 63 6f 64 65 08 a5 65 72 72 6f 72 c0 a9 66 61 tate_code.�error��fa
2017-11-26 12:38:07.477 (Petit Robot) 6e 5f 6c 65 76 65 6c 4d .. .. .. .. .. .. .. .. .. .. .. .. n_levelM
2017-11-26 12:38:07.477 (Petit Robot) Calling message handler 'onMessage'.
2017-11-26 12:38:07.478 (Petit Robot) Got: {'cmd': 'status', 'state_code': 8, 'error': None, 'clean_seconds': 2369, 'fan_level': 77, 'battery': 100, 'clean_area': 35.69}
2017-11-26 12:38:22.305 (Petit Robot) Calling message handler 'onHeartbeat'.
2017-11-26 12:38:22.306 (Petit Robot) Sending 8 bytes of data:
2017-11-26 12:38:22.306 (Petit Robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status
2017-11-26 12:38:22.509 (Petit Robot) Received 88 bytes of data:
2017-11-26 12:38:22.509 (Petit Robot) 87 a7 62 61 74 74 65 72 79 64 a3 63 6d 64 a6 73 74 61 74 75 ��batteryd�cmd�statu
2017-11-26 12:38:22.509 (Petit Robot) 73 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 40 41 d8 51 eb 85 1e s�clean_area�@A�Q�.
2017-11-26 12:38:22.509 (Petit Robot) b8 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 09 41 aa 73 ��clean_seconds�.A�s
2017-11-26 12:38:22.509 (Petit Robot) 74 61 74 65 5f 63 6f 64 65 08 a5 65 72 72 6f 72 c0 a9 66 61 tate_code.�error��fa
2017-11-26 12:38:22.509 (Petit Robot) 6e 5f 6c 65 76 65 6c 4d .. .. .. .. .. .. .. .. .. .. .. .. n_levelM
2017-11-26 12:38:22.509 (Petit Robot) Calling message handler 'onMessage'.
2017-11-26 12:38:22.509 (Petit Robot) Got: {'cmd': 'status', 'state_code': 8, 'error': None, 'clean_seconds': 2369, 'fan_level': 77, 'battery': 100, 'clean_area': 35.69}
2017-11-26 12:38:37.338 (Petit Robot) Calling message handler 'onHeartbeat'.
2017-11-26 12:38:37.339 (Petit Robot) Sending 8 bytes of data:
2017-11-26 12:38:37.339 (Petit Robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status
2017-11-26 12:38:37.542 (Petit Robot) Received 88 bytes of data:
2017-11-26 12:38:37.542 (Petit Robot) 87 a7 62 61 74 74 65 72 79 64 a3 63 6d 64 a6 73 74 61 74 75 ��batteryd�cmd�statu
2017-11-26 12:38:37.542 (Petit Robot) 73 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 40 41 d8 51 eb 85 1e s�clean_area�@A�Q�.
2017-11-26 12:38:37.542 (Petit Robot) b8 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 09 41 aa 73 ��clean_seconds�.A�s
2017-11-26 12:38:37.542 (Petit Robot) 74 61 74 65 5f 63 6f 64 65 08 a5 65 72 72 6f 72 c0 a9 66 61 tate_code.�error��fa
2017-11-26 12:38:37.542 (Petit Robot) 6e 5f 6c 65 76 65 6c 4d .. .. .. .. .. .. .. .. .. .. .. .. n_levelM
2017-11-26 12:38:37.543 (Petit Robot) Calling message handler 'onMessage'.
2017-11-26 12:38:37.543 (Petit Robot) Got: {'cmd': 'status', 'state_code': 8, 'error': None, 'clean_seconds': 2369, 'fan_level': 77, 'battery': 100, 'clean_area': 35.69}
2017-11-26 12:38:52.321 (Petit Robot) Calling message handler 'onHeartbeat'.
2017-11-26 12:38:52.321 (Petit Robot) Sending 8 bytes of data:
hello!.toutazimuth wrote: ↑Sunday 26 November 2017 12:43 @mrinner
All is fine for me also with Pi3 and V3 8747
and I am completely beginner
You are one of the best
it's a perfect program for me !
Thx a lot
mi02.PNGCode: Select all
2017-11-26 12:38:07.477 (Petit Robot) Received 88 bytes of data: 2017-11-26 12:38:07.477 (Petit Robot) 87 a7 62 61 74 74 65 72 79 64 a3 63 6d 64 a6 73 74 61 74 75 ��batteryd�cmd�statu 2017-11-26 12:38:07.477 (Petit Robot) 73 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 40 41 d8 51 eb 85 1e s�clean_area�@A�Q�. 2017-11-26 12:38:07.477 (Petit Robot) b8 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 09 41 aa 73 ��clean_seconds�.A�s 2017-11-26 12:38:07.477 (Petit Robot) 74 61 74 65 5f 63 6f 64 65 08 a5 65 72 72 6f 72 c0 a9 66 61 tate_code.�error��fa 2017-11-26 12:38:07.477 (Petit Robot) 6e 5f 6c 65 76 65 6c 4d .. .. .. .. .. .. .. .. .. .. .. .. n_levelM 2017-11-26 12:38:07.477 (Petit Robot) Calling message handler 'onMessage'. 2017-11-26 12:38:07.478 (Petit Robot) Got: {'cmd': 'status', 'state_code': 8, 'error': None, 'clean_seconds': 2369, 'fan_level': 77, 'battery': 100, 'clean_area': 35.69} 2017-11-26 12:38:22.305 (Petit Robot) Calling message handler 'onHeartbeat'. 2017-11-26 12:38:22.306 (Petit Robot) Sending 8 bytes of data: 2017-11-26 12:38:22.306 (Petit Robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status 2017-11-26 12:38:22.509 (Petit Robot) Received 88 bytes of data: 2017-11-26 12:38:22.509 (Petit Robot) 87 a7 62 61 74 74 65 72 79 64 a3 63 6d 64 a6 73 74 61 74 75 ��batteryd�cmd�statu 2017-11-26 12:38:22.509 (Petit Robot) 73 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 40 41 d8 51 eb 85 1e s�clean_area�@A�Q�. 2017-11-26 12:38:22.509 (Petit Robot) b8 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 09 41 aa 73 ��clean_seconds�.A�s 2017-11-26 12:38:22.509 (Petit Robot) 74 61 74 65 5f 63 6f 64 65 08 a5 65 72 72 6f 72 c0 a9 66 61 tate_code.�error��fa 2017-11-26 12:38:22.509 (Petit Robot) 6e 5f 6c 65 76 65 6c 4d .. .. .. .. .. .. .. .. .. .. .. .. n_levelM 2017-11-26 12:38:22.509 (Petit Robot) Calling message handler 'onMessage'. 2017-11-26 12:38:22.509 (Petit Robot) Got: {'cmd': 'status', 'state_code': 8, 'error': None, 'clean_seconds': 2369, 'fan_level': 77, 'battery': 100, 'clean_area': 35.69} 2017-11-26 12:38:37.338 (Petit Robot) Calling message handler 'onHeartbeat'. 2017-11-26 12:38:37.339 (Petit Robot) Sending 8 bytes of data: 2017-11-26 12:38:37.339 (Petit Robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. ��status 2017-11-26 12:38:37.542 (Petit Robot) Received 88 bytes of data: 2017-11-26 12:38:37.542 (Petit Robot) 87 a7 62 61 74 74 65 72 79 64 a3 63 6d 64 a6 73 74 61 74 75 ��batteryd�cmd�statu 2017-11-26 12:38:37.542 (Petit Robot) 73 aa 63 6c 65 61 6e 5f 61 72 65 61 cb 40 41 d8 51 eb 85 1e s�clean_area�@A�Q�. 2017-11-26 12:38:37.542 (Petit Robot) b8 ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 09 41 aa 73 ��clean_seconds�.A�s 2017-11-26 12:38:37.542 (Petit Robot) 74 61 74 65 5f 63 6f 64 65 08 a5 65 72 72 6f 72 c0 a9 66 61 tate_code.�error��fa 2017-11-26 12:38:37.542 (Petit Robot) 6e 5f 6c 65 76 65 6c 4d .. .. .. .. .. .. .. .. .. .. .. .. n_levelM 2017-11-26 12:38:37.543 (Petit Robot) Calling message handler 'onMessage'. 2017-11-26 12:38:37.543 (Petit Robot) Got: {'cmd': 'status', 'state_code': 8, 'error': None, 'clean_seconds': 2369, 'fan_level': 77, 'battery': 100, 'clean_area': 35.69} 2017-11-26 12:38:52.321 (Petit Robot) Calling message handler 'onHeartbeat'. 2017-11-26 12:38:52.321 (Petit Robot) Sending 8 bytes of data:
Users browsing this forum: No registered users and 1 guest