Broadlink Smart Plugs (type: sp2) stopped working since 0.115

Hi there,

I have several Broadlink Smart Plugs (not the software switches connected to RM2) that stopped working after 0.115 (also 0.115.1)

I figured with the new integration, since they were not discovered I’d add them manually (after removing the yaml config that no longer worked).

I input the IP for host - and while they seem to be identified, after restart they don’t show up and I get the following log message:

2020-09-18 23:51:11 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Rancilio Coffee Machine 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'

Am I missing something / Is this an issue with the new integration ?

Additional information that might help:

Looking at CORE logs, after trying to add integration to the Broadlink SmartPlug I see the following:

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

Am I missing something / Is this an issue with the new integration ?

Maybe. If you look at Broadlink Integration page, scroll to switch. It says any sensors, plugs will be automatically discover.

The switch entities allow you to control and monitor Broadlink smart plugs, power strips and switches.
You can turn them on and off, and you can monitor their state and power consumption, when available.
These entities are created automatically when you configure a device that has switches.

I suspect your device type (code) isn’t support yet. They are gathering a list of device types and will add them to the next update. There is another poster in another thread has the sp3 plug and he fixed it by going through the configure setup and HA auto detect the plug.

Thank you @duceduc,

I’ve looked very carefully at the documentation and the thread you mentioned (as well as the original PR that introduced the latest change).

Broadlink documentation is a bit confusing since a Switch can be created either as a software configuration (for corresponding actions with one of the RF/IR RM type units) or for smart plugs which got almost not reference in the last release documentation.

My smartplugs were working perfectly until 0.114.4 and have been for a very long time…

After 0.115.0, the entities disappeared and the configuration check indicated some of the previously used attributes (type & friendly_name) were no longer supported and should be removed.

After removing them, the plugs were “discovered” automatically but core log shows error and entities are not created (the log sample from my second post on this thread)

I’ve also attempted removing the yaml completely which required a manual integration action that seemed to identify the smart plugs but lead to another log error (the one on the first post I made on this thread)

bottom line, entities that used to work (identified as type SP2) are no longer showing up - but I don’t think the latest release intended to remove their support. So I may be missing something or it could be a bug…

Hoping to get some answers here OR on the issue I opened on this issue link

Try to delete old entries. Remove all broadlink configuration from yaml. Restart HA and add integrations from ui.

I just fixed this issue, by deleting broadlink configuration from yaml and adding Broadlink manuelly with correct IP address of SP mini, which is not discovered automaticly in current HA release.

Try using the following hardware template: (its from my config, then all socket was add w\o problem )

  - platform: broadlink
    host: 192.168.31.22
    mac: B4:43:0D:CB:F5:18
    switches:
      - name: 'Plant Plug'

Or you can add manually from + sign in Home assistant integrations, then select broadlink, and enter its ip address.

Thanks for all the answers, but my problem is actually with a recent change in the code that caused ,y and many other Broadlink devices to lose compatibility with home-assistant :frowning:

A fix is on the way though, so if you are in the same boat as I, don’t lose hope…

What equipment do you mean? SC1 and SP2 work for me. This code for SP2 Socket, could you try it

Updatind code

  - platform: broadlink
#    host: 192.168.31.22 - no needed more
    mac: B4:43:0D:CB:F5:18
    switches:
      - name: 'Plant Plug'

I can confirm that the automatic discovery had to be ignored, and manual adding via the web-interface works well.