Core: Log error in CORE for adding integration to Broadlink SmartPlug

Created on 19 Sep 2020  ·  19Comments  ·  Source: home-assistant/core

The problem

Since 0.115 - Broadlink SmartPlugs issue log errors -> need to be added via integrations I presume

Attempt 1:

  • I fixed the yaml setup of the smartplugs (had to comment the type & friendly_name to pass configuration check)
  • The integration discovery found the plug but issued log error on the core
  • Switch entity was not created

Attempt 2:

  • Removed yaml config completely, after restart try to add integration manually
  • The device was recognized with the IP i provided for host but another error was issued on core log
  • Switch entity was not created

Environment

  • Home Assistant Core release with the issue: 0.115
  • Last working Home Assistant Core release (if known): 0.114.4
  • Operating environment (OS/Container/Supervised/Core): Hassio (?)
  • Integration causing this issue: Broadlink
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/broadlink/

Problem-relevant configuration.yaml

the yaml used on atemp # 1

  - platform: broadlink
    host: '192.168.1.53'
#!secret spmini_coffeemaker_ip
    mac: 'B4:43:0D:B7:87:03'
#    type:  sp2
#    friendly_name: 'Rancilio Coffee Machine'

on second attempt - relevant yaml removed !

Traceback/Error logs

Attempt 1 (with yaml) -> attempt to add integration following discovery

2020-09-19 10:40:10 ERROR (MainThread) [aiohttp.server] 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 160, in get
    return await super().get(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 92, in get
    result = await self._flow_mgr.async_configure(flow_id)
  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)
TypeError: async_step_auth() takes 1 positional argument but 2 were given

Attempt 2 (without yaml) -> attempt to add integration manually

2020-09-19 10:47:43 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Raid Mosquito for broadlink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_unload
    result = await component.async_unload_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 33, in async_unload_entry
    device = hass.data[DOMAIN].devices.pop(entry.entry_id)
KeyError: 'a2a7322ef9a911eabb428bfd13855d45'
2020-09-19 10:50:21 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Mosquito Switch 1 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 24, in get_update_manager
    if device.api.model.startswith("RM mini"):
AttributeError: 'NoneType' object has no attribute 'startswith'

Additional information

The device I am trying to add was previously identified as SP2 smart plug in yaml config that worked on 0.114.4 and previously

My router identifies the device as "BroadLink_SPmini-T1-d9-38-dc " incase it helps... - this is definitely NOT and RF/IR type RM of some sort - I have one of those and it was discovered and working properly)

broadlink

All 19 comments

I need your device type (represented in hex) so I can add it to the library. https://github.com/home-assistant/core/issues/40191#issuecomment-694532131 What is the output?

broadlink documentation
broadlink source
(message by IssueLinks)

Hey there @danielhiversen, 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)

I have 1 of this '0x2733' and 3 of these '0x7539'
I think the first one was discovered, the others were not

@felipediel

@Amir974 Thank you! Do you see the 0x7539 in any of the official Broadlink apps (e-Control, IHC, Broadlink)? I need to add the model and manufacturer to this dictionary, but I was unable to extract this information from Broadlink apps. So what is the official app you should use for these devices? Could you provide a link to the device?

I already opened a PR to support your 0x2733. Sorry for the inconvenience. These changes were necessary to implement device discovery. Things will get better soon.

I am currently using "e Smart Home" but I think others might work (or have worked for me before).
for what it's worth the plugs used to be Identified as SP2

Here is a short thread I once had with @Danielhiversen on this very subject

The code has changed a lot since I last looked at it a few years back - but it was stable for so long...
hope you can get it back to stability soon!

let me know if you need anything else @felipediel

P.S

these plugs used to be sold under the brand name "Smart Grade" which also has an app under the same name, but they were essentially broadlink tech with a sticker brand on top.

There might be other such plugs out there, which is why it's important to keep back ward compatibility I guess!

Everything will be back to normal, don't worry. We just need to add your type to the library. I will put the manufacturer as Broadlink (OEM). I still need to know the exact model (so that we can keep track of supported features and segregate interfaces in the future).

The link you gave me states SP mini 2. I googled this model and didn't find anything about it. Could you please provide me a link to the exact picture? Is this your device? Does it have power meter? What about night light?

This is my devic Link

(This is a local Israeli brand I guess)

No power meter.

Some light comes up when the switch is on, but not as much as some other models I saw...

@Amir974 Thanks for helping me improve this. Your device is an OEM Broadlink SP2. It will be automatically discovered in the future.

Will this be added as a patch to 115 @felipediel ?
Otherwise, can I add it via custom components somehow?

@felipediel “merged” meaning available if I now upgrade to lates home-assistant release by any chance?

No. You need to wait for the release. Sorry.

If you are rushing I can help you to workaround. Open a terminal and connect to your device via SSH.

ssh USERNAME@HOST
docker exec -it homeassistant /bin/bash
cd /usr/local/lib/python3.8/site-packages/broadlink

Now you are in the python-broadlink library folder. You can manually add your type to the file __init__.py. Just make sure to backup your config first.

Hi, still getting Unsupported device: 0x7539 on Home Assistant 0.115.3
Does this update contain the fix for 0x7539 (BroadLink_SPmini-T1)?
Thanks

The new version of the library has not been released yet, you need to wait.

Thanks!

Fixed, you can safely update to HA 0.116.

Fixed, you can safely update to HA 0.116.

I've updated and it's working very well!
Thanks again!

Was this page helpful?
0 / 5 - 0 ratings