Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadlink broken after 0.64.0 #12682

Closed
dvd77 opened this issue Feb 26, 2018 · 15 comments
Closed

Broadlink broken after 0.64.0 #12682

dvd77 opened this issue Feb 26, 2018 · 15 comments

Comments

@dvd77
Copy link

dvd77 commented Feb 26, 2018

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.64.0

Python release (python3 --version):
3.6

/platform:
Broadlink

Description of problem:

Error while setting up platform broadlink
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 5, in <module>
    from Crypto.Cipher import AES
  File "/usr/local/lib/python3.6/site-packages/Crypto/Cipher/__init__.py", line 3, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "/usr/local/lib/python3.6/site-packages/Crypto/Cipher/_mode_ecb.py", line 29, in <module>
    from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
  File "/usr/local/lib/python3.6/site-packages/Crypto/Util/_raw_api.py", line 32, in <module>
    from Crypto.Util.py3compat import byte_string
ImportError: cannot import name 'byte_string'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 84, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 74, in setup_platform
    import broadlink
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 7, in <module>
    import pyaes
ModuleNotFoundError: No module named 'pyaes'

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

- platform: broadlink
  host: !secret broadlink_ip
  mac: '!secret broadlink_mac'
  switches:
    ziggomediabox:
      friendly_name: 'Ziggo Media Box'
      command_on: 'JgBQAJaYEg8TDRAREQ8TLxAzEBESDhMNEDMSDhMvEBERMhIOEBAQmBIPDzMQEBMwEw0QEREPEw0TDhAQEjETDRARETETDRAREDMSMBMvEDMSAA0FAAAAAAAAAAA='
      command_off: 'JgBQAJaYEg8TDRAREQ8TLxAzEBESDhMNEDMSDhMvEBERMhIOEBAQmBIPDzMQEBMwEw0QEREPEw0TDhAQEjETDRARETETDRAREDMSMBMvEDMSAA0FAAAAAAAAAAA='

@thijsdejong
Copy link
Contributor

@insertjokehere
Copy link
Contributor

This looks pretty similar to #2411, if I run the import in a shell I get:

>>> from Crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/Crypto/Cipher/__init__.py", line 3, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "/usr/local/lib/python3.6/site-packages/Crypto/Cipher/_mode_ecb.py", line 29, in <module>
    from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
  File "/usr/local/lib/python3.6/site-packages/Crypto/Util/_raw_api.py", line 32, in <module>
    from Crypto.Util.py3compat import byte_string
ImportError: cannot import name 'byte_string'

Doing

pip3 uninstall pycrypto
pip3 uninstall pycryptodome
pip3 install pycryptodome

Lets me import the broadlink module without error

@hiol83
Copy link

hiol83 commented Feb 26, 2018

Same problem for me.
Where is it possibile to send these commands with Hass.io ?

pip3 uninstall pycrypto pip3 uninstall pycryptodome pip3 install pycryptodome

if i try it with putty i have this answer:

-bash: pip3: command not found

@kvjajoo
Copy link

kvjajoo commented Feb 26, 2018

After uninstalling pycrpto and pycryptodome when i execute "pip3 install pycryptodome" i get below error.

unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pi p-build-k9mr5eah/pycryptodome/setup.py';f=getattr(tokenize, 'open', open)(__file __);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, ' exec'))" install --record /tmp/pip-w13a6v3k-record/install-record.txt --single-v ersion-externally-managed --compile" failed with error code 1 in /tmp/pip-build- k9mr5eah/pycryptodome/

Looks like there is no gcc on hass.io. How do i install gcc on hass.io. I am running hass.io as a docker container on generic ubuntu x86 machine.

@ahknight
Copy link

FWIW, the ZHA module has the same issue using the docker build of HASS. I suspect the docker layer that includes the dependancies was not re-run for this release and/or there's an outdated version requirement in the code.

@Meganoodle71
Copy link

Same issue with my setup. I guess it will be fixed on the next update if not a workaround will be published.

@orens
Copy link

orens commented Feb 26, 2018

Is there a workaround for docker installations? I use homeassistant/home-assistant (as most docker installations, I think)

@dvd77
Copy link
Author

dvd77 commented Feb 26, 2018

I am on docker 2 .. think we have to wait for a fix ont his one. 0.64.1 is coming this evening as I understood

@roblandry
Copy link
Contributor

@orens, @dvd77 see this for docker until a code fix is released.

@orens
Copy link

orens commented Feb 27, 2018

Thanks much, @roblandry! Workaround working for me.

@kvjajoo
Copy link

kvjajoo commented Feb 27, 2018

@roblandry and @balloob ! can you help ..

After uninstalling pycrpto and pycryptodome when i execute "pip3 install pycryptodome" i get below error.

unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1


Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pi p-build-k9mr5eah/pycryptodome/setup.py';f=getattr(tokenize, 'open', open)(__file __);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, ' exec'))" install --record /tmp/pip-w13a6v3k-record/install-record.txt --single-v ersion-externally-managed --compile" failed with error code 1 in /tmp/pip-build- k9mr5eah/pycryptodome/

Looks like there is no gcc on hass.io. How do i install gcc on hass.io. I am running hass.io as a docker container on generic ubuntu x86 machine.

@kvjajoo
Copy link

kvjajoo commented Feb 27, 2018

I got it ..

Install gcc by following commands

apk update
apk fetch build-base
apk add build-base

after this i was able to reinstall pycryptodome

@dvd77
Copy link
Author

dvd77 commented Feb 28, 2018

still not working for me... still same error and no result with the fix from @roblandry

my error:

Wed Feb 28 2018 11:46:08 GMT+0100 (CET)

Error while setting up platform broadlink
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 84, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 82, in setup_platform
config.get(CONF_MAC).encode().replace(b':', b''))
binascii.Error: Odd-length string

**_**EDIT:: WORKING!!!

Had to remove the ':' in the mac address !_

@hiol83
Copy link

hiol83 commented Feb 28, 2018

I know that this is not the best solution, but a downgrade helped me

curl -d '{"version": "0.63.1"}' http://hassio/homeassistant/update

@v0ltage120
Copy link

Hello I had the same prob and here is how I fixed it on my Hass.io docker install on Ubuntu 👍

  1. Get into the docker instance with : sudo docker exec -i -t homeassistant /bin/bash
  2. update apk to get gcc with what kvjajoo said :
apk update
apk fetch build-base
apk add build-base
  1. Remove and reinstall pycrypto with :
pip3 uninstall pycrypto
pip3 uninstall pycryptodome
pip3 install pycryptodome
  1. restart your Homeassistant and got my broadlink back

@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants