home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.13k stars 29.8k forks source link

Could not connect Broadlink RM in homeassistant recent release (0.67/0.68/0.68.1) #14310

Closed befantasy closed 5 years ago

befantasy commented 6 years ago

Home Assistant release with the issue:

0.68.1 0.68

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

Ubuntu 16.04 LTS python3.6.5 //ppa:jonathonf/python-3.6 python-venv pip 10.0.1

Component/platform:

Package Version


aiohttp 3.1.3 aiohttp-cors 0.7.0 astral 1.6 async-timeout 2.0.1 attrs 17.4.0 boto3 1.7.14 botocore 1.10.14 broadlink 0.9 certifi 2018.4.16 chardet 3.0.4 distro 1.2.0 docutils 0.14 ecdsa 0.13 envs 1.2.4 future 0.16.0 gTTS-token 1.1.1 home-assistant-frontend 20180426.0 homeassistant 0.68.1 idna 2.6 idna-ssl 1.0.1 Jinja2 2.10 jmespath 0.9.3 MarkupSafe 1.0 multidict 4.2.0 mutagen 1.40.0 netdisco 1.3.1 netifaces 0.10.7 pip 10.0.1 PyCRC 1.21 pycryptodome 3.4.11 python-dateutil 2.7.2 python-jose-cryptodome 1.3.2 pytz 2018.4 PyYAML 3.12 requests 2.18.4 s3transfer 0.1.13 setuptools 39.1.0 six 1.11.0 SQLAlchemy 1.2.6 typing 3.6.4 ua-parser 0.8.0 urllib3 1.22 user-agents 1.1.0 voluptuous 0.11.1 voluptuous-serialize 1.0.0 warrant 0.6.1 wheel 0.31.0 xmltodict 0.11.0 yahooweather 0.10 yarl 1.2.3 zeroconf 0.20.0

Description of problem: Could not connect to boradlink RM.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 34.811667
  longitude: 113.516111
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 110
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Asia/Shanghai
  # Customization file
  customize: !include customize.yaml
  packages: !include_dir_named packages
# Show links to resources in log and frontend
#introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

http:
  # Secrets are defined in the file secrets.yaml
    api_password: !secret http_password
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  # base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:
  enable:
    - homekit
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
weather:
  - platform: yweather
    name: yweather
    woid: 2172736
sensor:
  - platform: yweather
    name: yweather
    woeid: 2172736
    monitored_conditions:
      - weather
      - weather_current
      - temp_min
      - temp_max
      - wind_speed
#      - humidity
      - temperature
  - platform: broadlink
    update_interval: 60
    host: 192.168.1.10
    mac: '00:19:94:36:2b:28'
    monitored_conditions:
      - temperature

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

switch:
  - platform: broadlink
    timeout: 10
    host: 192.168.1.10
    mac: '00:19:94:36:2b:28'
    switches:
      # Will work on most Phillips TVs:
      # Will work on most LG TVs
      tv_letv: 
        friendly_name: "TV Power"
        command_on: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAA1AAAAAAAAAAAAAA='
        command_off: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAA1AAAAAAAAAAAAAA='
      light_livingroom:
        friendly_name: "Living light"
        command_on: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA='
        command_off: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA='
      aroma:
        friendly_name: "Aroma Power"
        command_on: 'JgBYAAABIJISExETETcSEhISEhQQFBETETcROBESEjcRNhM1EjcTNRMTERISNxEUERMSExE2EjYSNhM2EhIROBE3ETcREhITEgAFGwABH0oSAAwzAAEfShEADQU='
        command_off: 'JgBYAAABIJISExETETcSEhISEhQQFBETETcROBESEjcRNhM1EjcTNRMTERISNxEUERMSExE2EjYSNhM2EhIROBE3ETcREhITEgAFGwABH0oSAAwzAAEfShEADQU='

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

Traceback (if applicable):

2018-05-06 15:44:49 WARNING (MainThread) [homeassistant.components.switch] Setup of platform broadlink is taking over 10 seconds.
2018-05-06 15:44:49 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1525592689.0729272, level=WARNING, message=Setup of platform broadlink is taking over 10 seconds., exception=, source=bootstrap.py>
2018-05-06 15:44:49 ERROR (SyncWorker_1) [homeassistant.components.switch.broadlink] Failed to connect to device

Additional information:

It seems that there is a dependence problem in recent releases. I tried several times with totally clean installation in venv environment for 0.68.1/0.68/0.67. "python-jose-cryptodome" 1.3.2 require "pycryptodome<3.4.0,>=3.3.1", but after I downgrade the "pycryptodome" to 3.3.1 I got the other notice: several components require "pycrytodome==3.4.11"...

(homeassistant) homeassistant@localhost:/root$ pip install -U broadlink Requirement already up-to-date: broadlink in /srv/homeassistant/lib/python3.6/site-packages (0.9) Requirement not upgraded as not directly required: PyCRC in /srv/homeassistant/lib/python3.6/site-packages (from broadlink) (1.21) Requirement not upgraded as not directly required: pycryptodome==3.4.11 in /srv/homeassistant/lib/python3.6/site-packages (from broadlink) (3.4.11) python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 3.4.11 which is incompatible.

befantasy commented 6 years ago

oh, sorry. forgot a very important information. the ubuntu was deploy in a ARM based android TV box by using linux deploy 2.07.

VDRainer commented 6 years ago

Not sure, but i think the python from ppa is the problem. https://community.home-assistant.io/t/warning-ubuntu-16-04-python3-6-from-ppa/52436?u=vdrainer

befantasy commented 6 years ago

@VDRainer Thanks for your help. I searched and saw your post in homeassistant forum before. It's a very useful reminder. so I didn't run apt-get update & upgrade in the host environment. And I think the problem you mentioned is the host python environment changed led to the virtual environment broke down. In my case, the python virtual environment is ok so is pip.

nirkons commented 6 years ago

I solved the issue above by updating broadlink separately (pip3 install --upgrade broadlink), that updates pycryptodome as well and that error disappears.

but its still not working (this is on 0.68.1), I upgraded from 0.66.x which worked fine.. please help

2018-05-09 20:23:22 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\helpers\entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\asyncio\tasks.py", line 406, in wait_for
    return fut.result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\asyncio\futures.py", line 294, in result
    raise self._exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\switch\broadlink.py", line 168, in setup_platform
    broadlink_device = broadlink.mp1((ip_addr, 80), mac_addr, None)
TypeError: __init__() takes 3 positional arguments but 4 were given

2018-05-09 20:23:23 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\helpers\entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\asyncio\tasks.py", line 406, in wait_for
    return fut.result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\asyncio\futures.py", line 294, in result
    raise self._exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\switch\broadlink.py", line 143, in setup_platform
    broadlink_device = broadlink.rm((ip_addr, 80), mac_addr, None)
TypeError: __init__() takes 3 positional arguments but 4 were given

example of my mp1 config which is now failing:

  - platform: broadlink
    host: 192.168.0.110
    mac: '00:11:22:33:44:55'
    type: mp1
    friendly_name: 'MP1'
    slots:
      # friendly name of slots - optional
      # if not set, slot name will be switch's friendly_name + 'slot {slot_index}'. e.g 'MP1 slot 1'
      slot_1: 'a'
      slot_2: 'b'
      slot_3: 'c'
      slot_4: 'd'
MACscr commented 6 years ago

How do hassio users solve the issue though. No pip available.

effelle commented 6 years ago

@MACscr: yes you can solve it. Just install the ssh addon and you're good to go.

MACscr commented 6 years ago

Nope. Those packages are available in hassio.

On Aug 9, 2018, at 8:09 PM, effelle notifications@github.com wrote:

@MACscr: yes you can solve it. Just install the ssh addon and you're good to go.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

effelle commented 6 years ago

@MACscr, I'm a bit confused. your wrote "how do hassio user solve the issue [...]", then seems your are not on hassio. To see if I can help you would you gently tel me what hass you've installed?

MACscr commented 6 years ago

Sorry, I meant are not available on hassio. The packages needed to compile the third party fixes, etc.

On Aug 10, 2018, at 6:12 AM, effelle notifications@github.com wrote:

@MACscr, I'm a bit confused. your wrote "how do hassio user solve the issue [...]", then seems your are not on hassio. To see if I can help you would you gently what hass you've installed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

effelle commented 6 years ago

Understood @MACscr. Depending on what install you've done could be an alternative solution. Yuo've installed on a Pi using the image? Pure Docker? Curl and Hypervisor?

MACscr commented 6 years ago

Stock hassio install on an sd card and used within a Pi. Nothing fancy. I went with hassio as I wanted something officially supported and no hacks and workarounds that some other flavors might required or could be blamed on the OS, etc. In this case, the components came from the home-assistant team.

On Aug 10, 2018, at 6:12 AM, effelle notifications@github.com wrote:

@MACscr https://github.com/MACscr, I'm a bit confused. your wrote "how do hassio user solve the issue [...]", then seems your are not on hassio. To see if I can help you would you gently what hass you've installed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/14310#issuecomment-412064090, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVwECqB2JsbUcWPqFErtqFblEcHfVL0ks5uPXixgaJpZM4Tz7zA.

effelle commented 6 years ago

@MACscr, as far as I remember (I'm not using a Pi anymore) hassio is using python 3.x on stock SD image, then you should be able to install pip3... If you haven't already tried open a terminal and install it with

sudo apt-get update && sudo apt-get install python3-pip

Please be advice there are some issues with the newest version of broadlink package on docker version starting from 0.74 that could be affecting your install too. I filled a bug report here (with the solution too). There a second solution: give some time for the dev team, since there is a pull request opened after my report to update the offending packages.

MACscr commented 6 years ago

They use a custom os. Apt isn’t available

On Aug 11, 2018, at 6:32 AM, effelle notifications@github.com wrote:

@MACscr, as far as I remember (I'm not using a Pi anymore) hassio is using python 3.x on stock SD image, then you should be able to install pip3... If you haven't already tried open a terminal and install it with

sudo apt-get update && sudo apt-get install python3-pip

Please be advice there are some issues with the newest version of broadlink package on docker version starting from 0.74 that could be affecting your install too. I filled a bug report here (with the solution too). There a second solution: give some time for the dev team, since there is a pull request opened after my report to update the offending packages.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

effelle commented 6 years ago

I'm curious Mark, since I'm not on Pi but probably I'll buy one just for hass... Is there the tab of hassio addons like on docker version? hassio If yes, there is the terminal with all the commands you need. term Again, I'm just curious!

balloobbot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

balloobbot commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍