doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 15 forks source link

Error while calling refresh_device on Ikea Tradfri outlet #32

Closed Jsl-1 closed 5 years ago

Jsl-1 commented 5 years ago

Hi,

From a few days, i can't call refresh_device on my Ikea Tradfri outlets. I think it started with python lib 0.27.0, but i'm not sure.

It's strange, it's working on another device like Philips hue bulb but none of my eight tradfri plug If i toggle from home assistant or with hue remote, the status is reporting normaly. Any idea ?

Here is the log :

2019-02-05 14:43:44 DEBUG (SyncWorker_5) [zigate] REQUEST : 0x0100 b'\x02c\x9f\x01\x01\x00\x08\x00\x00\x00\x00\x07\x00\x00\x00\x01\x00\x0f\x00\x10\x00\x11@\x00\xff\xfd'
2019-02-05 14:43:44 DEBUG (SyncWorker_5) [zigate] Msg to send b'0100001aa702639f01010008000000000700000001000f001000114000fffd'
2019-02-05 14:43:44 DEBUG (SyncWorker_5) [zigate] Encoded Msg to send b'010211021002101aa70212639f02110211021002180210021002100210021702100210021002110210021f021010021011400210fffd03'
2019-02-05 14:43:44 DEBUG (SyncWorker_5) [zigate] Waiting for status message for command 0x0100
2019-02-05 14:43:44 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15\xba\x02\x10>\x02\x11\x02\x10\x02\x10\x03\x01\x81\x02\x12\x02\x10\x02\x1e\xff>c\x9f\x02\x11\x02\x10\x02'
2019-02-05 14:43:44 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x18\x02\x10\x02\x10\x02\x10 \x02\x10\x02\x11\xfef\x03\x01\x81\x02\x12\x02\x10\x02\x1f\x02\x13>c\x9f\x02\x11\x02\x10\x02\x18\x02\x10\x02\x11\x02\x10!\x02\x10\x02\x12\x02\x10\x02\x10f\x03\x01\x81\x02\x12\x02\x10\x02\x1e6>c\x9f\x02\x11\x02\x10\x02\x18\x02\x10\x02\x1f\x02\x10\x18\x02\x10\x02\x11\x02\x10f\x03\x01\x81\x02\x12\x02\x10\x02\x1f\x12>c\x9f\x02\x11\x02\x10\x02\x18\x02\x10\x10\x02\x10!\x02\x10\x02\x12\x02\x10\x02\x10f\x03\x01\x81\x02\x12\x02\x10\x02\x1e\xee>c\x9f\x02\x11\x02\x10\x02\x18\x02\x10\x11\x02\x10 \x02\x10\x02\x11\xfef\x03\x01\x81\x02\x12\x02\x10\x02\x1e\xbe>c\x9f\x02\x11\x02\x10\x02\x18@\x02\x10\x02\x10 \x02\x10\x02\x11\xfff\x03\x01\x81\x02\x12\x02\x10\x02\x1f\x02\x11>c\x9f\x02\x11\x02\x10\x02\x18\xff\xfd\x02\x10!\x02\x10\x02\x12\x02\x10\x02\x11f\x03'
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'003e0100'
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:62, packet_type:256, error:b'', rssi:0
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f010008000000200001fe'
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:0, status:0, data_type:32, size:1, data:254, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f0100080001002100020000'
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:1, status:0, data_type:33, size:2, data:0, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f010008000f0018000100'
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 0, 'data': 254, 'name': 'current_level', 'type': <class 'int'>, 'value': 100}
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (SyncWorker_5) [zigate] STATUS code to command 0x0100:RESPONSE 0x8000 - Status response : status:0, sequence:62, packet_type:256, error:b'', rssi:0
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:15, status:0, data_type:24, size:1, data:0, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139912822584880] Error handling message: {'type': 'call_service', 'domain': 'zigate', 'service': 'refresh_device', 'service_data': {'entity_id': 'zigate.000d6ffffea8384b'}, 'id': 14}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1129, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1153, in _execute_service
    await self._hass.async_add_executor_job(handler.func, service_call)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/zigate/__init__.py", line 333, in refresh_device
    myzigate.refresh_device(addr)
  File "/config/deps/lib/python3.6/site-packages/zigate/core.py", line 1029, in refresh_device
    device.refresh_device()
  File "/config/deps/lib/python3.6/site-packages/zigate/core.py", line 2318, in refresh_device
    attributes)
  File "/config/deps/lib/python3.6/site-packages/zigate/core.py", line 1358, in read_attribute_request
    manufacturer_code, length, *sub_attribute)
struct.error: pack expected 22 items for packing (got 19)
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f0100080010002100020000'
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 1, 'data': 0}
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:16, status:0, data_type:33, size:2, data:0, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f010008001100200001fe'
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 15, 'data': 0}
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:17, status:0, data_type:32, size:1, data:254, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f010008400000200001ff'
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 16, 'data': 0}
2019-02-05 14:43:44 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:16384, status:0, data_type:32, size:1, data:255, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 17, 'data': 254}
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'3e639f010008fffd002100020001'
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:62, addr:639f, endpoint:1, cluster:8, attribute:65533, status:0, data_type:33, size:2, data:1, rssi:102
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 16384, 'data': 255}
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device IKEA of Sweden TRADFRI control outlet (639f) 000d6ffffea8384b {'endpoint': 1, 'cluster': 8, 'addr': '639f', 'attribute': 65533, 'data': 1}
2019-02-05 14:43:44 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED

Thanks for your hard work on this lib ;)

doudz commented 5 years ago

Could you provide your zigate.json ?

Jsl-1 commented 5 years ago

Yes,

zigate.json

doudz commented 5 years ago

fixed in 0.27.4, thanks !

Jsl-1 commented 5 years ago

Thanks to you ;)