mrin / domoticz-mirobot-plugin

Xiaomi Mi Robot Vacuum plugin for Domoticz
57 stars 28 forks source link

Problem with the documentation #24

Open fd025270 opened 4 years ago

fd025270 commented 4 years ago

Hello, I setup the plugin following the documentation. It works without any issue.

But after rebooting the Pi, the switch appears in red in domoticz.

I try to troubleshoot, and i think i do something wrong with env.

Do we have to deactivate the env in the installation instruction after pip3 install -r pip_req.txt ?

I rerun manually ./test.py, and i failed (service not started?) i try to run these command again : cd xiaomi-mirobot virtualenv -p python3 .env source .env/bin/activate

and then:

pip3 install -r pip_req.txt

and then i was able to start the service and run the test.py

What did i do wrong ?

To start the service, 2 solutions : 1 - run as system service 2 - run manually

my question : is it possible start the service trhought a script and not as service ?

Thanks for your help

fd025270 commented 4 years ago

here is the log after restarting the pi:

pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo service miio_server stop pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo service miio_server start pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ ./test.py 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 <module> client = socket.create_connection((args.host, args.port)) File "/usr/lib/python3.5/socket.py", line 712, in create_connection raise err File "/usr/lib/python3.5/socket.py", line 703, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

fd025270 commented 4 years ago

And the log to get back service operating :

pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ virtualenv -p python3 .env Already using interpreter /usr/bin/python3 Using base prefix '/usr' New python executable in /home/pi/domoticz/plugins/xiaomi-mirobot/.env/bin/python3 Not overwriting existing python script /home/pi/domoticz/plugins/xiaomi-mirobot/.env/bin/python (you must use /home/pi/domoticz/plugins/xiaomi-mirobot/.env/bin/python3) Installing setuptools, pip, wheel... done. pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ source .env/bin/activate (.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo service miio_server stop (.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo service miio_server start (.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ ./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 {'state_code': 2, 'error': None, 'clean_seconds': 1, 'battery': 93, 'clean_area': 0.0, 'cmd': 'status', 'fan_level': 75}

fd025270 commented 4 years ago

What i am missing to get the service start correctly ?