NEWS
[Frage] Xiaomi Vacuum cleaner
-
Hat schon jemand erfolg mit der Umsetzung in Javascript ?
-
Die eigentliche Routine habe ich bereits nach Javascript umgeschrieben und scheint zu funktionieren. Jetzt muss ich das Ganze in einen Adapter umschreiben. Da ich hiermit noch keinerlei Erfahrungen habe, wird das etwas dauern. Mal sehen, was das nächste Wochenende bringt.
-
Kannst du die Umsetzung in Javascript schon mal hier bereit stellen?
-
Kannst du die Umsetzung in Javascript schon mal hier bereit stellen?
`
Ja, das wäre toll.
Dann können wir ja schon einmal testen.
mfg
-
tpr,
Es will nicht! Nachdem ich
sudo pip install cryptography
eingegeben habe, erhalte ich folgende Fehlermeldung:
! File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 70, in <module>import packaging.version
! ImportError: No module named packaging.version
! –--------------------------------------
! Cleaning up...
! Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-otSuJz/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-2vd4e4-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-otSuJz/cffi
! Storing debug log for failure in /root/.pip/pip.log</module>Was tun? Hast Du eine Idee? Alle anderen Befehle aus
https://raspberrypi.stackexchange.com/q … 2413#62413
liefen anstandslos durch. Und dann bei cryptography war Schluss
-
tpr.
Ergänzung: nachdem sich cryptography nicht installieren ließ habe ich einfach mal die beiden weiteren Befehle
ausgeführt. Danach lief die Installation von cryptography durch. Ich dachte schon, das sei es. Wenn ich dann aber mirobo ausführe, bekomme ich wieder die packaging Fehlermeldung
! root@raspberrypi:~# pip3 install python-mirobo
! Traceback (most recent call last):
! File "/usr/bin/pip3", line 5, in <module>from pkg_resources import load_entry_point
! File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 70, in <module>import packaging.version
! ImportError: No module named 'packaging'</module></module>Habe alles so gemacht, wie Du es im Github beschreibst. Außer: "Using virtualenv is recommended." Das habe ich nicht durchgeführt. Auch, weil ich nicht kapiere, was das ist. Könnte da der Hund begraben sein?
-
tpr.
Ergänzung: nachdem sich cryptography nicht installieren ließ habe ich einfach mal die beiden weiteren Befehle
ausgeführt. Danach lief die Installation von cryptography durch. Ich dachte schon, das sei es. Wenn ich dann aber mirobo ausführe, bekomme ich wieder die packaging Fehlermeldung
! root@raspberrypi:~# pip3 install python-mirobo
! Traceback (most recent call last):
! File "/usr/bin/pip3", line 5, in <module>from pkg_resources import load_entry_point
! File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 70, in <module>import packaging.version
! ImportError: No module named 'packaging'</module></module> `Hallo skorpil,
leider ist der Grund für diese Fehlermeldung zu alte pip oder setuptools, deswegen weigert er da.
virtualenv (virtual environment) ist ein tool, womit man ohne root/sudo neue Entwicklungsumgebungen einrichten kann. D.h. damit könntest Du die Python-Pakete in ein Verzeichnis installieren lassen, und wenn etwas schief ginge, dieses Verzeichnis wieder löschen und neustarten.
Du könntest noch das ausprobieren, so geht die Einrichtung eines virtualenvs (alles von unten wird ohne root, d.h. mit deinem normalen Benutzer ausgeführt):
virtualenv -p python3 <name des/ordners="">source <name des/ordners="">/bin/activate</name></name>
Dann wird alle Pakete in diesen eigenständigen Ordner wie üblich mit pip installiert (nach aktualisierung von pip & setuptools).
pip install -U pip pip install -U setuptools pip install python-mirobo
Hoffentlich das hilft, wenn nicht, ich habe wirklich keine andere Ideen gerade.
-
tpr,
erstmal wieder ein DD (=dickes Dankeschön )
Wenn das wohl an "zu alten" pip und setuptool liegt, dann müssen diese sich doch irgendwie auf den neuesten Stand bringen lassen können. Ich habe den Raspi im übrigen erst vor ca. 3 Wochen neu aufgesetzt. Und er läuft mit Jessie, ist geupdated und geupgraded. So richtig kapieren tue ich das nicht.
Liebe Grüße
Bernd
-
tpr,
erstmal wieder ein DD (=dickes Dankeschön )
Wenn das wohl an "zu alten" pip und setuptool liegt, dann müssen diese sich doch irgendwie auf den neuesten Stand bringen lassen können. Ich habe den Raspi im übrigen erst vor ca. 3 Wochen neu aufgesetzt. Und er läuft mit Jessie, ist geupdated und geupgraded. So richtig kapieren tue ich das nicht. `
Kein Problem. In "pip install -U pip" -U steht für upgrade -> das sollte es aktualisieren. Ebenso für setuptools. -
Jetzt! Erfolgsmeldung! Hier
! root@raspberrypi:~# pip install -U pip
! Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages
! root@raspberrypi:~# pip install -U setuptools
! Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages
! Requirement already up-to-date: six>=1.6.0 in /usr/local/lib/python2.7/dist-packages (from setuptools)
! Requirement already up-to-date: packaging>=16.8 in /usr/local/lib/python2.7/dist-packages (from setuptools)
! Requirement already up-to-date: appdirs>=1.4.0 in /usr/local/lib/python2.7/dist-packages (from setuptools)
! Requirement already up-to-date: pyparsing in /usr/local/lib/python2.7/dist-packages (from packaging>=16.8->setuptools)
! root@raspberrypi:~# pip install python-mirobo
! Collecting python-mirobo
! Downloading python-mirobo-0.0.3.tar.gz
! Requirement already satisfied: construct in /usr/local/lib/python2.7/dist-packages (from python-mirobo)
! Requirement already satisfied: click in /usr/local/lib/python2.7/dist-packages (from python-mirobo)
! Requirement already satisfied: cryptography in /usr/local/lib/python2.7/dist-packages (from python-mirobo)
! Collecting pretty_cron (from python-mirobo)
! Downloading pretty_cron-1.0.2-py2.py3-none-any.whl
! Requirement already satisfied: idna>=2.0 in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: pyasn1>=0.1.8 in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: setuptools>=11.3 in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: enum34 in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: ipaddress in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: cffi>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography->python-mirobo)
! Requirement already satisfied: packaging>=16.8 in /usr/local/lib/python2.7/dist-packages (from setuptools>=11.3->cryptography->python-mirobo)
! Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python2.7/dist-packages (from setuptools>=11.3->cryptography->python-mirobo)
! Requirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.4.1->cryptography->python-mirobo)
! Requirement already satisfied: pyparsing in /usr/local/lib/python2.7/dist-packages (from packaging>=16.8->setuptools>=11.3->cryptography->python-mirobo)
! Building wheels for collected packages: python-mirobo
! Running setup.py bdist_wheel for python-mirobo … done
! Stored in directory: /root/.cache/pip/wheels/37/86/43/172c8c98b369bb0f4ef439ea412e014626a3ce9e6a0210c1bd
! Successfully built python-mirobo
! Installing collected packages: pretty-cron, python-mirobo
! Successfully installed pretty-cron-1.0.2 python-mirobo-0.0.3
! root@raspberrypi:~#Danke! Bis hierhin. Und morgen teste ich dann weiter…
-
So, doch schon getestet. Leider erfolglos:
> After that verify that the connection is working by running the command withour parameters, you should be presented a status report from the vacuum.
Die Eingabe von mirobo bringt folgendes
! root@raspberrypi:~# mirobo
! Traceback (most recent call last):
! File "/usr/local/bin/mirobo", line 11, in <module>sys.exit(cli())
! File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call
! return self.main(*args, **kwargs)
! File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
! rv = self.invoke(ctx)
! File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1043, in invoke
! return Command.invoke(self, ctx)
! File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
! return ctx.invoke(self.callback, **ctx.params)
! File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
! return callback(*args, **kwargs)
! File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
! return f(get_current_context(), *args, **kwargs)
! File "/usr/local/lib/python2.7/dist-packages/mirobo/cli.py", line 29, in cli
! vac = mirobo.Vacuum(ip, token)
! File "/usr/local/lib/python2.7/dist-packages/mirobo/vacuum.py", line 14, in init
! self.token = bytes.fromhex(token)
! AttributeError: type object 'str' has no attribute 'fromhex'</module>Was will uns das sagen?
-
File "/usr/local/lib/python2.7/dist-packages/mirobo/vacuum.py", line 14, in init
self.token = bytes.fromhex(token)
AttributeError: type object 'str' has no attribute 'fromhex'
Was will uns das sagen? `
Es soll mit python/pip3 installiert und benutzt werden, da es nur python3 unterstützt. Hier nochmal Schritt zu Schritt wie ich es gerade mit virtualenv auf Raspberry Pi 3 mit Raspbian Jessie getestet habe:!
homeassistant@rasputin:~ $ virtualenv test_environment -p python3 Already using interpreter /usr/bin/python3 Using base prefix '/usr' New python executable in test_environment/bin/python3 Also creating executable in test_environment/bin/python Installing setuptools, pip...done. homeassistant@rasputin:~ $ source test_environment/bin/activate (test_environment)homeassistant@rasputin:~ $ pip install -U pip setuptools Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144 Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded Downloading/unpacking setuptools from https://pypi.python.org/packages/49/09/68b43c68492a9d437c137892d11427ac45a1497812c8a8ce2cd17649a27c/setuptools-34.3.1-py2.py3-none-any.whl#md5=ea9c9c51767f5037754dc6228cdeb607 Downloading setuptools-34.3.1-py2.py3-none-any.whl (389kB): 389kB downloaded Downloading/unpacking packaging>=16.8 (from setuptools) Downloading packaging-16.8-py2.py3-none-any.whl Downloading/unpacking six>=1.6.0 (from setuptools) Downloading six-1.10.0-py2.py3-none-any.whl Downloading/unpacking appdirs>=1.4.0 (from setuptools) Downloading appdirs-1.4.3-py2.py3-none-any.whl Downloading/unpacking pyparsing (from packaging>=16.8->setuptools) Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB): 56kB downloaded Installing collected packages: pip, setuptools, packaging, six, appdirs, pyparsing Found existing installation: pip 1.5.6 Uninstalling pip: Successfully uninstalled pip Found existing installation: setuptools 5.5.1 Uninstalling setuptools: Successfully uninstalled setuptools Successfully installed pip setuptools packaging six appdirs pyparsing Cleaning up... (test_environment)homeassistant@rasputin:~ $ pip install python-mirobo Collecting python-mirobo Using cached python_mirobo-0.0.3-py3-none-any.whl Collecting cryptography (from python-mirobo) Using cached cryptography-1.7.2.tar.gz Collecting pretty-cron (from python-mirobo) Using cached pretty_cron-1.0.2-py2.py3-none-any.whl Collecting click (from python-mirobo) Using cached click-6.7-py2.py3-none-any.whl Collecting construct (from python-mirobo) Using cached construct-2.8.10-py2.py3-none-any.whl Collecting idna>=2.0 (from cryptography->python-mirobo) Downloading idna-2.5-py2.py3-none-any.whl (55kB) 100% |████████████████████████████████| 61kB 1.6MB/s Collecting pyasn1>=0.1.8 (from cryptography->python-mirobo) Using cached pyasn1-0.2.3-py2.py3-none-any.whl Requirement already satisfied: six>=1.4.1 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo) Requirement already satisfied: setuptools>=11.3 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo) Collecting cffi>=1.4.1 (from cryptography->python-mirobo) Using cached cffi-1.9.1.tar.gz Requirement already satisfied: appdirs>=1.4.0 in ./test_environment/lib/python3.4/site-packages (from setuptools>=11.3->cryptography->python-mirobo) Requirement already satisfied: packaging>=16.8 in ./test_environment/lib/python3.4/site-packages (from setuptools>=11.3->cryptography->python-mirobo) Collecting pycparser (from cffi>=1.4.1->cryptography->python-mirobo) Using cached pycparser-2.17.tar.gz Requirement already satisfied: pyparsing in ./test_environment/lib/python3.4/site-packages (from packaging>=16.8->setuptools>=11.3->cryptography->python-mirobo) Installing collected packages: idna, pyasn1, pycparser, cffi, cryptography, pretty-cron, click, construct, python-mirobo Running setup.py install for pycparser ... done Running setup.py install for cffi ... done Running setup.py install for cryptography ... done Successfully installed cffi-1.9.1 click-6.7 construct-2.8.10 cryptography-1.7.2 idna-2.5 pretty-cron-1.0.2 pyasn1-0.2.3 pycparser-2.17 python-mirobo-0.0.3 (test_environment)homeassistant@rasputin:~ $ mirobo State: Charging Battery: 100 Fanspeed: 30 Cleaning since: 0:26:44 Cleaned area: 21.3275 m² DND enabled: 0 Map present: 1 in_cleaning: 0 !
! Zuvor hatte ich schon MIROBO_TOKEN und MIROBO_IP mit export gesetzt wie in README.md gezeigt ist. -
Dankeschön. Das ist nun Arbeit für mich für morgen. Ich werde berichten. Gute Nacht!
-
@gst666 wenn du noch Hilfe brauchst, sag bescheid…
-
tpr,
guten Abend. Nach Deinen zuletzt geposteten Anweisungen bin ich vorgegangen. Ergebis:
! Using username "root".
! The programs included with the Debian GNU/Linux system are free software;
! the exact distribution terms for each program are described in the
! individual files in /usr/share/doc/*/copyright.
! Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
! permitted by applicable law.
! Last login: Wed Mar 8 19:27:02 2017 from server.fritz.box
! root@raspberrypi:~# virtualenv test_environment -p python3
! Running virtualenv with interpreter /usr/bin/python3
! Using base prefix '/usr'
! New python executable in /root/test_environment/bin/python3
! Not overwriting existing python script /root/test_environment/bin/python (you must use /root/test_environment/bin/python3)
! Installing setuptools, pip, wheel…done.
! root@raspberrypi:~# source test_environment/bin/activate
! (test_environment) root@raspberrypi:~# pip install -U pip setuptools
! Requirement already up-to-date: pip in ./test_environment/lib/python3.4/site-packages
! Requirement already up-to-date: setuptools in ./test_environment/lib/python3.4/site-packages
! Requirement already up-to-date: six>=1.6.0 in ./test_environment/lib/python3.4/site-packages (from setuptools)
! Requirement already up-to-date: packaging>=16.8 in ./test_environment/lib/python3.4/site-packages (from setuptools)
! Requirement already up-to-date: appdirs>=1.4.0 in ./test_environment/lib/python3.4/site-packages (from setuptools)
! Requirement already up-to-date: pyparsing in ./test_environment/lib/python3.4/site-packages (from packaging>=16.8->setuptools)
! (test_environment) root@raspberrypi:~# pip install python-mirobo
! Requirement already satisfied: python-mirobo in ./test_environment/lib/python3.4/site-packages
! Requirement already satisfied: pretty-cron in ./test_environment/lib/python3.4/site-packages (from python-mirobo)
! Requirement already satisfied: cryptography in ./test_environment/lib/python3.4/site-packages (from python-mirobo)
! Requirement already satisfied: construct in ./test_environment/lib/python3.4/site-packages (from python-mirobo)
! Requirement already satisfied: click in ./test_environment/lib/python3.4/site-packages (from python-mirobo)
! Requirement already satisfied: six>=1.4.1 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo)
! Requirement already satisfied: pyasn1>=0.1.8 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo)
! Requirement already satisfied: cffi>=1.4.1 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo)
! Requirement already satisfied: idna>=2.0 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo)
! Requirement already satisfied: setuptools>=11.3 in ./test_environment/lib/python3.4/site-packages (from cryptography->python-mirobo)
! Requirement already satisfied: pycparser in ./test_environment/lib/python3.4/site-packages (from cffi>=1.4.1->cryptography->python-mirobo)
! Requirement already satisfied: packaging>=16.8 in ./test_environment/lib/python3.4/site-packages (from setuptools>=11.3->cryptography->python-mirobo)
! Requirement already satisfied: appdirs>=1.4.0 in ./test_environment/lib/python3.4/site-packages (from setuptools>=11.3->cryptography->python-mirobo)
! Requirement already satisfied: pyparsing in ./test_environment/lib/python3.4/site-packages (from packaging>=16.8->setuptools>=11.3->cryptography->python-mirobo)
! (test_environment) root@raspberrypi:~# mirobo
! Usage: mirobo [OPTIONS] COMMAND [ARGS]…
! Error: Missing option "--ip".
! (test_environment) root@raspberrypi:~# export MIROBO_IP=192.168.X.X
! (test_environment) root@raspberrypi:~# export MIROBO_TOKEN=XXXXXXXXXXXXXXXXXX
! (test_environment) root@raspberrypi:~# mirobo
! ERROR:mirobo.vacuum:got error when receiving: timed out
! Traceback (most recent call last):
! File "/root/test_environment/bin/mirobo", line 11, in <module>sys.exit(cli())
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 722, in call
! return self.main(*args, **kwargs)
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 697, in main
! rv = self.invoke(ctx)
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 1043, in invoke
! return Command.invoke(self, ctx)
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 895, in invoke
! return ctx.invoke(self.callback, **ctx.params)
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 535, in invoke
! return callback(*args, **kwargs)
! File "/root/test_environment/lib/python3.4/site-packages/click/decorators.py", line 17, in new_func
! return f(get_current_context(), *args, **kwargs)
! File "/root/test_environment/lib/python3.4/site-packages/mirobo/cli.py", line 39, in cli
! ctx.invoke(status)
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 535, in invoke
! return callback(*args, **kwargs)
! File "/root/test_environment/lib/python3.4/site-packages/click/decorators.py", line 64, in new_func
! return ctx.invoke(f, obj, *args[1:], **kwargs)
! File "/root/test_environment/lib/python3.4/site-packages/click/core.py", line 535, in invoke
! return callback(*args, **kwargs)
! File "/root/test_environment/lib/python3.4/site-packages/mirobo/cli.py", line 51, in status
! res = vac.status()
! File "/root/test_environment/lib/python3.4/site-packages/mirobo/vacuum.py", line 106, in status
! return VacuumStatus(self.send("get_status")[0])
! File "/root/test_environment/lib/python3.4/site-packages/mirobo/vacuum.py", line 79, in send
! data, addr = s.recvfrom(1024)
! socket.timeout: timed out
! (test_environment) root@raspberrypi:~#</module>Fazit: es klappt leider nicht. Hinweis: nach der Installation habe ich einmal bewußt nur mirobo eingegeben, um zu testen. Dann fordert mirobo ja die ip und den token an. Di habe ich danach mit Export eingegeben. Die ip ist richtig. das zeigt die Antwort auf Discover:
` > (test_environment) root@raspberrypi:~# mirobo discover
INFO:mirobo.vacuum:Sending discovery packet to broadcast address..
WARNING:mirobo.protocol:Unable to decrypt, returning raw bytes.
INFO:mirobo.vacuum: IP 192.168.X.X: 844 - token: b'ffffffffffffffffffffffffffffffff'
WARNING:mirobo.vacuum:error while reading discover results: timed out
(test_environment) root@raspberrypi:~# `
Etwas irritiert bin ich über den timeout. Denn mit der regulären IOS App komme ich drauf und sehe die Daten.
Es ist doch zu dumm, daß ich Dein Programm hier nicht ans Laufen bekomme. Hast Du noch eine Idee?
lg
Bernd
-
@gst666 wenn du noch Hilfe brauchst, sag bescheid… `
Zur Zeit nicht. Zum aktuellen Stand: Habe die Bibliothek in den Adapter von Bluefox integriert. Auch das Admin Interface habe ich angepasst. Zum Wochenende werde ich die Dateien wohl hochladen. Der Adapter wird keine weitergehende Funktionalität haben.Wofür ist eigentlich die Find-Funktion?
-
Bei der Implemetierung ist mir aufgefallen, dass die Werte für den Lüfter-Level offensichtlich nicht die Level 1-3 darstellen. Ich vermute, dass stattdessen an den Roboter ein Wert in Prozent gesendet wird.
Vielleicht könnte jemand mal mit xpn die folgenden Kommandos absetzen:
{"id":20,"method":"set_custom_mode","params":[10]} {"id":21,"method":"set_custom_mode","params":[50]} {"id":22,"method":"set_custom_mode","params":[90]}
Die Auswirkung wird man wohl nur während des Saugvorgang erkennen. Schon blöd, wenn man etwas für ein Gerät entwickelt, dass man (noch?) nicht hat.
-
Das muss man erst mal können: ohne das Gerät zu haben, zu entwickeln. Großes Kompliment. Ich stehe als Tester jederzeit gerne zur Verfügung. Als Helfer auch. Sagt, was ich machen soll.
-
Ja als Lüfter ist 0 bis 100 Prozent möglich. Mit der miapp ist jedoch nur bis 70 drin
Gesendet von meinem E5823 mit Tapatalk
-
Vielleicht könnte jemand mal mit xpn die folgenden Kommandos absetzen `
Kannst du mal die portierte Javascript Version von XPN bereit stellen? Ich würde brennend gerne auch mal ein paar Tests machen.