NorthernMan54 / homebridge-alexa

Expose your homebridge controlled devices to Amazon Alexa.
https://www.homebridge.ca
442 stars 77 forks source link

Homebridge auth failed, invalid PIN %s', pin, deviceID, body, err, response.body #564

Closed sigb1n closed 1 year ago

sigb1n commented 1 year ago

Getting this error. I confirmed PIN is valid though.

NorthernMan54 commented 1 year ago

Can you enable the debug option in the plugin config, restart homebridge, and share the log around the error. it should give more details on the error.

sigb1n commented 1 year ago

Here you go.

[1/11/2023, 10:56:32 AM] [Alexa] alexaDiscovery - returned 12 devices 2023-01-11T02:56:32.195Z alexa:Messages INFO: DeviceList - The following devices are allow => [ 'Front Door' ] 2023-01-11T02:56:32.196Z alexa:Messages INFO: DeviceList - allow => Front Door 2023-01-11T02:56:32.196Z alexa:Messages INFO: DeviceList - allow => Front Door 2023-01-11T02:56:32.196Z alexa:Messages INFO: DeviceList - allow => Front Door 2023-01-11T02:56:32.196Z alexa:Messages INFO: DeviceList - allow => Front Door 2023-01-11T02:56:32.196Z alexaActions Event Register 0E:D4:77:B2:55:2C -> { characteristics: [ { aid: 3, iid: 11, ev: true }, { aid: 3, iid: 117, ev: true } ] } 2023-01-11T02:56:32.199Z alexaActions Event Register 0E:C7:4F:EF:70:75 -> { characteristics: [ { aid: 2, iid: 11, ev: true }, { aid: 2, iid: 117, ev: true } ] }

/homebridge/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:458 debug('Homebridge auth failed, invalid PIN %s', pin, deviceID, body, err, response.body); ^ ReferenceError: pin is not defined at HAPNodeJSClient. (/homebridge/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:458:61) at eventedHttpClient.f [as callback] (/homebridge/node_modules/homebridge-alexa/node_modules/once/once.js:25:25) at Socket. (/homebridge/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:71:16) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

NorthernMan54 commented 1 year ago

Tks for reporting this

Looking at the log, it is failing when attempting to register a device for routines/events on the homebridge instance '0E:C7:4F:EF:70:75', and it is failing with an authentication error. The error handler for the authentication error is having an issue and is causing the larger error.

I will need to do a patch to fix the error message handler, give me about 18 hours to post a fix.

As a workaround, you can disable routines in your config and this code will not be executed.

Are you sure about the pin being correct ? This is against instance 0E:C7:4F:EF:70:75

sigb1n commented 1 year ago

Thanks. Will do. Yes. PIN is 100% correct. It's been working before.

NorthernMan54 commented 1 year ago

If you update to the latest version the reference error mentioned in the original error should be resolved, and it should just indicate invalid PIN for that instance ( when routines are enabled ).

Looking at the log, do you have child bridges or multiple instances of homebridge running ? Do they all have the same pin ?

sigb1n commented 1 year ago

All good. Working now. Thanks!