Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: M2: Accessory LTPK not yet set #3

Open
MattB1981 opened this issue Nov 18, 2022 · 25 comments
Open

Error: M2: Accessory LTPK not yet set #3

MattB1981 opened this issue Nov 18, 2022 · 25 comments
Labels
bug Something isn't working

Comments

@MattB1981
Copy link

I've tried two different accessories and gotten this error for both of them. One was a lamp and the other is a tcl TV.
This is the output after I enter the pin.

/usr/lib/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415
throw new Error('M2: Accessory LTPK not yet set');
^

Error: M2: Accessory LTPK not yet set
at PairingProtocol.parsePairVerifyM2 (/usr/lib/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415:19)
at /usr/lib/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/transport/ip/http-client.js:237:40
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

@MattB1981 MattB1981 changed the title throw new Error('M2: Accessory LTPK not yet set') oops Nov 18, 2022
@MattB1981 MattB1981 changed the title oops oops - please delete, i posted on the wrong plugin Nov 18, 2022
@MattB1981 MattB1981 reopened this Nov 18, 2022
@MattB1981 MattB1981 changed the title oops - please delete, i posted on the wrong plugin Error: M2: Accessory LTPK not yet set Nov 18, 2022
@masonjmiller
Copy link

I'm getting this error as well.

/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415
            throw new Error('M2: Accessory LTPK not yet set');
                  ^

Error: M2: Accessory LTPK not yet set
    at PairingProtocol.parsePairVerifyM2 (/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415:19)
    at /var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/transport/ip/http-client.js:237:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.12.1

@sabya14
Copy link

sabya14 commented Dec 9, 2022

Any update

@minamoanes
Copy link
Owner

Thanks @MattB1981, @masonjmiller & @sabya14 for reporting the issue!
I'm now able to reproduce it, will update you as soon as it's fixed;)

@minamoanes minamoanes added the bug Something isn't working label Dec 13, 2022
@BeppeTemp
Copy link

I have the same issues when I try to connect my nanoleaf shapes

@fate8383
Copy link

I have the same error

@minamoanes
Copy link
Owner

Version Beta 0.2.0 is now Published! ✅
Please test it and confirm if the issue is fixed (make sure that you switch to the Beta ver. in Homebridge UI)
Once you confirm that the fix is working, let me know and I'll publish it ;)

@MattB1981, @masonjmiller, @sabya14, @BeppeTemp, @fate8383

@fate8383
Copy link

fate8383 commented Feb 7, 2023

tested now, and I am getting this error...and your solution is very dangerous as I have many items under aquara hub and removing from home app will create more problems for me. How to tackle this without removing from home?

if you get the error M2: Error: 6:

Add the device to your Homekit
Once the device is added and connected to your Wifi network
Remove device from your Home
Device should still be connected to your Wifi (check it from your router's connected clients)
Run the homekitPair command in your Homebridge and enter the pin
And voila, you get the JSON

@minamoanes
Copy link
Owner

minamoanes commented Feb 7, 2023

@fate8383 Thanks for testing!
That error basically means that your accessory is already paired, however if it was already paired with Homebridge using this plugin (or an earlier version), then there is no need to pair it again, assuming that you already added the necessary information to the config file, as explained in the documentation: https://github.com/minamoanes/homebridge-homekit-control#example

@fate8383
Copy link

fate8383 commented Feb 7, 2023

Not really, yes they are aded to home app, but not to homebridge before or now. I want to add them to homebridge this is the whole point of using this plugin. How can I do that? I don't want to remove them from home app as suggested in the solution, I just want to add them to homebridge that's all.

@minamoanes
Copy link
Owner

minamoanes commented Feb 8, 2023

@fate8383 HomeKit accessories are designed to be paired only to one device at a time, if you want to pair them to a new device (in this case to Homebridge using this plugin) it has to be unpaired first to be able to pair it to the new device.
So unfortunately you have to follow the steps that you've already shared above to have it paired to Homebridge and since I assume that Homebridge is already paired with your HomeKit, your devices should be re-added to your HomeKit app but now through Homebridge instead.

I'm doing that with all my HomeKit devices to be able to control them using other plugins (f.e. Google Home) alongside HomeKit ;)

@Viskuh
Copy link

Viskuh commented Feb 19, 2023

Hi minamoanes,

Clearly I'm doing something wrong here. I'm getting the error aswell even after deleting the HomeKit-devices.
What I did:

Clean image > updated and installed the plugin:
Scanned the QR-code on the homepage of homebridge.local to add the bridge via my iPhone.
Resetted the HomeKit-device.
Added the HomeKit-device via my iPhone (it's pingable now).
Deleted the HomeKit-device in my Home via my iPhone (still pingable).
Scanned for HomeKit-devices using "homekitPair" and found the right one.
Added with the right code.

Error message:
/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415
throw new Error('M2: Accessory LTPK not yet set');
^

Error: M2: Accessory LTPK not yet set
at PairingProtocol.parsePairVerifyM2 (/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415:19)
at /var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/transport/ip/http-client.js:237:40
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.12.1

Can you tell me what I'm doing wrong here?
Thank you for your time!

Cheers,
Viskuh

@minamoanes
Copy link
Owner

minamoanes commented Feb 19, 2023

Hey @Viskuh,
This generally means that the HomeKit device wasn't paired correctly when it was first paired using the Home App on your iOS device.
Are you experiencing this issue with all of your HomeKit accessories? If so, could you please provide me with a list of these accessories? This would help me investigate the issue more thoroughly.
Thank you for sharing your issue!

@minamoanes
Copy link
Owner

@Viskuh Could you try disconnecting your HomeKit accessory from the power source and then reconnecting it? Sometimes, even after being removed, the accessory can remain connected to your Home App, which can cause this plugin to fail in obtaining the Accessory LTPK.

@Viskuh
Copy link

Viskuh commented Feb 22, 2023

Hey @Viskuh, This generally means that the HomeKit device wasn't paired correctly when it was first paired using the Home App on your iOS device. Are you experiencing this issue with all of your HomeKit accessories? If so, could you please provide me with a list of these accessories? This would help me investigate the issue more thoroughly. Thank you for sharing your issue!

Hi minamoanes,
I've got the issue with all my HomeKit devices. I only have 3.
They're all from the brand Koogeek though.
Koogeek - LS1
Koogeek - LB1
Koogeek - P1EU

Btw; disconnecting the accessory from the power source and reconnect it doesn't have effect. It was worth to try :).

If you need anything to troubleshoot further don't hesitate to contact me.

Viskuh

@Schluesselmeister
Copy link

Schluesselmeister commented Apr 2, 2023

Hi,
I have the same issue using version 0.2.1 and a Netatmo CO2-sensor.
I have tried to reset, reconnect, remove from Home etc. but nothing is working.
Is there anything I can do to get around the error?
Regards,
Sven

@cablesandcoffee
Copy link

cablesandcoffee commented May 14, 2023

Hello! I'm also having the same issue with version 0.2.1. I'm trying to pair the Aqara FP2.
It's my only Homekit device and first time adding something to Homekit. Added it to Aqara app which automatically added it to Homekit. I first got the M2: Error: 6 cause I forgot to remove it from Homekit. Then removed it and got this:

/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415
            throw new Error('M2: Accessory LTPK not yet set');
                  ^

Error: M2: Accessory LTPK not yet set
    at PairingProtocol.parsePairVerifyM2 (/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415:19)
    at /var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/transport/ip/http-client.js:239:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.13.0

Also tried rebooting the device but same result after.

I was super excited to try this plugin and see if I could get the FP2 into homebridge and do some cool stuff with it from there.
Appreciate all the help and I am happy to help in any way possible!

@cablesandcoffee
Copy link

cablesandcoffee commented May 14, 2023

I want to add this as well. Probably nothing but it looks a bit weird at least.

So I get this in the terminal:

Enter PIN for Presence-Sensor-FP2-C1CD (XXX-XX-XXX or XXXX-XXXX or XXXXXXXX):

The pin for that device is in the format XXXXXXXX

I put in for example 12341234

Terminal outputs:

Pin: 123-41-234

Guessing this is not the problem since the error does not talk about wrong code but just just thought it wouldn't do no harm mentioning it.

Edit: I tried putting in the wrong pin now as well and I get the same error code as before: Accessory LTPK not yet set

@ryanmaule
Copy link

I'm also getting this error in 0.2.1.

I follow the instructions in https://github.com/minamoanes/homebridge-homekit-control#how-to-fix-known-errors

`/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415
throw new Error('M2: Accessory LTPK not yet set');
^

Error: M2: Accessory LTPK not yet set
at PairingProtocol.parsePairVerifyM2 (/var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/protocol/pairing-protocol.js:415:19)
at /var/lib/homebridge/node_modules/homebridge-homekit-control/node_modules/hap-controller/lib/transport/ip/http-client.js:239:40
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)`

I see above you said this means the device wasn't paired to Homekit properly the originally, but from what I can tell it was working perfectly before I removed from Home.

In my case, the device is a Bridge coming from Homespan https://github.com/HomeSpan/HomeSpan

@vmummer
Copy link

vmummer commented Sep 6, 2023

There must be an issue with the homekitPair

as homekit app from homebridge-homekit-controller does pull the values correctly.

Enter PIN for Garage Opener_D9481A (XXX-XX-XXX): 826-68-266
Enter service data file name for saving: 34-B5-EB-D2-85-35.json
{
service: {
id: '34:B5:EB:D2:85:35',
name: 'Garage Opener_D9481A',
address: '192.168.101.192',
port: 5556
},
pairingData: {
AccessoryPairingID: '33343a42353a45423a44323a38353a3335',
AccessoryLTPK: '9e4a9587d0629b45c58c12c8af28c0f26887eda038cee2d33cfb99e072c4c9e6',
iOSDevicePairingID: '38633864373466632d353863332d343861612d393737392d353037383761623664313264',
iOSDeviceLTSK: 'a06758373273aa04ddb67b797f55b80e750694cb0131cb028caba3021bfccd148388494cb939aa3836186ce648c118b794b3108068e6dcd7499b5c0acaba5015',
iOSDeviceLTPK: '8388494cb939aa3836186ce648c118b794b3108068e6dcd7499b5c0acaba5015'
},
accessories: { accessories: [ [Object] ] }

@bytestorm
Copy link

Got the same issue while trying to pair my ecobee.

I have no idea what the following piece of code does in homekitPair, but removing it solved the issue for me since I haven't found anything like that in hap-controller IP pairing example.

          ipClient.setCharacteristics({
            "2.10": true,
            iid: service.id,
          });

...would be great to know what that is, though =)

@minamoanes
Copy link
Owner

@bytestorm thanks for your feedback and support.

I've released a beta version called 0.2.4-beta.1 with your suggested code removed, feel free to test it and let me know how it goes.

The purpose of this code was an attempt to fix a warning with the Homekit accessories related to characteristics, but then I forgot to remove it somehow, feel free to read more about that here:

@bytestorm
Copy link

better now =) ...but (sorry, forgot to mention that I had this issue too):

Enter PIN for EcoBee (XXX-XX-XXX or XXXX-XXXX or XXXXXXXX): 42030008
Pin: 420-30-008
/homebridge/node_modules/homebridge-homekit-control/cli.js:237
  const data = await saveServiceData(service, client);
                                              ^

ReferenceError: client is not defined
    at /homebridge/node_modules/homebridge-homekit-control/cli.js:237:47
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.13.0

so, in order to fix this:

  try {
    const client = await pairService(service);

    const data = await saveServiceData(service, client);

    console.log("\n\n");
    console.log("Paired with Service:");
    console.log(data);

    process.exit();
  } catch (error) {
    errorCallback(error);
  }

sorry, I'm too lazy to create a PR since I'm currently hacking my way through to make "hey siri" work on that ecobee while having HB control over it

@minamoanes
Copy link
Owner

@bytestorm That absolutely makes sense ;) thank you once again!
Publish as beta 0.2.4-beta.2.

Let me know how it goes ;)

@bytestorm
Copy link

works like a charm =)

@minamoanes
Copy link
Owner

v0.2.4 is now published 🚀

Please test it and let me know if we should close this issue already...
@MattB1981, @masonjmiller, @sabya14, @BeppeTemp, @fate8383, @Viskuh, @Schluesselmeister, @cablesandcoffee, @ryanmaule, @vmummer.

Thanks everyone for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests