Core: Broadlink MP1 stops working on 0.94.0

Created on 6 Jun 2019  路  54Comments  路  Source: home-assistant/core

Home Assistant release with the issue:

0.94.0

Last working Home Assistant release (if known):

0.93.2

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

Hass.io VM

Component/platform:

Broadlink Switch

Description of problem:

Broadlink MP1 Smart Plug Power Strip stops working on 0.94.0.
Its shown as unavailable in HA (greyed out in UI)
Nothing in the log file.
The plug is still working via the Broadlink.app on smartphone.

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

- platform: broadlink
  host: 192.168.2.120
  mac: '34:EA:34:xx:xx:xx'
  type: mp1
  friendly_name: 'Leiste 4Fach'
  timeout: 30
  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: 'Slot1'
    slot_2: 'Slot2'
    slot_3: 'Monitor 2'
    slot_4: 'Monitor 1'

Traceback (if applicable):


Additional information:

broadlink

Most helpful comment

In case it's helpful to someone, if you want to use Home Assistant 0.94 or 0.95 and be able to use the MP1 without needing to change your configuration, you can try this:

All 54 comments

Confirmation, same problem.

Same issues

Same problem here

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

_This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people._

Could you enable debug logging for broadlink?
Without any logs, I can not solve this

same here on rpi+ with hassos i will try to enable debug and post.

  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 311, in update
    self._parent_device.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 330, in update
    self._update()
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 335, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 352, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2019-06-06 21:04:51 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.gron_lampe fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 311, in update
    self._parent_device.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 330, in update
    self._update()
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 335, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 352, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2019-06-06 21:05:32 ERROR (SyncWorker_14) [homeassistant.components.broadlink.switch] Timeout during authorization
2019-06-06 21:05:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.lampette_2 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 311, in update
    self._parent_device.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 330, in update
    self._update()
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 335, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 352, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2019-06-06 21:05:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.magsafes fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 311, in update
    self._parent_device.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 330, in update
    self._update()
  File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 335, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 352, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

Thanks.
Could someone test this bug fix:
https://github.com/mjg59/python-broadlink/compare/master...bug_fix?quick_pull=1

You need to manually modify the broadlink library.

can i do that in hassio? - seems not -- cant see the broadlink dir...

Have this issue also,
I tried to copy everything into a broadlink custom component directory with that commit but I think it didnt actually use the custom component, how do I test this (running Hass.io)

I confirm the problem. broadlink_cli sees the device, and scripts using python-broadlink also see and can control the device. But the HASS does not see the device without any obvious errors. Just status in the web-interface - unavailable. The bug fix didn't help me. I fixed it in the source and reinstalled the library via sudo python3 setup.py install. No result.

@feador :
So what error message to you get?
Are you sure the bug fix is applied?

@Danielhiversen:
No error. Or I look at them incorrectly. I use this:

logger:
default: debug

Also I watch the general log. In it, the broadlink component is loading normally, the switch too. Moreover, the broadlink device is in the device_tracker. If you tell me, I can do something extra.

Without any error log, there is not much I can do.
I don't have the device, so it will be up to you to debug it.

Can I somehow trace all the stages of connecting to the device through the component.broadlink?

If I set a fake IP in the configuration.yaml, then an error appears:

_Failed to connect to device
15:52 components/broadlink/switch.py (ERROR)
Setup of platform broadlink is taking over 10 seconds.
15:52 util/async_.py (WARNING)_

And with real IP all is quiet. Maybe a problem with the WebUI? For some reason, he thinks that the device is not available.

Same problem. Try to play around to fix it! :(

Same issues and sp mini3 does not work like mp1

Sometimes in the log it happens:

_WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.slot1 is taking over 10 seconds_

2019-06-08 19:03:43 ERROR (SyncWorker_16) [homeassistant.components.broadlink.switch] Timeout during
authorization

Same, Timeout during authorization.

Sometimes in the log it happens:

_WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.slot1 is taking over 10 seconds_

This is the only Error I get sometimes, too. But I got this also on older HA Version.
It looks like the Broadlink Plug is connected but nevertheless not shown in HA UI

Same issue here

https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component
FYI.
This custom component solved the issue for me.

https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component
FYI.
This custom component solved the issue for me.

Thank bro. it solved my issue

Thank. It works!

Hi, sorry for asking, but I'm in 0.94.3 and the fix is not there yet, will it be in future releases?or we have to set up this custom component?

why is this closed? the issue still persists.

I just upgraded to 0.94.3 and the issue still persists, is your code integrated to the stable version @Danielhiversen ?

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

just tested the fix #24450, it works, but when i reboot home assistant, one or two of the plugs become unavaliable, got this in the log

Update of switch.phone is taking over 10 seconds
07:00 __main__.py (WARNING) - message first occured at 05:56 and shows up 2 times

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

I am not using Hass.io but I will check it.

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

I fixed the long booting time issue.
You can fix it with "requirements": ["broadlink==0.10.0"] at the manifest.json
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/commit/ad29b9ef358d4ab8347cbce33475b85681dad085

Have you tested this fix: #24450 ?

Could you kindly how to execute the fix? I installed home assistant via the virtual environment, thanks in advance!

@Danielhiversen is the fix already applied on 0.95.0b0? I see #24589 as a commit on the rc branch, but I'm not sure if I'm looking at the right place.

If it's applied on the 0.95.0b0 it doesn't seem to be working.

I also tried to apply it manually by copying all the files of the component on a custom_components folder without success.

I added this to my configuration file but I can't see anything related on the logs.

logger: default: warn logs: homeassistant.components.broadlink: debug homeassistant.components.broadlink.switch: debug homeassistant.components.broadlink.sensor: debug broadlink: debug

Just upgraded to 0.95 and my MP1 still show as unavailable. Downgraded to 0.93.2 and working again.

This issue probably needs to be reopened.

Same for me.

Sale here, The issue persist

In case it's helpful to someone, if you want to use Home Assistant 0.94 or 0.95 and be able to use the MP1 without needing to change your configuration, you can try this:

Sorry posavasos it didn't work for me.
I got error:
[homeassistant.loader] Error parsing manifest.json file at /config/custom_components/broadlink/manifest.json: Expecting value: line 7 column 1 (char 6)

@eyalsac I would try to download the file again https://raw.githubusercontent.com/home-assistant/home-assistant/0.93.2/homeassistant/components/broadlink/manifest.json

Or try to download the whole folder on a zip with some tool, like https://minhaskamal.github.io/DownGit/#/home?url=https:%2F%2Fgithub.com%2Fhome-assistant%2Fhome-assistant%2Ftree%2F0.93.2%2Fhomeassistant%2Fcomponents%2Fbroadlink

I'm on 0.96 beta, and the issue persist

Anyone update to 0.96 production? Still waiting for the bug fix

Is there a way to reopen an issue? This has been broken for 2 releases now.

this issue persist, dont know why this is closed

Seem that non of the devlepors is looking on this issue since it closed.
So, I opened new issue #25297. Hope it will help.

@fernandex00 or anyone else, can you post the relevant output from the log at issue #25297?
I'm still on ver 0.90 wait for the issue to been solved.

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

I fixed the long booting time issue.
You can fix it with "requirements": ["broadlink==0.10.0"] at the manifest.json
af950833/Home-Assistant-Broadlink-MP1-Custom-Component@ad29b9e

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

I fixed the long booting time issue.
You can fix it with "requirements": ["broadlink==0.10.0"] at the manifest.json
af950833/Home-Assistant-Broadlink-MP1-Custom-Component@ad29b9e

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

I fixed the long booting time issue.
You can fix it with "requirements": ["broadlink==0.10.0"] at the manifest.json
af950833/Home-Assistant-Broadlink-MP1-Custom-Component@ad29b9e

Have you tested this fix: #24450 ?
below workaround fixes the issue, But looking a native support for boardlink. Also, this fix takes 10mins for hassio to reboot.
https://github.com/af950833/Home-Assistant-Broadlink-MP1-Custom-Component/tree/master/custom_components/broadlink_mp1

I fixed the long booting time issue.
You can fix it with "requirements": ["broadlink==0.10.0"] at the manifest.json
af950833/Home-Assistant-Broadlink-MP1-Custom-Component@ad29b9e

I'm on 0.96.5 it work fine for me

I have fixed an error.
Please check fix #25806

not fixed here, there must be something really flawed with this component (sorry)

same for me, so I keep using the custom component/

This isnt fixed, can this issue be reopned please?

Guys, it seems to be working on 0.98.0. I do not know if it is connected but socket triggers in lovelace seems to go a little bit crazy. Some times it takse a couple of seconds to have right state in the UI.

Was this page helpful?
0 / 5 - 0 ratings