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.14k stars 29.82k forks source link

broadlink integration error #40191

Closed neotrunks closed 3 years ago

neotrunks commented 3 years ago

The problem

I tried to use new integration for my broadlink remote (rm_pro_phicom), it worked with custom components without problems, with new integration it fails and doesn't create new entity.

Environment

Problem-relevant configuration.yaml

Traceback/Error logs

Logger: homeassistant.config_entries
Source: components/broadlink/updater.py:29
First occurred: 20:41:02 (2 occurrences)
Last logged: 20:42:44

Error setting up entry despacho_remote for broadlink
Error setting up entry remote_despacho for broadlink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 228, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 28, in async_setup_entry
    return await device.async_setup()
  File "/usr/src/homeassistant/homeassistant/components/broadlink/device.py", line 97, in async_setup
    update_manager = get_update_manager(self)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/updater.py", line 29, in get_update_manager
    return update_managers[device.api.type](device)
KeyError: 'Unknown'

Additional information

dexterddit commented 3 years ago

Same thing happens with rm_mini3_newblackbean, no entity is created . It`s connect fine to the old rm_mini3 .

rumney909 commented 3 years ago

same issue here rm_mini_3 no entity created this shows in logs. ERROR (MainThread) [homeassistant.components.broadlink.updater] Error fetching device data: The device storage is full

joten75 commented 3 years ago

same here:

Logger: homeassistant.components.broadlink Source: components/broadlink/config_flow.py:100 Integration: Broadlink (documentation, issues) First occurred: 22:59:27 (1 occurrences) Last logged: 22:59:27

Failed to connect to the device at 10.0.0.x: Invalid host for this configuration flow. The MAC address should be xx:xx:xx:xx:xx:xx, but xx:xx:xx:xx:xx:xx was given

and Logger: aiohttp.server Source: components/broadlink/config_flow.py:47 First occurred: 22:57:33 (3 occurrences) Last logged: 23:07:24

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 156, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 204, in _async_handle_step result: Dict = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/broadlink/config_flow.py", line 82, in async_step_user await self.async_set_device(device) File "/usr/src/homeassistant/homeassistant/components/broadlink/config_flow.py", line 47, in async_set_device "model": device.model, AttributeError: 'rm4' object has no attribute 'model'

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

The new Blackbean will be solved with https://github.com/home-assistant/core/pull/39228.

felipediel commented 3 years ago

@neotrunks Please open a terminal on your computer, install the python-broadlink library (pip install broadlink), open Python 3 and type:

import broadlink as blk

devs = blk.discover(timeout=5)
print([(d.host[0], hex(d.devtype)) for d in devs])

devs = blk.discover(discover_ip_address="192.168.0.17", timeout=5)  # Your device IP address
print([(d.host[0], hex(d.devtype)) for d in devs])

What is the output?

felipediel commented 3 years ago

@joten75 Once you choose a device for the configuration flow, you can no longer change it. You need to start a new configuration flow if you want to change it. This is not a bug.

The second error is still obscure to me. Do you have any other clues? What were you doing (step by step) when this error appeared?

felipediel commented 3 years ago

@neotrunks Please consider sending me your device type soon, or we will miss the next release.

duceduc commented 3 years ago

@felipediel These are the devices I have in my HA. RM4 Pro -> 0x6026 RM Mini 3 -> 0x5f36

felipediel commented 3 years ago

0x6026 is working, right?

spiro-c commented 3 years ago

@felipediel i have the same problem this is the output python [('192.168.10.101', '0x649b')] it's RM4Pro

felipediel commented 3 years ago

@spiro-c Thank you! We will support this device soon.

duceduc commented 3 years ago

0x6026 is working, right?

Yes, but not all my ir codes are showing up. Will need to look into that further when I get the chance.

felipediel commented 3 years ago

Ok. Please read the docs first, we changed a lot of things.

duceduc commented 3 years ago

Post retracted. Never mind. Not an accurate list.

neotrunks commented 3 years ago

@neotrunks Please open a terminal on your computer, install the python-broadlink library (pip install broadlink), open Python 3 and type:

import broadlink as blk

devs = blk.discover(timeout=5)
print([(d.host[0], hex(d.devtype)) for d in devs])

devs = blk.discover(discover_ip_address="192.168.0.17", timeout=5)  # Your device IP address
print([(d.host[0], hex(d.devtype)) for d in devs])

What is the output?

[('192.168.0.136', '0x27c3')]

felipediel commented 3 years ago

@neotrunks Thank you! Your device will be supported soon.

joten75 commented 3 years ago

@felipediel i I just tried to add a device broadlink in the ui :click on the plus sign, select broadlink, insert the ip of the broadlink then unkwno error show up and in the log the message . could it be because i have more than one broadlink? Obviously I have deleted all the configuration in the yaml except the switch.

felipediel commented 3 years ago

No. Please send me your device types so I can check.

joten75 commented 3 years ago

type: rm_mini3_newblackbean in the log of the error they show: Failed to connect to the device at 10.0.0.5: Invalid host for this configuration flow. The MAC address should be 56:fd:5a:77:0f:78, but c1:17:d6:a7:df:24 was given the second mac was the rigth one but with inverse order they must be 24:df:a7:d6:17:c1

felipediel commented 3 years ago

@joten75 RM mini 3 new Blackbean (0x5f36) will be supported after this patch.

pavoni commented 3 years ago

Thanks for all this work @felipediel. I think you already have my device in your PR, but I ran your code to get the info to be sure.

[('192.168.1.99', '0x5f36'), ('192.168.1.96', '0x5f36')]

You commented as I was checking!

Thanks!

joten75 commented 3 years ago

thank @felipediel i very appreciate your help. so i wait for the mini 3 but even the rm2 pro dont'work? i've this when try to add to config:

Logger: aiohttp.server Source: components/broadlink/config_flow.py:47 First occurred: 11:54:00 (1 occurrences) Last logged: 11:54:00

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 156, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 204, in _async_handle_step result: Dict = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/broadlink/config_flow.py", line 82, in async_step_user await self.async_set_device(device) File "/usr/src/homeassistant/homeassistant/components/broadlink/config_flow.py", line 47, in async_set_device "model": device.model, AttributeError: 'rm' object has no attribute 'model'

felipediel commented 3 years ago

@joten75 I need to see the types (represented in hex). This is how you get them: https://github.com/home-assistant/core/issues/40191#issuecomment-694532131

Kayden919 commented 3 years ago

@joten75 I need to see the types (represented in hex). This is how you get them: #40191 (comment)

Im using Windows 10, how to do it?

My RM Pro PLUS have error when update to 115 Here, my log image

image

felipediel commented 3 years ago

We made a recent update to implement a configuration flow for these devices.

From now on they will be configured automatically. But for this to happen, the device needs to be here.

You see those hex keys? These are the device types. You need to send me your type. Here is a how to.

How do I find my device type?

  1. Install Python 3
  2. Open a terminal, go to your tests folder, create a venv and install python-broadlink. If you already have python-broadlink installed, you can skip this step.
    python3 -m venv venv
    source venv/bin/activate
    pip3 install broadlink

    Now open Python 3:

    python3

    Then you can try these things to get your type:

    
    import broadlink as blk

Discover devices. If your device is locked, it won't be discovered.

devs = blk.discover(timeout=5) print([(d.host[0], hex(d.devtype)) for d in devs])

Say hello to the device. It will respond even if it is locked.

devs = blk.discover(discover_ip_address="192.168.0.17", timeout=5) # Your device IP address print([(d.host[0], hex(d.devtype)) for d in devs])


If you need more detailed instructions, call [tech support](https://www.google.com/).
felipediel commented 3 years ago

You are being tortured due to the lack of a decent error message that shows the unsupported type. I will improve this soon. I will also consider adding a manual step to the config flow. But for now, please be proactive, if it is not working, please find your type and send me so I can add it to the library and make it compatible with discover() soon.

Things had to get worse before getting better, hope you guys understand.

Haloooch commented 3 years ago

Looks like this has already been added, but here is mine: ('192.168.1.60', '0x279d') Is there a way to manually add the missing device types till they can be included in a future release?

felipediel commented 3 years ago

Yes, but it is hackish, you should not do it. I will implement this for normal people soon.

userMak commented 3 years ago

Ηi, I can not connect my RM 3 mini also. Will there be a fix for them?

Kayden919 commented 3 years ago

We made a recent update to implement a configuration flow for these devices.

From now on they will be configured automatically. But for this to happen, the device needs to be here.

You see those hex keys? They are the device types. You need to send me your type. Here is a how to.

How do I find my device type?

  1. Install Python 3
  2. Open a terminal, go to your tests folder, create a venv and install python-broadlink. If you already have python-broadlink installed, you can skip this step.
python3 -m venv venv
source venv/bin/activate
pip3 install broadlink

Now open Python 3:

python3

Then you can try these things to get your type:

import broadlink as blk

## Discover devices. If your device is locked, it won't be discovered.
devs = blk.discover(timeout=5)
print([(d.host[0], hex(d.devtype)) for d in devs])

## Say hello to the device. It will respond even if it is locked.
devs = blk.discover(discover_ip_address="192.168.0.17", timeout=5)  # Your device IP address
print([(d.host[0], hex(d.devtype)) for d in devs])

If you need more detailed instructions, call tech support.

Can help me detail info? Where is " 2. Open a terminal, go to your tests folder, create a venv and install python-broadlink. If you already have python-broadlink installed, you can skip this step."

How can i go test folder?

felipediel commented 3 years ago

Any folder.

Kayden919 commented 3 years ago

Any folder.

Sorry, but i cant do your guide, can explain me detail? Thank you

felipediel commented 3 years ago

In the next update your device type will appear in the logs.

djhalun commented 3 years ago

Hi, I have RM4 Pro -> 0x6026 when i try to install integration, in my logs show me this: Logger: aiohttp.server Source: components/broadlink/config_flow.py:47 First occurred: 17:55:21 (1 occurrences) Last logged: 17:55:21

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 156, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 204, in _async_handle_step result: Dict = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/broadlink/config_flow.py", line 82, in async_step_user await self.async_set_device(device) File "/usr/src/homeassistant/homeassistant/components/broadlink/config_flow.py", line 47, in async_set_device "model": device.model, AttributeError: 'rm4' object has no attribute 'model'

Do you have some solution for this??

joten75 commented 3 years ago

@joten75 I need to see the types (represented in hex). This is how you get them: #40191 (comment)

RM2 Pro Plus 0x272a;

djhalun commented 3 years ago

RM4 Pro ('192.168.1.228', '0x6026')

dexterddit commented 3 years ago

Here are mine : [('x.x.x.x', '0x5f36')] - rm mini 3 - newbleackbean [('x.x.x.x', '0x2737')] -rm mini 3

rcojr commented 3 years ago

@felipediel I have a Broadlink RM4C Mini, on the earlier version it would only work if it's not connected to the broadlink cloud (that method to connect but not add to a room in broadlink app). I've seen this is not anymore on the Home Assistant Broadlink Integration page.. Does it works when connected to the broadlink app now? Thanks!

MYKSelf commented 3 years ago

@felipediel, Not working for me too. Here my grain of sand:

[('x.x.x.x, '0x279d')] -> RM pro +

IamMikl commented 3 years ago

@felipediel here is mine [('192.168.xx.xx', '0x2712')] - RM Pro [('192.168.xx.xx', '0x2714')] - A1

tottka commented 3 years ago

@felipediel Thank you for your work on this upgrade. All my Ankuoo NEO Switches stopped working, please add to the code. Formerly used SP2 in configuration. Thanks
Ankuoo NEO Pro (shows wattage) 0x2716 Ankuoo NEO (no wattage) 0x2717

Madseason41 commented 3 years ago

I am on 115.1 and cannot connect to a rm mini3 red bean.

Logger: homeassistant.components.broadlink Source: components/broadlink/config_flow.py:100 Integration: Broadlink (documentation, issues) First occurred: 2:22:50 PM (1 occurrences) Last logged: 2:22:50 PM Failed to connect to the device at 192.168.1.110: Device not found

I have 3 old rm mini's and a pro2 that work fine.

joten75 commented 3 years ago

hi, I write just in case it can help someone else with my problem. I have a thermostat fluoreon component based on broadlink, and until I deactivated it too from configuration.yaml the integration via ui failed. So you have to deactivate all components that have a reference to the broadlink, restart, configure via ui and then reactivate the various components. thank a lot for you help @felipediel

nick2525 commented 3 years ago

import broadlink as blk devs = blk.discover(timeout=5) print([(d.host[0], hex(d.devtype)) for d in devs]) [] devs = blk.discover(discover_ip_address="192.168.4.166", timeout=5) print([(d.host[0], hex(d.devtype)) for d in devs]) []

======= I have no devices, but for HA 114.4 they are visible, maybe I need to turn on some descocery protocol on router ?

felipediel commented 3 years ago

@joten75 Thanks for informing about this. We have no control over custom components so these things are really difficult to debug. So was that second error message being caused by this? What is the name of the component?

felipediel commented 3 years ago

@tottka Thank you! What is the official app that should be used to control these devices? Can you discover them with Broadlink app?

tottka commented 3 years ago

I was using the NEO app from the play store until a few weeks ago when they updated the app and they stopped working. Now I am using CHACON again from the play store

danros3 commented 3 years ago

Hi. I'm very happy that you are working hard on this integration because I have many problems regarding Rm4 pro and RF learning command. I'm not a developer so, for me python instructions ar not clear. I put wifi on rm4 pro via broadlink app and setup this on home assistant. For IR code work fine. I have integration with smartIr and also try to learn IR signals from TV and Fujitsu climate remote. That's good and I have file "broadlink_remote_24dfa7e476b7_codes" whit codes. Unfortunatelly, for RF, that's is not possible. I tried to setup a CAME gate remote control via three different remote (two original and one cloned from first) whitout any code learned. How's wrong? Could I ask if you explain step by step the python way (I'm activated the pip package....)

Thank you very much. Daniele