zigpy / zigpy-cc

Texas Instruments Z-Stack ZNP handler for zigpy
https://github.com/zigpy/zigpy-cc
GNU General Public License v3.0
71 stars 13 forks source link

zigpy_cc is throwing an exception when decoding a received frame from the serial port #21

Closed macros0 closed 4 years ago

macros0 commented 4 years ago

https://github.com/zha-ng/zha-map/issues/15

aneisch commented 4 years ago

I am having the same:

File "/usr/local/lib/python3.7/site-packages/zigpy_cc/zpi_object.py", line 76, in from_unpi_frame
payload = cls.read_parameters(frame.data, parameters)
File "/usr/local/lib/python3.7/site-packages/zigpy_cc/zpi_object.py", line 149, in read_parameters
res[name] = buffalo.read_parameter(type, options)
File "/usr/local/lib/python3.7/site-packages/zigpy_cc/buffalo.py", line 69, in read_parameter
elif type == ParameterType.LIST_UINT32:
File "/usr/local/lib/python3.7/enum.py", line 349, in getattr
raise AttributeError(name) from None
AttributeError: LIST_UINT32
sanyatuning commented 4 years ago

Thanks for the report. I will fix it this week.

sanyatuning commented 4 years ago

self note: there are no LIST_UINT32 in ParameterType and looks like buffaloznp class is not ported

sanyatuning commented 4 years ago

@macros0 I fixed this Can you upgrade zigpy-cc in your installation to test it?

ps: It will be available in HA 0.108.

sanyatuning commented 4 years ago

I added some info to the readme about how you can test the new release

LEJOUI commented 4 years ago

I did the upgrade to 0.3.0 and it throws this errors when running a network scan:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/site-packages/serial_asyncio/__init__.py", line 106, in _read_ready
    self._protocol.data_received(data)
  File "/config/deps/lib/python3.7/site-packages/zigpy_cc/uart.py", line 144, in data_received
    self._api.data_received(frame)
  File "/config/deps/lib/python3.7/site-packages/zigpy_cc/api.py", line 201, in data_received
    raise e
  File "/config/deps/lib/python3.7/site-packages/zigpy_cc/api.py", line 198, in data_received
    obj = ZpiObject.from_unpi_frame(frame)
  File "/config/deps/lib/python3.7/site-packages/zigpy_cc/zpi_object.py", line 76, in from_unpi_frame
    payload = cls.read_parameters(frame.data, parameters)
  File "/config/deps/lib/python3.7/site-packages/zigpy_cc/zpi_object.py", line 149, in read_parameters
    res[name] = buffalo.read_parameter(type, options)
  File "/config/deps/lib/python3.7/site-packages/zigpy_cc/buffalo.py", line 73, in read_parameter
    raise TODO("read type %d", type)
zigpy_cc.exception.TODO: ('read type %d', <ParameterType.LIST_NEIGHBOR_LQI: 15>)

and this one

Logger: zigpy_cc.api
Source: deps/lib/python3.7/site-packages/zigpy_cc/api.py:200
First occurred: 15:38:07 (1 occurrences)
Last logged: 15:38:07

Error while parsing frame: <UnpiFrame type=CommandType.AREQ subsystem=Subsystem.ZDO command_id=177 data=b'\x00\x00\x00\x14\x00\x03\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\x1d$&\xfe\xffW\xb4\x14\xef>\x15\x02\x01\x00\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\x9atk\x03\x00\x8d\x15\x00}0\x12\x02\x01`\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\x8d(,\x03\x00\x8d\x15\x00}\xcc\x12\x02\x017' length=72 fcs=34

as last this one

Logger: zigpy_cc.exception
Source: deps/lib/python3.7/site-packages/zigpy_cc/exception.py:11
First occurred: 15:38:07 (1 occurrences)
Last logged: 15:38:07

Not implemented: read type 15
sanyatuning commented 4 years ago

I will look into this.

Sebclem commented 4 years ago

Hi ! I still have the TODO exception with 0.3.1. (HA 0.108.5) but with a different line (41) :

2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.api] waiting for 13 mgmtLqiReq
2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.api] --> SREQ ZDO mgmtLqiReq tsn: 13 {'dstaddr': 0x0000, 'startindex': 0}
2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.uart] Send: b'\xfe\x03%1\x00\x00\x00\x17'
2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.uart] Frame received: <UnpiFrame type=CommandType.SRSP subsystem=Subsystem.ZDO command_id=49 data=b'\x00' length=1 fcs=85>
2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.api] <-- SRSP ZDO mgmtLqiReq tsn: None {'status': 0}
2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.uart] Frame received: <UnpiFrame type=CommandType.AREQ subsystem=Subsystem.ZDO command_id=177 data=b'\x00\x00\x00\x01\x00\x01\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\x0f~O\x04\x00\x8d\x15\x00|\x1b\x12\x02\x01j' length=28 fcs=86>
2020-04-17 14:59:51 DEBUG (MainThread) [zigpy_cc.api] <-- AREQ ZDO mgmtLqiRsp tsn: 13 {'srcaddr': 0x0000, 'status': 0, 'neighbortableentries': 1, 'startindex': 0, 'neighborlqilistcount': 1, 'neighborlqilist': [{'extPanId': dd:dd:dd:dd:dd:dd:dd:dd, 'extAddr': 00:15:8d:00:04:4f:7e:0f, 'nwkAddr': 0x1b7c, 'deviceType': 2, 'rxOnWhenIdle': 0, 'relationship': 1, 'permitJoin': 2, 'depth': 1, 'lqi': 106}]}
2020-04-17 14:59:51 WARNING (MainThread) [zigpy_cc.exception] Not implemented: write ParameterType.LIST_NEIGHBOR_LQI
2020-04-17 14:59:51 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback SerialTransport._read_ready()
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/site-packages/serial_asyncio/__init__.py", line 106, in _read_ready
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.7/site-packages/zigpy_cc/uart.py", line 144, in data_received
    self._api.data_received(frame)
  File "/usr/local/lib/python3.7/site-packages/zigpy_cc/api.py", line 219, in data_received
    self._app.handle_znp(obj)
  File "/usr/local/lib/python3.7/site-packages/zigpy_cc/zigbee/application.py", line 278, in handle_znp
    frame = obj.to_unpi_frame()
  File "/usr/local/lib/python3.7/site-packages/zigpy_cc/zpi_object.py", line 55, in to_unpi_frame
    data.write_parameter(p["parameterType"], value, {})
  File "/usr/local/lib/python3.7/site-packages/zigpy_cc/buffalo.py", line 41, in write_parameter
    raise TODO("write %s", ParameterType(type))
zigpy_cc.exception.TODO: ('write %s', <ParameterType.LIST_NEIGHBOR_LQI: 15>) 

It's just after a zha_map.scan_now call.

sanyatuning commented 4 years ago

Thanks for the report. I will try zha_map to fix all errors at once.

sanyatuning commented 4 years ago

fixed, release soon

sanyatuning commented 4 years ago

released in 0.3.2 and 0.4.2