Apollon77 / hap-controller-node

Node.js library to implement a HAP (HomeKit) controller
Mozilla Public License 2.0
55 stars 15 forks source link

Pairing with Somfy Connectivity Kit fails #187

Closed CBismark closed 1 year ago

CBismark commented 1 year ago

First of all - thanks for your great library. I can finally control my tados completely local through the homekit protocol, but with my own openHAB instance - works great!

Now to my problem: When I try to pair my Somfy Connectivity Kit for controlling of rollershutters, the pairing process fails. Apparently the step parsePairSetupM4 fails. I attached the debug output:

The call was

const ipClientSomfy = new HttpClient('67:D7:70:55:D3:25', '192.168.178.24', 31988); ipClientSomfy.pairSetup(SomfyHomekitCode).then(() => { console.log(JSON.stringify(ipClientSomfy.getLongTermData(), null, 2)); }).catch((e) => console.error(e));

The homekit code is correct, I triple-checked. Debug output:

hap-controller:tlv Add 1 bytes for tag 6: 01 +0ms hap-controller:tlv Add 1 bytes for tag 0: 01 +4ms hap-controller:http-connection 192.168.178.24:31988 POST /pair-setup 060101000101 (application/pairing+tlv8) +0ms hap-controller:http-connection 192.168.178.24:31988 Response 200 with 409 byte data +467ms hap-controller:tlv Read 1 bytes for tag 6: 02 +473ms hap-controller:tlv Read 255 bytes for tag 3: 23ceae4910f7d5ea6d82fc0e41af04e60c595b0850dd39fafeabe95c339d64dfb0f838209bd505d142c0950f4e3cb2926cc66941463509e5fb3ebadc0dd82b2380ff847a9bd4c1651cab4305e2946389187b260115d87802267c5a4b7baa0c10cd6d52947f0e0682033c59ff67170539bf7ef3bd815b699580dae7f44a9d07424e77b8c6c4dba2337212368972175b875abf1574fdac0c4224c8218a3905451ef9a98bc38500f986c8c4a6e3ea2aa0940880dade9d3c745ffeb509249a3912c0f8df103d9326ebeb48df6f4edabbf2f4d1303f0f38902b35ba09c9b47d9c63875812cca8f73c319260a70ec307da2bd6c09adc908a4538918aaa21280d2ce5 +0ms hap-controller:tlv Read 129 bytes for tag 3: 2cf11ca507ebdfc2c566155ba6e98c6322688700c70768a35311efe84256c7e3796d7fffb06283ac9e7319b4e1cd038dbe28860c47f43928ccc97d244c742b2d97139f39679f500e58ecc3b2c4e970966cbb18f66865749d36e8f501ee29953c9573f08941ad6272a639876159fb3f71fd9aa0145a92c33f1afbad538187f0346c +1ms hap-controller:tlv Read 16 bytes for tag 2: d26f20dfcca29197a3806faf90489109 +0ms hap-controller:tlv Add 1 bytes for tag 6: 03 +791ms hap-controller:tlv Add 255 bytes for tag 3: 33011db0f6085cb499604e8aac24aea21aec299725404d3521dbf5a1acc8fb6851fa3e84441384ca3c154a552bedef09e2e25b9c80117aa02d5a2b4d5f6eaeec3e0c0ad1ced91c632765d6b1949422094745028bd4939e1b8086b2cb09dd3cf1d9f242b56bdffcbc241a0be2968b14dfe95bb1df2f825c730d270a91ab89f0f84678524bbdeb03b23c8b3390a16b7b6cce43315f42c29d36525edc91e44aabf0c4c5f23763275bd1714f87b58c515363edb1f0cb51824216533ea8a5eae0825e31c62272f2f96285da721679abe8fc37221d285697eed932fd0e2b42bd0fe712360df3b28b66885ab3cb9d4469422f9048af8e8239e5e12277828b88adc4eb +1ms hap-controller:tlv Add 129 bytes for tag 3: 25bdf7f77f18ac6e9b64d9876aa56520f0e28c41d127c7ae97c5331fef6394a047e35155fc063572653057ff47ceb4a75639bb3050c3b75d2e1258467181d18f948d0bf5a12507fd8d9fff7242585019d212016bdb6f8255b31600f98ea0c4eb7e7951aea8d7910b109833e999e1e69491086166d88d8e39a656f929d829b54f1a +0ms hap-controller:tlv Add 64 bytes for tag 4: 3b5506772dd62b3764ba8a9a2df712e58fc55661d449400cd5ec2554b7490197686b14bbe868b33adfa09aeca2252386ab2b674c51bb473d8e50da10e4540ad2 +1ms hap-controller:http-connection 192.168.178.24:31988 POST /pair-setup 06010303ff33011db0f6085cb499604e8aac24aea21aec299725404d3521dbf5a1acc8fb6851fa3e84441384ca3c154a552bedef09e2e25b9c80117aa02d5a2b4d5f6eaeec3e0c0ad1ced91c632765d6b1949422094745028bd4939e1b8086b2cb09dd3cf1d9f242b56bdffcbc241a0be2968b14dfe95bb1df2f825c730d270a91ab89f0f84678524bbdeb03b23c8b3390a16b7b6cce43315f42c29d36525edc91e44aabf0c4c5f23763275bd1714f87b58c515363edb1f0cb51824216533ea8a5eae0825e31c62272f2f96285da721679abe8fc37221d285697eed932fd0e2b42bd0fe712360df3b28b66885ab3cb9d4469422f9048af8e8239e5e12277828b88adc4eb038125bdf7f77f18ac6e9b64d9876aa56520f0e28c41d127c7ae97c5331fef6394a047e35155fc063572653057ff47ceb4a75639bb3050c3b75d2e1258467181d18f948d0bf5a12507fd8d9fff7242585019d212016bdb6f8255b31600f98ea0c4eb7e7951aea8d7910b109833e999e1e69491086166d88d8e39a656f929d829b54f1a04403b5506772dd62b3764ba8a9a2df712e58fc55661d449400cd5ec2554b7490197686b14bbe868b33adfa09aeca2252386ab2b674c51bb473d8e50da10e4540ad2 (application/pairing+tlv8) +796ms hap-controller:http-connection 192.168.178.24:31988 Response 200 with 6 byte data +621ms hap-controller:tlv Read 1 bytes for tag 6: 04 +622ms hap-controller:tlv Read 1 bytes for tag 7: 02 +0ms HomekitControllerError: M4: Error: 2 at PairingProtocol.parsePairSetupM4 (/home/openhabian/node_modules/hap-controller/lib/protocol/pairing-protocol.js:276:19) at HttpClient.finishPairing (/home/openhabian/node_modules/hap-controller/lib/transport/ip/http-client.js:198:40) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async HttpClient.pairSetup (/home/openhabian/node_modules/hap-controller/lib/transport/ip/http-client.js:223:9) { statusCode: 2 }

Adding the device to an iPad in Apple Home works, so it shouldn't be a basic problem with the connectivity kit.

Do you have any ideas?

Kind Regards,

Christoph

Apollon77 commented 1 year ago

Can you please use the example code and especially check the results of the pairing mode? I talk about this https://github.com/Apollon77/hap-controller-node/blob/main/examples/ip/pair-setup.js#L12 Please add this and try again. And please provide a full debug log output

NebzHB commented 1 year ago

My users (50+) are connecting without issues to somfy connectivity kit and it's working fine (except when this one have poor wifi, this one disconnects alot !!!)

the second parameter for the pairing should be the pairmethod you get during discovery.

const pairMethod = await discovery.getPairMethod(mdns);
const client = new HttpClient(id, address, port, {usePersistentConnections: false});
await client.pairSetup(pin,pairMethod);
CBismark commented 1 year ago

Well I was just stupid and didn't realize I need to pass the pairMethod parameter, probably, because the pairing with tado worked with the default values. I could now pair with the somfy connectivity kit perfectly fine. The only problem I now have is: when checking for the accessories, I can only see the one rollershutter with position feedback. The other two, which I can control through tahoma, but cannot give back current position data, are not visible in homekit. I also saw this when connecting with homekit through an iPad. Does anybody have a (probably somfy-specific) solution for this?

Kind Regards

Christoph

EDIT: Nevermind, I just read that somfy RTS is not compatible with homekit. And to think the shutters were installed only last year with such an old fucking technology.

NebzHB commented 1 year ago

Nope, they don't sent RTS into homekit.

You're lucky for tado, I can't make it work... https://github.com/Apollon77/hap-controller-node/issues/61