jlusiardi / homekit_python

A python implementation to work as both HomeKit controller and accessory.
Apache License 2.0
220 stars 41 forks source link

Support for Velux gateway (KIX 300) #155

Closed tleegaard closed 5 years ago

tleegaard commented 5 years ago

I've managed to pair the Velux Gateway with Home Assistant as Homekit controller, and the device is showing the temperature and humidity sensor, but not the CO2 sensor. I thought I would give this a try, to see the raw output of HomeKit Python:

(For the record - I have only tinkered with KIX300 (gateway) and KLA300 (indoor sensor) for now, as I'm awaiting the motorized windows to be installed)

python3 -m homekit.discover

Name: VELUX gateway._hap._tcp.local.
Url: http_impl://192.168.1.157:5001
Configuration number (c#): 14
Feature Flags (ff): Supports HAP Pairing (Flag: 1)
Device ID (id): D3:4E:DB:1E:AE:43
Model Name (md): VELUX Gateway
Protocol Version (pv): 1.1
State Number (s#): 1
Status Flags (sf): Accessory has not been paired with any controllers. (Flag: 1)
Category Identifier (ci): Bridge (Id: 2)

python3 -m homekit.pair -d D3:4E:DB:1E:AE:43 -p RED-AC-TED -f velux -a velux --log debug

2019-07-30 23:41:48,443 __init__.py:0106 DEBUG #1 ios -> accessory: send SRP start request
2019-07-30 23:41:48,450 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  0: (1 bytes/<class 'bytearray'>) 0x01
]

2019-07-30 23:41:48,476 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x01
  0: (1 bytes/<class 'bytearray'>) 0x01
]

2019-07-30 23:41:48,487 __init__.py:0060 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x01
  0: (1 bytes/<class 'bytearray'>) 0x01
]

2019-07-30 23:41:50,197 tlv.py:0117 DEBUG receiving [
  2: (16 bytes/<class 'bytearray'>) 0x043a66f70ce4bc0009528533ee880ad9
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (384 bytes/<class 'bytearray'>) 0x48123c8d2f46af4260a9f183db3ab99bb0f44bf397575b4026cd0a6f5e8c5b5a6051ef12c2b2867547a752427459879b01d65b77953bd67f22eff670215f6d92fe4093f05c0a294f9d1d72989adc60bb764c9b55d88efd25d784396e22a91d086b3930ba623ee18fc3f399fd881865b556fb4968a5019f07e46fc02ae56e6254bfa4089f3e20f5fc6eabd1922acbac7553329af5fa3ea9cf107d11852117af282ffb1ace0983db2601138fed06d572c8ac454eab216609e24b0ae13feb3687746357207861e62629e8fe4a2e41f2bf6a18b2fe1288a21c8f9de5fef698687d1c6b539207a19c2cee4e8a723fead7dc35a80f06af4549d07ea1f35bd833f0d706ff5dd948954d0cd2c56e96af5c87a4a4516cc393aaa276d4324b9748868b6dcf52f18cadb9c956c468da8068ae2a48db6a2fa8c38fbbe9b1845722e22b01093763ca5f09673c721c3571f0747549bf2cd4890beb64aa533a724b1fd7d78009399be83c3611bc7ba73d9b6608b0f5b9911fdb9db376af5048f157386c06944057
]

2019-07-30 23:41:50,209 __init__.py:0067 DEBUG response: [
  2: (16 bytes/<class 'bytearray'>) 0x043a66f70ce4bc0009528533ee880ad9
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (384 bytes/<class 'bytearray'>) 0x48123c8d2f46af4260a9f183db3ab99bb0f44bf397575b4026cd0a6f5e8c5b5a6051ef12c2b2867547a752427459879b01d65b77953bd67f22eff670215f6d92fe4093f05c0a294f9d1d72989adc60bb764c9b55d88efd25d784396e22a91d086b3930ba623ee18fc3f399fd881865b556fb4968a5019f07e46fc02ae56e6254bfa4089f3e20f5fc6eabd1922acbac7553329af5fa3ea9cf107d11852117af282ffb1ace0983db2601138fed06d572c8ac454eab216609e24b0ae13feb3687746357207861e62629e8fe4a2e41f2bf6a18b2fe1288a21c8f9de5fef698687d1c6b539207a19c2cee4e8a723fead7dc35a80f06af4549d07ea1f35bd833f0d706ff5dd948954d0cd2c56e96af5c87a4a4516cc393aaa276d4324b9748868b6dcf52f18cadb9c956c468da8068ae2a48db6a2fa8c38fbbe9b1845722e22b01093763ca5f09673c721c3571f0747549bf2cd4890beb64aa533a724b1fd7d78009399be83c3611bc7ba73d9b6608b0f5b9911fdb9db376af5048f157386c06944057
]

2019-07-30 23:41:50,222 __init__.py:0118 DEBUG #3 ios -> accessory: send SRP verify request
2019-07-30 23:41:53,696 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x03
  3: (384 bytes/<class 'bytearray'>) 0xf2b22f519f1bfde2090ded7df1883189f7e8f3e4dc94e691d3f821a4b1fe7edc4c70143b8debc6f69966b002bb21107053ebd41a4da5c85dc7f44e9f57defde69602cec0ab172aee879cb210c7c9430fbf67a1d4b3a3b02cd3d490bf55b2da2c04349327a257b5d239859b89efc3d75ce87dbe3672ad767d7aecf13b6282ab3ecc59433d4f875f11e095947e728817c687ccbd62550ded17a5c59ef81c578cf4736977016f7484970a381c40b8b6e8925cb571fdd5c2c8c9846596131baed6892eb83db51d12dff099c2c4a6f97fecb9fef2d2bfa27af3a9daeb013c2a0699c98a0d03c121f468837cc3b488b2d5ce216e580d4efcf4cc37116472552594d28068c0d5284cf6b603b5c42adc80ebbdc4c75e041bb3732a242a5a06a3e7d96b2d0190bac75421838a9c199f64b4b6bc7f30cf1957031e6188afbcfe2a5f54fe9d208aacd8fb465d5f67aa50f18843b5d3963b8230d20288ff8590490814f8fd428b800145d9777122d3cfb563e04dc82bd644c5fa595d67eef900c6db793a1a60
  4: (64 bytes/<class 'bytearray'>) 0x16aa0c9b2ef0689e5a3738f256840374ea6ffb1f77df961ac9e70a9238b6bfff6a78eada1ee4176a7ed4ea54ff73b2666384b6d018f185113f607076c944dd39
]

2019-07-30 23:41:53,724 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x03
  3: (384 bytes/<class 'bytearray'>) 0xf2b22f519f1bfde2090ded7df1883189f7e8f3e4dc94e691d3f821a4b1fe7edc4c70143b8debc6f69966b002bb21107053ebd41a4da5c85dc7f44e9f57defde69602cec0ab172aee879cb210c7c9430fbf67a1d4b3a3b02cd3d490bf55b2da2c04349327a257b5d239859b89efc3d75ce87dbe3672ad767d7aecf13b6282ab3ecc59433d4f875f11e095947e728817c687ccbd62550ded17a5c59ef81c578cf4736977016f7484970a381c40b8b6e8925cb571fdd5c2c8c9846596131baed6892eb83db51d12dff099c2c4a6f97fecb9fef2d2bfa27af3a9daeb013c2a0699c98a0d03c121f468837cc3b488b2d5ce216e580d4efcf4cc37116472552594d28068c0d5284cf6b603b5c42adc80ebbdc4c75e041bb3732a242a5a06a3e7d96b2d0190bac75421838a9c199f64b4b6bc7f30cf1957031e6188afbcfe2a5f54fe9d208aacd8fb465d5f67aa50f18843b5d3963b8230d20288ff8590490814f8fd428b800145d9777122d3cfb563e04dc82bd644c5fa595d67eef900c6db793a1a60
  4: (64 bytes/<class 'bytearray'>) 0x16aa0c9b2ef0689e5a3738f256840374ea6ffb1f77df961ac9e70a9238b6bfff6a78eada1ee4176a7ed4ea54ff73b2666384b6d018f185113f607076c944dd39
]

2019-07-30 23:41:53,739 __init__.py:0060 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x03
  3: (384 bytes/<class 'bytearray'>) 0xf2b22f519f1bfde2090ded7df1883189f7e8f3e4dc94e691d3f821a4b1fe7edc4c70143b8debc6f69966b002bb21107053ebd41a4da5c85dc7f44e9f57defde69602cec0ab172aee879cb210c7c9430fbf67a1d4b3a3b02cd3d490bf55b2da2c04349327a257b5d239859b89efc3d75ce87dbe3672ad767d7aecf13b6282ab3ecc59433d4f875f11e095947e728817c687ccbd62550ded17a5c59ef81c578cf4736977016f7484970a381c40b8b6e8925cb571fdd5c2c8c9846596131baed6892eb83db51d12dff099c2c4a6f97fecb9fef2d2bfa27af3a9daeb013c2a0699c98a0d03c121f468837cc3b488b2d5ce216e580d4efcf4cc37116472552594d28068c0d5284cf6b603b5c42adc80ebbdc4c75e041bb3732a242a5a06a3e7d96b2d0190bac75421838a9c199f64b4b6bc7f30cf1957031e6188afbcfe2a5f54fe9d208aacd8fb465d5f67aa50f18843b5d3963b8230d20288ff8590490814f8fd428b800145d9777122d3cfb563e04dc82bd644c5fa595d67eef900c6db793a1a60
  4: (64 bytes/<class 'bytearray'>) 0x16aa0c9b2ef0689e5a3738f256840374ea6ffb1f77df961ac9e70a9238b6bfff6a78eada1ee4176a7ed4ea54ff73b2666384b6d018f185113f607076c944dd39
]

2019-07-30 23:42:01,275 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x04
  4: (64 bytes/<class 'bytearray'>) 0xa73084eb9a92c8b1ecd4ca0f66f01d49e7c101f96292275b4d812f4fa8cac5852298dce267f7a543c7ac56f7e2921982b4bf2d967dff7c0c95dc00cf47996304
]

2019-07-30 23:42:01,286 __init__.py:0067 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x04
  4: (64 bytes/<class 'bytearray'>) 0xa73084eb9a92c8b1ecd4ca0f66f01d49e7c101f96292275b4d812f4fa8cac5852298dce267f7a543c7ac56f7e2921982b4bf2d967dff7c0c95dc00cf47996304
]

2019-07-30 23:42:01,297 __init__.py:0169 DEBUG #5 ios -> accessory: send SRP exchange request
2019-07-30 23:42:10,945 tlv.py:0134 DEBUG sending [
  1: (36 bytes/<class 'bytes'>) b'ccce48fc-61a8-4d98-8b34-3f473afe0029'
  3: (32 bytes/<class 'bytes'>) b'v\x81\x93d\x89,\x12\xe6\x17\x12C\x07\xb6\x8e!\x1b\xa2Qz\xd6\x03/\xfe{\xa8h#\x87\xbd\xfa\x9a\x93'
  10: (64 bytes/<class 'bytes'>) b'1\x05w\\\x96\xe0\xc0x\xb4@\x1eA%\xdc\xb8\xa1\xa7\xbe!+\x92z\xa9\xbc0\x9b\x83\xd7e\x06\xb1b\xff \xabOFH\x1e"\xbcf\xd7\x8e\xbf\t0\xc7\xec\xdeY\x0c\xee\x04\x1bF[>\xe6#\x9c\xaa\x1e\x0e'
]

2019-07-30 23:42:11,382 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x05
  5: (154 bytes/<class 'bytearray'>) 0x7d4f77a32c82eab29e76f861c9d35f3b4a542a9f9c4a5738f28bf4789e85827b2782dcfeb36a96707b471f519b700c05e5253a457ed60e09d82fd580ae713983b118201711a2621673a07aec8a61b19b42ca604dccb1d700aeb004e1e71e3dc9d99abfc68baa82234df72f587637381a4dc9dd96f3cd7f67e4c14dde887ecb3caed2dc819142dc4bb67f362f954a91ae2777eb929977f83d25db
]

2019-07-30 23:42:11,414 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x05
  5: (154 bytes/<class 'bytearray'>) 0x7d4f77a32c82eab29e76f861c9d35f3b4a542a9f9c4a5738f28bf4789e85827b2782dcfeb36a96707b471f519b700c05e5253a457ed60e09d82fd580ae713983b118201711a2621673a07aec8a61b19b42ca604dccb1d700aeb004e1e71e3dc9d99abfc68baa82234df72f587637381a4dc9dd96f3cd7f67e4c14dde887ecb3caed2dc819142dc4bb67f362f954a91ae2777eb929977f83d25db
]

2019-07-30 23:42:11,436 __init__.py:0060 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x05
  5: (154 bytes/<class 'bytearray'>) 0x7d4f77a32c82eab29e76f861c9d35f3b4a542a9f9c4a5738f28bf4789e85827b2782dcfeb36a96707b471f519b700c05e5253a457ed60e09d82fd580ae713983b118201711a2621673a07aec8a61b19b42ca604dccb1d700aeb004e1e71e3dc9d99abfc68baa82234df72f587637381a4dc9dd96f3cd7f67e4c14dde887ecb3caed2dc819142dc4bb67f362f954a91ae2777eb929977f83d25db
]

2019-07-30 23:42:13,039 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x06
  5: (135 bytes/<class 'bytearray'>) 0xf11e47c72c88b96ae1b8f518e02de4a594b8152c64fa5d1117af39e5c435b989741a67e4ee7f90305f243cab3d67c417fb090bb2198ddff6ff016400f8244092212383a5ad6e8d5bdbcdef7b1d649735d18ed51b7bcd122141e7951ac19d89567b2942edb9e88ec8afeb49870682a694827176805e99a9e867601b5722605821012926af19d211
]

2019-07-30 23:42:13,052 __init__.py:0067 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x06
  5: (135 bytes/<class 'bytearray'>) 0xf11e47c72c88b96ae1b8f518e02de4a594b8152c64fa5d1117af39e5c435b989741a67e4ee7f90305f243cab3d67c417fb090bb2198ddff6ff016400f8244092212383a5ad6e8d5bdbcdef7b1d649735d18ed51b7bcd122141e7951ac19d89567b2942edb9e88ec8afeb49870682a694827176805e99a9e867601b5722605821012926af19d211
]

2019-07-30 23:42:13,164 tlv.py:0117 DEBUG receiving [
  1: (17 bytes/<class 'bytearray'>) 0x44333a34453a44423a31453a41453a3433
  3: (32 bytes/<class 'bytearray'>) 0x31049791d792a8ea67a83e72e60cfd1e9b9613740df41aa278347ce1702117c0
  10: (64 bytes/<class 'bytearray'>) 0x0bebe66810357e9e3b2db5dfa57d793d7263b113e6bbafb75c8334a2811ec3574a9d3e3a13dda299b6d777af45440c3480334eb87b9bbdf3d96d539007f88401
]

2019-07-30 23:42:16,200 ip_implementation.py:0416 DEBUG init session
2019-07-30 23:42:19,084 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytes'>) b'\xfem\xb1\x8c\x9b^e?\xcc\x11\xe5\x8c\x0b\xa4|\x8a\xf8\xcb\xcd\xf3ObRB\x9cA\x11Y\x00\x961E'
]

2019-07-30 23:42:19,112 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0xfe6db18c9b5e653fcc11e58c0ba47c8af8cbcdf34f6252429c41115900963145
]

2019-07-30 23:42:19,124 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0xfe6db18c9b5e653fcc11e58c0ba47c8af8cbcdf34f6252429c41115900963145
]

2019-07-30 23:42:19,614 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0x90bd8c5b3347f69e7547cf2af31549c6c798da1c8931a52b80afd2c27cc32247
  5: (101 bytes/<class 'bytearray'>) 0x70cf68a93d07a423c44ba6327c81f9cec22becc8beb4bb5e7e6662e327494603fa7b2e83b3649c59fd98bf3f1c318e17401b8c20202508ca0a63f2818bed3e00ac024f5aa22ac88d70dc49a918b77a4edf1fe271d0e6f0db4588fcabbba6ec5e5b6c04743b
]

2019-07-30 23:42:19,626 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0x90bd8c5b3347f69e7547cf2af31549c6c798da1c8931a52b80afd2c27cc32247
  5: (101 bytes/<class 'bytearray'>) 0x70cf68a93d07a423c44ba6327c81f9cec22becc8beb4bb5e7e6662e327494603fa7b2e83b3649c59fd98bf3f1c318e17401b8c20202508ca0a63f2818bed3e00ac024f5aa22ac88d70dc49a918b77a4edf1fe271d0e6f0db4588fcabbba6ec5e5b6c04743b
]

2019-07-30 23:42:19,762 tlv.py:0117 DEBUG receiving [
  1: (17 bytes/<class 'bytearray'>) 0x44333a34453a44423a31453a41453a3433
  10: (64 bytes/<class 'bytearray'>) 0xa105a78325eebeacd3e37d8d269a67d211548d38c80c2118048b80b03944c719413d670f0f7b74b66e7502ea918ebfe8a94716806389094abe3a353553c54a03
]

2019-07-30 23:42:19,875 tlv.py:0134 DEBUG sending [
  1: (36 bytes/<class 'bytes'>) b'ccce48fc-61a8-4d98-8b34-3f473afe0029'
  10: (64 bytes/<class 'bytes'>) b'y--\xca+\x03\xd5:}\x85\x9ae\xf4\xf1H\xfd)5B \xe2d\x08\x84\xf6I T\x18+\xaaw\xbb9\xe2\xc4E\x14=\xa8\xe5*}\x17\x82\x10\xf7\xc3\xfe\xdc\\\xdc,\xf9?h\x902%\xb8\xd0\xbb7\x03'
]

2019-07-30 23:42:19,994 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xfd29de6de7fc96a7a503483563fbca4d60fc334dbca0559cc8dc7a0a764b5d2043287b880947eb157cda09c9693ba7d1d0b87078590eebc5fc6f1723036cf5b1ae8d7f6e152b9414aaf0c08f109fe84f8f7de1bda5ce7d917f4362a379033419e67de4990bb746b431f0606dfa34881c1e7631e320add67e
]

2019-07-30 23:42:20,013 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xfd29de6de7fc96a7a503483563fbca4d60fc334dbca0559cc8dc7a0a764b5d2043287b880947eb157cda09c9693ba7d1d0b87078590eebc5fc6f1723036cf5b1ae8d7f6e152b9414aaf0c08f109fe84f8f7de1bda5ce7d917f4362a379033419e67de4990bb746b431f0606dfa34881c1e7631e320add67e
]

2019-07-30 23:42:20,033 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xfd29de6de7fc96a7a503483563fbca4d60fc334dbca0559cc8dc7a0a764b5d2043287b880947eb157cda09c9693ba7d1d0b87078590eebc5fc6f1723036cf5b1ae8d7f6e152b9414aaf0c08f109fe84f8f7de1bda5ce7d917f4362a379033419e67de4990bb746b431f0606dfa34881c1e7631e320add67e
]

2019-07-30 23:42:20,154 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-30 23:42:20,170 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-30 23:42:20,194 ip_implementation.py:0443 DEBUG session established
2019-07-30 23:42:20,203 secure_http.py:0073 DEBUG handle request: b'GET /accessories HTTP/1.1\r\nHost: 192.168.1.157:5001\r\n\r\n'
Pairing for "velux" was established.

python3 -m homekit.get_accessories -f velux -a velux

1.1: >accessory-information<
  1.2: VELUX gateway () >name< [pr]
  1.3: VELUX () >manufacturer< [pr]
  1.4: VELUX Gateway () >model< [pr]
  1.5: g37416e () >serial-number< [pr]
  1.6:  () >identify< [pw]
  1.7: 61 () >firmware.revision< [pr]
1.8: >service<
  1.9: 1.1.0 () >version< [pr]
2.1: >accessory-information<
  2.2: VELUX Sensor () >name< [pr]
  2.3: VELUX () >manufacturer< [pr]
  2.4: VELUX Sensor () >model< [pr]
  2.5: p0040fd () >serial-number< [pr]
  2.7:  () >identify< [pw]
  2.6: 16 () >firmware.revision< [pr]
2.8: >temperature<
  2.9: Temperature sensor () >name< [pr]
  2.10: 22.8 () >temperature.current< [pr,ev]
2.11: >humidity<
  2.12: Humidity sensor () >name< [pr]
  2.13: 67.0 () >relative-humidity.current< [pr,ev]
2.14: >carbon-dioxide<
  2.15: Carbon Dioxide sensor () >name< [pr]
  2.16: 0 () >carbon-dioxide.detected< [pr,ev]
  2.17: 400.0 () >carbon-dioxide.level< [pr,ev]

Also it won't unpair:

python3 -m homekit.remove_pairing -f velux -a velux -i D3:4E:DB:1E:AE:43

Pairing for "velux" was removed.

python3 -m homekit.discover

Name: VELUX gateway._hap._tcp.local.
Url: http_impl://192.168.1.157:5001
Configuration number (c#): 16
Feature Flags (ff): Supports HAP Pairing (Flag: 1)
Device ID (id): D3:4E:DB:1E:AE:43
Model Name (md): VELUX Gateway
Protocol Version (pv): 1.1
State Number (s#): 1
Status Flags (sf): Accessory has been paired. (Flag: 0)
Category Identifier (ci): Bridge (Id: 2)
jlusiardi commented 5 years ago

Hello tleegaard,

I assume you are using HomeKit Python 0.15.0?

The first discover and the pairing look great. What exactly do you mean with "the device is showing the temperature and humidity sensor, but not the CO2 sensor"? The output of python3 -m homekit.get_accessories -f velux -a velux seems to include a section for the carbon-dioxide sensor (which shows 0, which is strange):

2.14: >carbon-dioxide<
  2.15: Carbon Dioxide sensor () >name< [pr]
  2.16: 0 () >carbon-dioxide.detected< [pr,ev]
  2.17: 400.0 () >carbon-dioxide.level< [pr,ev]

Can you perform a python3 -m homekit.get_characteristic -f velux -a velux -c 2.16 --log DEBUG and see if the value changes?

Can you send me the result of python3 -m homekit.remove_pairing -f velux -a velux -i D3:4E:DB:1E:AE:43 --log DEBUG after you repaired the device?

Thanks for your report! The device seems to be the first bridge I met in the wild and I hope to fix it and get a shiny report for the list of supported devices (see the template).

tleegaard commented 5 years ago

Yes - I'm on 0.15.0 :)

In Home Assistant only the temperature and humidity sensors would show up - but maybe that is due to something in HA.

I also found out that I can unpair the gateway successfully with python3 -m homekit.remove_pairing -f velux -a velux. I have to leave out the -i parameter.

The carbon dioxide sensor is calibrating for ~10 hours after batteries are inserted - for now the value is 0 - I will try running this again later today: python3 -m homekit.get_characteristic -f velux -a velux -c 2.16 --log DEBUG

2019-07-31 07:29:17,224 ip_implementation.py:0416 DEBUG init session
2019-07-31 07:29:21,126 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytes'>) b'\xe8\xb1{\x96\xf6\x83J4DP\xa4\xf7\x99\x98\xb3>\xd3WM\xe8\xa8\x00\xf2\x18\x05\x8b&\x10RB-<'
]

2019-07-31 07:29:21,157 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0xe8b17b96f6834a344450a4f79998b33ed3574de8a800f218058b261052422d3c
]

2019-07-31 07:29:21,165 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0xe8b17b96f6834a344450a4f79998b33ed3574de8a800f218058b261052422d3c
]

2019-07-31 07:29:21,382 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0xab19492643f930ee17e55ca5e1b73b28c752a9e2b4d4e1abdd6d268fb47a4f04
  5: (101 bytes/<class 'bytearray'>) 0xe3f935d871917e21ba2e8471a03a8c7c683cf9d0b9d331cb8cd476f799b2b229969f3a3f440e67472604ca91a7bb714ed75a9bd13882419338703e95fa4a32954fdc48703f58fd3cb340e70359aed0cfc71e1591c3d491d895eb7474350696ccca19f378e7
]

2019-07-31 07:29:21,393 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0xab19492643f930ee17e55ca5e1b73b28c752a9e2b4d4e1abdd6d268fb47a4f04
  5: (101 bytes/<class 'bytearray'>) 0xe3f935d871917e21ba2e8471a03a8c7c683cf9d0b9d331cb8cd476f799b2b229969f3a3f440e67472604ca91a7bb714ed75a9bd13882419338703e95fa4a32954fdc48703f58fd3cb340e70359aed0cfc71e1591c3d491d895eb7474350696ccca19f378e7
]

2019-07-31 07:29:21,515 tlv.py:0117 DEBUG receiving [
  1: (17 bytes/<class 'bytearray'>) 0x44333a34453a44423a31453a41453a3433
  10: (64 bytes/<class 'bytearray'>) 0x0295250397bdd4726d637d2eacc18c7934b7a6e2c43f2e0d2262d58bd3eddeb5f6bdf552d1b30674049c65db2d0f85428e5e356165a53f5f76873c8fffe2b900
]

2019-07-31 07:29:21,626 tlv.py:0134 DEBUG sending [
  1: (36 bytes/<class 'bytes'>) b'4fadf0b1-80b8-46aa-8b1c-08f7cd3f3df3'
  10: (64 bytes/<class 'bytes'>) b'\x94\x18\xa5p\xfa\xe2r\x94\x02\xc0|`\xdd\xc3\xd1B\x88h\xf9\xab/\x06_\xfa\x0f\x90\xa8\x96\x11\xc4\xba\xc7\xf5\x93\x0e\xcb\\\x04F\xdd\xfb7=/\\Dc*/4.V?v}\xc7p6\x01\xb5W\xac\x94\x0b'
]

2019-07-31 07:29:21,842 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xa2d059aa9071302550466ad9659f06872afe475f128bf322b2a1c8dc73fb74bfb0e61d4a52df994cc568c84d18722de29edec6f0f4277a6bb7c49bb750de90b1551fa2726951b0e052701f1396c7f6bbc94673aa11936e5c5389b85db22216e914e253186cca962488a8a687d3f57d0018bb75208efb36e8
]

2019-07-31 07:29:21,854 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xa2d059aa9071302550466ad9659f06872afe475f128bf322b2a1c8dc73fb74bfb0e61d4a52df994cc568c84d18722de29edec6f0f4277a6bb7c49bb750de90b1551fa2726951b0e052701f1396c7f6bbc94673aa11936e5c5389b85db22216e914e253186cca962488a8a687d3f57d0018bb75208efb36e8
]

2019-07-31 07:29:21,872 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xa2d059aa9071302550466ad9659f06872afe475f128bf322b2a1c8dc73fb74bfb0e61d4a52df994cc568c84d18722de29edec6f0f4277a6bb7c49bb750de90b1551fa2726951b0e052701f1396c7f6bbc94673aa11936e5c5389b85db22216e914e253186cca962488a8a687d3f57d0018bb75208efb36e8
]

2019-07-31 07:29:21,995 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-31 07:29:22,007 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-31 07:29:22,032 ip_implementation.py:0443 DEBUG session established
2019-07-31 07:29:22,041 secure_http.py:0073 DEBUG handle request: b'GET /characteristics?id=2.16 HTTP/1.1\r\nHost: 192.168.1.157:5001\r\n\r\n'
{
    "2.16": {
        "value": 0
    }
}

python3 -m homekit.remove_pairing -f velux -a velux --log DEBUG (omitting the -i part)

2019-07-31 07:33:39,662 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  0: (1 bytes/<class 'bytearray'>) 0x04
  1: (36 bytes/<class 'bytes'>) b'4fadf0b1-80b8-46aa-8b1c-08f7cd3f3df3'
]

2019-07-31 07:33:39,694 ip_implementation.py:0416 DEBUG init session
2019-07-31 07:33:42,632 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytes'>) b'W\xed\x00\xbb\x13\xa8\xb6$\xaf:\x99Wa\xebY\xf8x@B\xa4\xa5\x8f\xae8\xd9=\xf1\x1b/Lq\x17'
]

2019-07-31 07:33:42,685 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0x57ed00bb13a8b624af3a995761eb59f8784042a4a58fae38d93df11b2f4c7117
]

2019-07-31 07:33:42,695 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0x57ed00bb13a8b624af3a995761eb59f8784042a4a58fae38d93df11b2f4c7117
]

2019-07-31 07:33:43,574 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0x4b819d15e0485fa8eabafecaa9667c77cd581e075c0707fb8beb8bf9d535bf4e
  5: (101 bytes/<class 'bytearray'>) 0x92f9b782dcf215ebe7965f461c8bd3950ba0d6d90f18730e3a63460abe255564b62e929b8de731533cfec9a600304eaed4bd1efe56896010a59798a428e1041f251b27f35633608b35e969f0a5a240cdf1f85c783402ea25be88ee79141076ecd98dca3358
]

2019-07-31 07:33:43,587 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0x4b819d15e0485fa8eabafecaa9667c77cd581e075c0707fb8beb8bf9d535bf4e
  5: (101 bytes/<class 'bytearray'>) 0x92f9b782dcf215ebe7965f461c8bd3950ba0d6d90f18730e3a63460abe255564b62e929b8de731533cfec9a600304eaed4bd1efe56896010a59798a428e1041f251b27f35633608b35e969f0a5a240cdf1f85c783402ea25be88ee79141076ecd98dca3358
]

2019-07-31 07:33:43,770 tlv.py:0117 DEBUG receiving [
  1: (17 bytes/<class 'bytearray'>) 0x44333a34453a44423a31453a41453a3433
  10: (64 bytes/<class 'bytearray'>) 0x56abf4a5d7c8a26d7071e88fbb31dc1735d5e72f009611f9cbe833e49a34799104e5ad147d9bb91b07e55a6aa75ff49415c406ce77c2698a2894d1dce7a60707
]

2019-07-31 07:33:44,003 tlv.py:0134 DEBUG sending [
  1: (36 bytes/<class 'bytes'>) b'4fadf0b1-80b8-46aa-8b1c-08f7cd3f3df3'
  10: (64 bytes/<class 'bytes'>) b'\xc9q\xf9\xefo#\xfb]mDw\x06\xe83\xb9ll>4,\xd1\xb18\x1bX\x16\x0f\x8bw\x1c8i5\xd9i\xa0#\x16\xe0w\x95\xa8\xeb\x98\xb2\xf5[\x81c\xb2\x1a\xdb\xb1\xc5}\x08\x0f\xeed\x16\x18\xfb\xb0\x03'
]

2019-07-31 07:33:44,234 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0x735c15df4f577813b9cba6b682c267cf92914d5f2bc7cad6e3b51c4a9f0c827526e912d4592d41cf8981d7db39ed88f92100922c4864fdd552c1c48b499bb1985fdeef722491bd2d58ea5610118dcda06e15be8777397882a882958f0b14671dabb9f91cf82f08d5dbe3e639c2534af5b50a83828a37f552
]

2019-07-31 07:33:44,251 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0x735c15df4f577813b9cba6b682c267cf92914d5f2bc7cad6e3b51c4a9f0c827526e912d4592d41cf8981d7db39ed88f92100922c4864fdd552c1c48b499bb1985fdeef722491bd2d58ea5610118dcda06e15be8777397882a882958f0b14671dabb9f91cf82f08d5dbe3e639c2534af5b50a83828a37f552
]

2019-07-31 07:33:44,261 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0x735c15df4f577813b9cba6b682c267cf92914d5f2bc7cad6e3b51c4a9f0c827526e912d4592d41cf8981d7db39ed88f92100922c4864fdd552c1c48b499bb1985fdeef722491bd2d58ea5610118dcda06e15be8777397882a882958f0b14671dabb9f91cf82f08d5dbe3e639c2534af5b50a83828a37f552
]

2019-07-31 07:33:44,369 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-31 07:33:44,380 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-31 07:33:44,395 ip_implementation.py:0443 DEBUG session established
2019-07-31 07:33:44,401 secure_http.py:0073 DEBUG handle request: b'POST /pairings HTTP/1.1\r\nHost: 192.168.1.157:5001\r\nContent-Type: application/hap+json\r\nContent-Length: 44\r\n\r\n\x06\x01\x01\x00\x01\x04\x01$4fadf0b1-80b8-46aa-8b1c-08f7cd3f3df3'
2019-07-31 07:33:45,129 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x02
]

2019-07-31 07:33:45,138 controller.py:0538 DEBUG response data: [[6, bytearray(b'\x02')]]
Pairing for "velux" was removed.
jlusiardi commented 5 years ago

Ok, there is a misunderstanding in the meaning of the -I parameter. I will opened a ticket to explain that better (#156).

The value of the CO2 sensor being constant 0 seems to be more an issue with the Accessory itself. Can you test with a iOS Device if the value changes there?

tleegaard commented 5 years ago

I'm not sure the 2.16 is the relevant value: python3 -m homekit.get_accessories -f velux -a velux

1.1: >accessory-information<
  1.2: VELUX gateway () >name< [pr]
  1.3: VELUX () >manufacturer< [pr]
  1.4: VELUX Gateway () >model< [pr]
  1.5: g37416e () >serial-number< [pr]
  1.6:  () >identify< [pw]
  1.7: 61 () >firmware.revision< [pr]
1.8: >service<
  1.9: 1.1.0 () >version< [pr]
2.1: >accessory-information<
  2.2: VELUX Sensor () >name< [pr]
  2.3: VELUX () >manufacturer< [pr]
  2.4: VELUX Sensor () >model< [pr]
  2.5: p0040fd () >serial-number< [pr]
  2.7:  () >identify< [pw]
  2.6: 16 () >firmware.revision< [pr]
2.8: >temperature<
  2.9: Temperature sensor () >name< [pr]
  2.10: 22.7 () >temperature.current< [pr,ev]
2.11: >humidity<
  2.12: Humidity sensor () >name< [pr]
  2.13: 68.0 () >relative-humidity.current< [pr,ev]
2.14: >carbon-dioxide<
  2.15: Carbon Dioxide sensor () >name< [pr]
  2.16: 0 () >carbon-dioxide.detected< [pr,ev]
  2.17: 903.0 () >carbon-dioxide.level< [pr,ev]

903 (2.17) is the value shown in the Velux app.

python3 -m homekit.get_characteristic -f velux -a velux -c 2.17 --log DEBUG

2019-07-31 12:22:04,096 ip_implementation.py:0416 DEBUG init session
2019-07-31 12:22:06,933 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytes'>) b'\x9e\xe0\x0f\xd2\xc9\x0e\xe7\xc4f\x03t\x06\x1d()\xef\x158\xfb\x95\x02\xb2!6\x9cmTn\xde\xe45|'
]

2019-07-31 12:22:06,960 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0x9ee00fd2c90ee7c4660374061d2829ef1538fb9502b221369c6d546edee4357c
]

2019-07-31 12:22:06,969 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x01
  3: (32 bytes/<class 'bytearray'>) 0x9ee00fd2c90ee7c4660374061d2829ef1538fb9502b221369c6d546edee4357c
]

2019-07-31 12:22:07,546 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0xd7ea58a92eb021f849cf8352a9f06af2afc4348175399759e211be2af81ca87d
  5: (101 bytes/<class 'bytearray'>) 0x095ad9eae8838b996880fb9c2a61ef7119de429abae8b6dbf7902ebcc531137c7f0ff0c8981c96c18398f92b22d29e2a9605c6da098060bc1e352803d9cf2d8afb668a91ccf594c5857f0844568fee74765cc8d4422c1e41334c9799900daba15e1fe6a425
]

2019-07-31 12:22:07,556 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x02
  3: (32 bytes/<class 'bytearray'>) 0xd7ea58a92eb021f849cf8352a9f06af2afc4348175399759e211be2af81ca87d
  5: (101 bytes/<class 'bytearray'>) 0x095ad9eae8838b996880fb9c2a61ef7119de429abae8b6dbf7902ebcc531137c7f0ff0c8981c96c18398f92b22d29e2a9605c6da098060bc1e352803d9cf2d8afb668a91ccf594c5857f0844568fee74765cc8d4422c1e41334c9799900daba15e1fe6a425
]

2019-07-31 12:22:07,676 tlv.py:0117 DEBUG receiving [
  1: (17 bytes/<class 'bytearray'>) 0x44333a34453a44423a31453a41453a3433
  10: (64 bytes/<class 'bytearray'>) 0xc80ef91969c0106ec4c6ca991c722c2e0c819655eefde5d69d23d66718a6bf1dd610be7901a0aabf27eaefece7b14c7a19f9eea86f4c6dbc7fad03598927cc08
]

2019-07-31 12:22:07,789 tlv.py:0134 DEBUG sending [
  1: (36 bytes/<class 'bytes'>) b'5c818b22-5fbd-4f4a-a094-cb736ef53eeb'
  10: (64 bytes/<class 'bytes'>) b'\xee\x91\x8f\x1ax>\x02zI/\r^\xe5\xbf\xc7C\xf0\x95?\x8f#W\x1a\xf3\xe2\xa7\x83j\xae\xcfh\xa2(\xa7\xcd\x06\xac\x04\x12\x80|w\xc2p\xbbT:8\x1fl_\xe9\x81xZ\xa1\xeaq\xf8\x89i\xcf\x9c\x04'
]

2019-07-31 12:22:07,902 tlv.py:0134 DEBUG sending [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xb7a43a000bef4819de462c4a7f96c1df7805363b1c913f41af14c2ba1ceedcd702439b856aed965df79fd66f3e13c4cb6592ea91828900c8f1677a9ad034a9be4b5521590ff88d43676a35dc8306c6d419f7e65e70e426454483e9081da22dddcaea26aa2607280490d425d8bd74157c9641369e059fb7b1
]

2019-07-31 12:22:07,914 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xb7a43a000bef4819de462c4a7f96c1df7805363b1c913f41af14c2ba1ceedcd702439b856aed965df79fd66f3e13c4cb6592ea91828900c8f1677a9ad034a9be4b5521590ff88d43676a35dc8306c6d419f7e65e70e426454483e9081da22dddcaea26aa2607280490d425d8bd74157c9641369e059fb7b1
]

2019-07-31 12:22:07,925 __init__.py:0075 DEBUG write message: [
  6: (1 bytes/<class 'bytearray'>) 0x03
  5: (120 bytes/<class 'bytearray'>) 0xb7a43a000bef4819de462c4a7f96c1df7805363b1c913f41af14c2ba1ceedcd702439b856aed965df79fd66f3e13c4cb6592ea91828900c8f1677a9ad034a9be4b5521590ff88d43676a35dc8306c6d419f7e65e70e426454483e9081da22dddcaea26aa2607280490d425d8bd74157c9641369e059fb7b1
]

2019-07-31 12:22:08,032 tlv.py:0117 DEBUG receiving [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-31 12:22:08,042 __init__.py:0082 DEBUG response: [
  6: (1 bytes/<class 'bytearray'>) 0x04
]

2019-07-31 12:22:08,057 ip_implementation.py:0443 DEBUG session established
2019-07-31 12:22:08,064 secure_http.py:0073 DEBUG handle request: b'GET /characteristics?id=2.17 HTTP/1.1\r\nHost: 192.168.1.157:5001\r\n\r\n'
{
    "2.17": {
        "value": 921.0
    }
}
jlusiardi commented 5 years ago

Ah so carbon-dioxide.level is the current measurement and carbon-dioxide.detected might be if it is over a threshold?

tleegaard commented 5 years ago

That could probably be the case - I haven't seen the carbon-dioxide.detected value change though :-)

Jc2k commented 5 years ago

We don't have a Home Assistant entity to map HomeKit CO2 sensors to to HomeAssistant sensors, i'm not sure that there is actually any problem on the homekit_python side.

jlusiardi commented 5 years ago

Hey @tleegaard, I"d love to have a PR from you with a filled Template. What do you think?

tleegaard commented 5 years ago

Absolutely! For now I only have the gateway and the climate sensor up and running. But when the motorized windows are installed I will fill out the template :-)

With help from @Jc2k I have got the CO2 sensor available in Home Assistant now: Skærmbillede 2019-07-31 kl  22 28 15

jlusiardi commented 5 years ago

Thats cool!

tleegaard commented 5 years ago

@jlusiardi --> https://github.com/jlusiardi/homekit_python/pull/157