Broadlink mp1 not working after update 0.81.1

Hello,

Till yesterday i was working on HA 0.77.3 and all works good.

After i updated to 0.81.1, my broadlink mp1 doesn’t work.

Thhis is my switch config file:

- platform: broadlink
  host: 192.168.1.142
  mac: '34:EA:34:XX:XX:XX'
  type: mp1
  friendly_name: 'Regleta'
  slots:
    slot_1: 'GW_Xiaomi'
    slot_2: 'TV_Play'
    slot_3: 'AppleTV'
    slot_4: 'Decoder_RU'

here my logs:

2018-10-29 20:54:07 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.appletv fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 358, in update
    self._parent_device.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 377, in update
    self._update()
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 382, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 369, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2018-10-29 20:54:07 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.gw_xiaomi fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 358, in update
    self._parent_device.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 377, in update
    self._update()
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 382, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 369, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2018-10-29 20:54:07 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.tv_play fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 358, in update
    self._parent_device.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 377, in update
    self._update()
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 382, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 369, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2018-10-29 20:54:07 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.decoder_ru fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 358, in update
    self._parent_device.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 377, in update
    self._update()
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 382, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 369, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2018-10-29 20:54:23 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.tv_play fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 358, in update
    self._parent_device.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 377, in update
    self._update()
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 382, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 369, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
2018-10-29 20:54:30 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.tv_play fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 358, in update
    self._parent_device.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 377, in update
    self._update()
  File "/usr/src/app/homeassistant/components/switch/broadlink.py", line 382, in _update
    states = self._device.check_power()
  File "/usr/local/lib/python3.6/site-packages/broadlink/__init__.py", line 369, in check_power
    data['s1'] = bool(state & 0x01)
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

Something changed in last updated about configuration?

thanks

@garvarma - Are you still having this issue? You don’t happen to be running the HomeKit component are you?

I use a Broadlink MP1 and had no issues with it on all 0.81.x versions, upgraded to 0.82.0 this morning and was operating fine for 12 hours - switches turning on and off with automations and manually.

I then successfully deleted the old Homebridge add-on and replaced it with the in-built Homekit component. I started making config changes to get the HomeKit entities just right. I only changed settings specific to the HomeKit component and entities - I run split configuration files and there were no changes to any other configuration files. Multiple restarts of HA and on one restart I noticed that I was getting the same issue with EXACTLY the same error message.

I completely removed the HomeKit component, restarted and the error went away. I then re-enabled the component, but commented out most of it and added one piece of functionality at a time with restarts in between. I eventually got to the end where everything had been uncommented, and guess what? It all worked, no more errors.

Very odd - either it is highly coincidental, and has nothing to do with the HomeKit component, or something went temporarily screwy with the whole HA setup.

So, if you are still having the issue and are running the HomeKit component, try removing it and see what happens.

Hello @aheath,

Sorry for delay of reply.

Well after working after few days (i restarted home assistant) now seems all works fine.
In my case i also have Homekit component, but now all works fine.

So thanks you for reply and to give me the information.