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.17k stars 29.85k forks source link

broadlink integration stop work after 2021.4 #48955

Closed erreesse closed 3 years ago

erreesse commented 3 years ago

The problem

i have some broadlink device, rmPro. rm4pro, rm4mini, A1 that worked perfectly from years, after the last update, did not work anymore....

Logger: homeassistant.config_entries Source: components/broadlink/device.py:70 First occurred: 19:11:28 (8 occurrences) Last logged: 19:11:28

Error setting up entry eRemote2 for broadlink Error setting up entry rm4pro for broadlink Error setting up entry rm4mini for broadlink Error setting up entry rm4pro-2 for broadlink Error setting up entry rm4pro-3 for broadlink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/usr/src/homeassistant/homeassistant/components/broadlink/init.py", line 25, in async_setup_entry return await device.async_setup() File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup api = blk.gendevice( TypeError: gendevice() got an unexpected keyword argument 'name'

What is version of Home Assistant Core has the issue?

2021.4

What was the last working version of Home Assistant Core?

2021.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

broadlink

Link to integration documentation on our website

https://www.home-assistant.io/integrations/broadlink/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry PT e-Sensor for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry P1 e-Sensor for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry eRemote1 for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry eRemote2 for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry rm4pro for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry rm4mini for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry rm4pro-2 for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
2021-04-09 19:11:28 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry rm4pro-3 for broadlink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 249, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 25, in async_setup_entry
return await device.async_setup()
File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 70, in async_setup
api = blk.gendevice(
TypeError: gendevice() got an unexpected keyword argument 'name'
probot-home-assistant[bot] commented 3 years ago

broadlink documentation broadlink source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @danielhiversen, @felipediel, mind taking a look at this issue as its been labeled with an integration (broadlink) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

felipediel commented 3 years ago

Hi @erreesse. Something is forcing an older version of the broadlink module on your system. Are you using custom components like Floureon? If so, you need to update them as well.

erreesse commented 3 years ago

Thanks @felipediel , i had no Floureon, something else to looking for ?

erreesse commented 3 years ago

Logger: homeassistant.setup Source: setup.py:162 First occurred: 21:48:45 (1 occurrences) Last logged: 21:48:45

Setup failed for broadlink: Unable to import component: No module named 'broadlink.exceptions'

felipediel commented 3 years ago

Which custom components do you have?

erreesse commented 3 years ago

image

felipediel commented 3 years ago

The problem is broadlink_s1c. You need to find a maintained version of this component or update the manifest.json manually (remove broadlink from the requirements).

erreesse commented 3 years ago

{ "domain": "broadlink_s1c", "name": "Broadlink s1c and s2c", "documentation": "https://github.com/nick2525/broadlink_s1c_s2c", "issue_tracker": "https://github.com/nick2525/broadlink_s1c_s2c/issues", "requirements": [], "dependencies": [ "http" ], "codeowners": [ "@nick2525" ], "version": "1.0.0" }

felipediel commented 3 years ago

It looks clean. Any other custom components for Broadlink devices?

erreesse commented 3 years ago

i had to search for "broadlink" in all the manifest.json file ? sorry for dumb question, but i'm not a developer !

felipediel commented 3 years ago

Yes. Check the broadlink custom component. If you have outdated requirements in the manifest, you need to remove them.

erreesse commented 3 years ago

i found this on sensor.py of broadlink_S1c

"""Home Assistant Custom Component, Broadlink S1C sensor entity.

.. codeauthor:: Tomer Figenblat tomer.figenblat@gmail.com

Example: .. code-block:: yaml

    sensor:
      - platform: broadlink_s1c
        ip_address: "192.168.0.102"
        mac: "AB:C1:D2:EF:GH:34"
        timeout: 20

"""

fmt: off

import asyncio import binascii import datetime import logging import socket import threading import traceback from typing import Callable, Dict, Generator, Optional

import homeassistant.helpers.config_validation as cv import voluptuous as vol from broadlink import S1C from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import (CONF_IP_ADDRESS, CONF_MAC, CONF_TIMEOUT, EVENT_HOMEASSISTANT_STOP, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_CLOSED, STATE_OPEN, STATE_UNKNOWN) from homeassistant.core import Event, HomeAssistant from homeassistant.helpers.entity import Entity from homeassistant.util.dt import now

felipediel commented 3 years ago

broadlink_s1c looks ok. What do you have inside the broadlink folder? Check the manifest.json there. It is usually not a good idea to replace official components, the custom code can easily break with the updates.

nick2525 commented 3 years ago

@felipediel Hi, After updating to HA 2021.4.0, you changed the broadlink library version from version 16 to 17, which broke the broadlink_s1c integration. I know, what I can't require version 16, to be compatible with your devices, so I copied your broadlink version here
https://github.com/nick2525/broadlink_s1c_s2c/tree/master/custom_components/broadlink_s1c_s2c It is very strange that the main integration of brodlink stopped working, since I have a lot of devices and everything works. Also works for guys from the forum. Maybe the reason is something else? https://community.home-assistant.io/t/broadlink-s1c-alarm-kit-custom-sensor-component/45980/188 here broadlink_s1c_s2c works with new version of HA 2021.4.0 with copied your https://github.com/mjg59/python-broadlink/tree/0.16.0

erreesse commented 3 years ago

@felipediel : the broadlink folder , under "custom component", is there from years, before broadlink became integrated on homeassistant. there is no manifest.json inside. i alredy try to delete that folder , restart, but not working.

i try to restore a previous system snapshot. i use broadlink to control home heater, and now is too cold inside home!!!

@nick2525 i had s1c and i miss the "door sensor" after i upgraded to "broadlink_s1c_s2c" . to works as before (with door sensor) i had to create sensor folder , under custom component, and put ther sensor.py. hope this can be usefull.

p.s. sorry for my bad english!!

felipediel commented 3 years ago

Hi @nick2525. Perfect timing. I was texting you at the community to help adapt the broadlink_s1c component to v0.17.0. If you want a clean fix you can replace None with 0x2714 here:

self._hub = S1C((ip_addr, 80), mac_addr, 0x2714)

Sorry for the inconvenience, we no longer accept None because new devices only work if the correct type is informed.

nick2525 commented 3 years ago

@felipediel thanks a lot, I will try it, and remove your files if it works.

felipediel commented 3 years ago

You're welcome!

felipediel commented 3 years ago

@erreesse What do you have inside the programmable_thermostat folder? Check the manifest.json there. If you don't find anything, you need to disable your custom components for Broadlink devices one by one to find out which one is causing the issue.

erreesse commented 3 years ago

{ "domain": "programmable_thermostat", "name": "Programmable Thermostat", "documentation": "https://github.com/custom-components/climate.programmable_thermostat", "dependencies": [ "sensor", "switch" ], "codeowners": [], "requirements": [], "config_flow": true, "version": "8.1" }

i restore all to "core-2021.3.4" and all works fine.

how i can disable custom component?? delete the folder under "custom component" is enough?

felipediel commented 3 years ago

You have to delete the folder and restart, but you don't have to do it if the manifest is ok, except the broadlink folder. You should start by deleting this folder.

erreesse commented 3 years ago

ok. i did it before, but don't resolve the problem.

for now i stay with 2021.3.4, when i will have the time, i try a fresh install of home assistant... but it take days to install an configure all the integration and automation.

felipediel commented 3 years ago

You don't need a fresh install. Simply remove the custom components for Broadlink devices, then add them one by one to figure out which one is causing the issue. You can also try to force the latest version of the broadlink module:

  1. Open Home Assistant and install "SSH & Web Terminal" add-on
  2. Disable Protection mode
  3. Click "Terminal" on the sidebar and install v0.17.0:
    docker exec -it homeassistant /bin/bash
    pip3 install broadlink==0.17.0
  4. Restart Home Assistant.
erreesse commented 3 years ago

good morning felipediel, i had clean my HA from redundant folder/custom component. one by one, verified that all my sensor and device working.

then i upgraded to latest version of ha, all works fine! thanks for your help. regards

felipediel commented 3 years ago

Thanks for reporting back and closing the issue!