doudz / homeassistant-zigate

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

Add the ability of ajusting #16

Closed max5962 closed 5 years ago

max5962 commented 5 years ago

Hello, It could be awesome if we can ajust the vibration aquara sensibility. According "https://faire-ca-soi-meme.fr/domotique/2018/09/03/test-xiaomi-aqara-vibration-sensor/" it's possible to send zigbee data to the device.

Thanks

doudz commented 5 years ago

Sure, I'm already working on ;-)

ruimarinho commented 5 years ago

I am getting this strange value with this sensor — what does it mean @doudz ?

2018-12-17 21:48:57 DEBUG (ZiGate-Event Loop) [custom_components.zigate] Update attribute for device Device 00158d0002b23cb4 (d3ee) lumi.vibration.aq1 {'endpoint': 1, 'cluster': 257, 'addr': 'd3ee', 'attribute': 1285, 'data': '\x00\\\x00\x00', 'expire': 2, 'expire_value': '', 'name': 'unknown', 'value': '\x00\\\x00\x00'}
2018-12-17 21:48:59 DEBUG (Thread-430) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2018-12-17 21:48:59 DEBUG (Thread-430) [custom_components.zigate] Update attribute for device Device 00158d0002b23cb4 (d3ee) lumi.vibration.aq1 {'endpoint': 1, 'cluster': 257, 'addr': 'd3ee', 'attribute': 1285, 'data': '', 'expire': 2, 'expire_value': '', 'name': 'unknown', 'value': ''}
doudz commented 5 years ago

the unknown attribute will be removed soon since I really don't know what is it

doudz commented 5 years ago

Should work now

max5962 commented 5 years ago

@doudz What should work 'strange value" or "ability of ajusting sensibility" ? :)

doudz commented 5 years ago

ability of ajusting sensibility, using service write_attribute

max5962 commented 5 years ago

@doudz

thanks a lot ! Can you update the readme with an example ? :)

max5962 commented 5 years ago

@doudz Using { "addr": "8c37", "cluster":"0", "attribute_id":"0xFF0D", "manufacturer_code":"0x115F", "attribute_type":"0x20", "value":"0x01" } do not work ( i have no log put only : image

doudz commented 5 years ago

the endpoint is missing

max5962 commented 5 years ago

Hello, Just tried. it better, but now i have the error :

2019-01-24 20:45:01 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED 2019-01-24 20:45:01 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'9a8c37010101050800250008000004b2' 2019-01-24 20:45:01 ERROR (ZiGate-Decode data) [zigate] Error decoding response 0x8102: b'9a8c37010101050800250008000004b2' 2019-01-24 20:45:01 ERROR (ZiGate-Decode data) [zigate] Traceback (most recent call last): File "/config/deps/lib/python3.6/site-packages/zigate/core.py", line 449, in decode_data response = RESPONSES.get(msg_type, Response)(value, rssi) File "/config/deps/lib/python3.6/site-packages/zigate/responses.py", line 33, in __init__ self.decode() File "/config/deps/lib/python3.6/site-packages/zigate/responses.py", line 798, in decode data = struct.unpack(fmt, self.data['data'])[0] struct.error: unpack requires a buffer of 8 bytes

Received after :
2019-01-24 20:48:32 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8702 - APS Data Confirm Fail : status:240, source_endpoint:1, dst_endpoint:1, dst_address_mode:2, dst_address:0x8c37, sequence:169, rssi:0 2019-01-24 20:48:32 ERROR (ZiGate-Decode data) [zigate] RESPONSE 0x8702 - APS Data Confirm Fail : status:240, source_endpoint:1, dst_endpoint:1, dst_address_mode:2, dst_address:0x8c37, sequence:169, rssi:0 2019-01-24 20:48:32 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED

doudz commented 5 years ago

there's a problem with the response 0x8102, the data length should be 8 bytes but there only 4 bytes 9a 8c37 01 0101 0508 00 25 0008 000004b2 @fairecasoimeme could you take a look ? maybe it's related to the data type 0x25 ?

max5962 commented 5 years ago

Do I need to create zigate issues (on zigate GitHub)?

doudz commented 5 years ago

No, I managed to avoid the problem and Akila is working on the problem on the zigate side. If you're using the lib 0.27.* it should be ok

doudz commented 5 years ago

Example added in readme

max5962 commented 5 years ago

@doudz I have a really strange issues. Using the latest version, i'm not be able to re-add the devices :

refresh_devices_list :

2019-02-05 20:18:11 DEBUG (ZiGate-Decode data) [zigate] Previous devices missing : {'ff7a', 'd510', '4d00', '3635', 'db27', '8aa5', '9666', 'c033', '22e6', 'e700', '67bb'}
2019-02-05 20:18:11 WARNING (ZiGate-Decode data) [zigate] The device 4d00 is missing
2019-02-05 20:18:11 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_DEVICE_UPDATED
2019-02-05 20:18:11 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update device LUMI lumi.vibration.aq1 (4d00) 00158d0002b12693

Permit join and reset the devices do not work ( nothing happened )

2019-02-05 20:21:25 DEBUG (SyncWorker_39) [zigate] REQUEST : 0x0049 FFFC1E00
2019-02-05 20:21:25 DEBUG (SyncWorker_39) [zigate] Msg to send b'0049000450fffc1e00'
2019-02-05 20:21:25 DEBUG (SyncWorker_39) [zigate] Encoded Msg to send b'010210490210021450fffc1e021003'
2019-02-05 20:21:25 DEBUG (SyncWorker_39) [zigate] Waiting for status message for command 0x0049
2019-02-05 20:21:26 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15\x02\x1e\x02\x10\xc2\x02\x10I\x02\x10\x03'
2019-02-05 20:21:26 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-02-05 20:21:26 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'00c20049'
2019-02-05 20:21:26 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:194, packet_type:73, error:b'', rssi:0
2019-02-05 20:21:26 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-02-05 20:21:26 DEBUG (SyncWorker_39) [zigate] STATUS code to command 0x0049:RESPONSE 0x8000 - Status response : status:0, sequence:194, packet_type:73, error:b'', rssi:0

any idea ?

doudz commented 5 years ago

Really strange, everything looks good. maybe it's a problem with the device itself