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
72.65k stars 30.41k forks source link

ZHA (Bellows) fails to start with EZSP compatible EM3588 Stick, firmware / protocol revision issue? #7633

Closed MindrustUK closed 7 years ago

MindrustUK commented 7 years ago

ZHA (Bellows) fails to start with EZSP compatible EM3588 Stick, firmware / protocol revision issue?

Home Assistant release (hass --version): 0.44.1

Python release (python3 --version): Python 3.4.2

Component/platform: zha (Zigbee Home Automation)

Description of problem: Component delivers a stack trace, prevents Home-Assistant startup.

Expected: Normal operation.

Problem-relevant configuration.yaml entries and steps to reproduce:

zha:
  usb_path: /dev/ttyUSB1
  database_path: /opt/hass/zigbee.db

Setup ZHA. Start Home-Assistant.

Traceback (if applicable):

INFO:homeassistant.setup:Setting up zha
DEBUG:bellows.zigbee.appdb:Loading application state from /opt/hass/zigbee.db
DEBUG:bellows.uart:Sending: b'\x1a\xc08\xbc~'
DEBUG:bellows.uart:RSTACK frame: b'\xc1\x02\x0b\nR~'
DEBUG:bellows.ezsp:Send command version
DEBUG:bellows.uart:Sending: b'\x00B!\xa8P\xed,~'
DEBUG:bellows.uart:Data frame: b'\x01B\xa1\xa8Q(\x05\xeb\xd8{~'
DEBUG:bellows.uart:Sending: b'\x81`Y~'
DEBUG:bellows.ezsp:Application frame 0 received
DEBUG:bellows.ezsp:Application frame 0 (version) received
DEBUG:bellows.ezsp:Send command setConfigurationValue
DEBUG:bellows.uart:Sending: b"}1C!\xfbX(\x15\xc3'~"
DEBUG:bellows.uart:Data frame: b'\x12C\xa1WT\xa3`~'
DEBUG:bellows.uart:Sending: b'\x82P:~'
DEBUG:bellows.ezsp:Application frame 255 received
ERROR:homeassistant.core:Error doing job: Exception in callback SerialTransport._read_ready()
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/opt/hass/.homeassistant/deps/serial_asyncio/__init__.py", line 106, in _read_ready
    self._protocol.data_received(data)
  File "/opt/hass/.homeassistant/deps/bellows/uart.py", line 54, in data_received
    self.frame_received(frame)
  File "/opt/hass/.homeassistant/deps/bellows/uart.py", line 64, in frame_received
    self.data_frame_received(data)
  File "/opt/hass/.homeassistant/deps/bellows/uart.py", line 84, in data_frame_received
    self._application.frame_received(self._randomize(data[1:-3]))
  File "/opt/hass/.homeassistant/deps/bellows/ezsp.py", line 148, in frame_received
    frame_name = self.COMMANDS_BY_ID[frame_id][0]
KeyError: 255
WARNING:homeassistant.setup:Setup of zha is taking over 10 seconds.

Additional info:

Output of Silicon Labs Scan.py tool:

{"stackVersion": "5.9.1-132", "deviceType": "zigbee", "pid": "8a5e", "port": "/dev/ttyUSB1", "vid": "10c4"}

Running the following works fine and doesn't issue any errors:

bellows -v debug -d /dev/ttyUSB1 info
bellows -v debug -d /dev/ttyUSB1 config --all
oafilipoai commented 7 years ago

I'm seeing a similar problem, although the stack trace is different. This also prevents Home Assistant from starting up.

2017-05-18 10:02:52 ERROR (MainThread) [bellows.ezsp] Exception running handler
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/bellows/ezsp.py", line 175, in handle_callback
    handler(*args)
  File "/home/homeassistant/.homeassistant/deps/bellows/zigbee/application.py", line 149, in ezsp_callback_handler
    self._handle_frame_failure(*args)
  File "/home/homeassistant/.homeassistant/deps/bellows/zigbee/application.py", line 221, in _handle_frame_failure
    send_fut.set_exception(Exception("Message send failure: %s" % (status, )))
  File "/usr/lib/python3.4/enum.py", line 464, in __str__
    return "%s.%s" % (self.__class__.__name__, self._name_)
AttributeError: 'EmberStatus' object has no attribute '_name_'

More information: Home Assistant version 0.44.1 Python 3.4.2

oafilipoai commented 7 years ago

I should also mention that I'm using the Nortek HUSBZB-1 USB stick. This setup used to work fine with HA 0.44 and one hue bulb attached. Since then I upgraded HA to 0.44.1 and added a cree bulb and a Lutron remote. The setup continued to work (e.g. control the bulbs) until, after one restart, the web frontend failed to start and I found the stack trace listed above in the logs. Removing the zha section from config fixes the issue and the frontend starts again.

MindrustUK commented 7 years ago

Currently open under: [https://github.com/rcloran/bellows/issues/18]() and referenced from [https://community.home-assistant.io/t/one-zigbee-gateway-to-rule-them-all/16803/31]()

rcloran commented 7 years ago

@oafilipoai : "I'm seeing a similar problem, although the stack trace is different" ... a different stack trace probably means a different problem.

The issue with __name__ is fixed in https://github.com/rcloran/bellows/commit/72bc167a1b8752973b20ab04c4f9f2dc58acf278 - I'm going to bump the bellows version today and send a PR to update hass.

rcloran commented 7 years ago

I'm not sure that ezsp 5 support should really be a Home Assistant issue. Please re-open if you disagree.

In any case, I'm waiting on #8308 and #8310 to be merged so that I can request https://github.com/rcloran/home-assistant/tree/bellows-split-cluster -- that will bring in bellows 0.3.1, which fixes the EZSP 5 support.