Closed Heukers closed 3 years ago
Recently I switched to a new Docker-image https://hub.docker.com/r/domoticz/domoticz I came across the same errors during my PyCrypto quest. While ignoring the error, I added a symlink to the plugin directory with the following:
$ cd /path-to-domoticz/domoticz/plugins/Domoticz-Brel-Plugin
$ ln -s //usr/local/lib/python3.7/dist-packages/Crypto
Domoticz runs its own embedded Python, therefor it worked regarding the error.
A second option for you would be to use the example script https://github.com/superjunky/Domoticz-Brel-Plugin/blob/main/docs/examples/brel.py
You could run it in your dzVents automation:
dz.executeShellCommand( 'python /opt/domoticz/userdata/scripts/python/brel.py -p 80 -a 80' )
Perhaps pycryptodome
is a solution. It's a fork of PyCrypto and supports 'wheel' so they say. I recall errors related to 'wheel' so it's worth a try.
Perhaps
pycryptodome
is a solution. It's a fork of PyCrypto and supports 'wheel' so they say. I recall errors related to 'wheel' so it's worth a try.
pycryptodome installation works! i made the link to pycryptodome in the brel-plugin directory. the plugin starts according to the logs.... the devices do not load because the accestoken cannot be generated according to the log in domoticz.
2021-06-29 17:55:55.644 Status: (Brel Hub) Entering work loop. 2021-06-29 17:55:55.644 Status: (Brel Hub) Initialized version 1.0.0, author 'Superjunky' 2021-06-29 17:55:55.912 Status: (Brel Hub) Brel module successfully initialized! 2021-06-29 17:55:55.912 Error: (Brel Hub) AccessToken could not be generated.
That's probably because of pycryptodome.
The plugin imports module from Crypto.Cipher import AES
and uses AES.new(key, AES.MODE_ECB)
to generate the access token. I bet those lines have to be altered. I'm occupied atm, but feel free to add a PR ;)
On line 95 you could try replace encrypt
with encrypt_and_digest
. Make sure to restart the plugin for changes to be active.
_Recently I switched to a new Docker-image https://hub.docker.com/r/domoticz/domoticz I came across the same errors during my PyCrypto quest. While ignoring the error, I added a symlink to the plugin directory with the following:
$ cd /path-to-domoticz/domoticz/plugins/Domoticz-Brel-Plugin $ ln -s //usr/local/lib/python3.7/dist-packages/Crypto Domoticz runs its own embedded Python, therefor it worked regarding the error.__
This is the solution for the problem!!
find the file Crypto with find / -iname "filename"
then make the link in the directory of the brel plugin...
and voila!! it works!
Now play with and put it in homebridge.... but that is a job for tomorrow...
THANKS SUPERJUNKY
Cool! Nice you reported back. Great to finally see them move right ;)
I followed your tip and i have a newer version of domoticz running in a docker on my synology nas.... But now i can not find the domoticz plugin directory throug a putty login and the terminal (here i can find the plugin directory) in the docker terminal does not allow things like (sudo) git.... can you point me in the rigth direction on how to install your plugin in the domoticz docker?
I think you are lacking some essential info when it comes to Docker. You need to mount some directories, which you can then find on your NAS (outside of the Docker-image). See screenshot.
The plugin dir has to be recreated as I recall for the Domoticz-image. You will have to check at the Domoticz forum. There is a topic for the official domoticz Docker image.
Thnx for the direction! But i give up....
Followed every clue and have non left.... The pycrypto will not install... but the options linking to Crypto including your option does not work.... the hub starts but seems to stop.... after starting from scratch three times i give it a rest.....
Just wanted to let you now that after installing wheel in the docker terminal of domoticz I was able to install pycrypto and got everything working again!! perfect!
I am glad to see someone helping out with a plugin like this. I am trying for months on my own, but don not have the right skills...
I hav a synology 718+ and have installed python3 and upgraded pip3, but i can't get past the installation of PyCrypto. I have added the python-dev tools and added the path to python3 in PATH, but it seems an issue tot "compile" the setup file for PyPython...
Can you help or point me in the right direction?
Building wheel for pycrypto (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/local/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-onmmog9h/pycrypto_b901bbac9acb460fa3093227ec52dadd/setup.py'"'"'; file='"'"'/tmp/pip-install-onmmog9h/pycrypto_b901bbac9acb460fa3093227ec52dadd/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-m4z9dsdi cwd: /tmp/pip-install-onmmog9h/pycrypto_b901bbac9acb460fa3093227ec52dadd/ Complete output (187 lines):