ebaauw / homebridge-nb

Homebridge plugin for Nuki Bridge
Apache License 2.0
52 stars 3 forks source link

Siri-issued commands receive different characteristics #26

Closed crouchingtiger closed 3 years ago

crouchingtiger commented 3 years ago

I can no longer use my locks via Siri. It will react that it worked, but it doesn't force the state change. I sifted through the library, assume the issue is in the equality check at https://github.com/ebaauw/homebridge-nb/blob/ffd358c832d481208954427ba4e2ecf70c74d4b9/lib/NbService.js#L108, but I'm beginning to think this is a Homebridge issue.

homebridge v1.3.1 node v14.16.0 homebridge-nb v1.0.8

From Siri:

[3/4/2021, 9:55:01 AM] [Nuki] Haustür: Lock Target State changed from 1 to **false**
[3/4/2021, 9:55:02 AM] [Nuki] Haustür: set Lock Target State from **false** to 1

From tapping on the lock (Nuki Opener) in Home:

[3/4/2021, 9:55:05 AM] [Nuki] Haustür: Lock Target State changed from 1 to **0**
[3/4/2021, 9:55:05 AM] [Nuki] Nuki_Bridge_XXXXXXXX: request 49: GET /lockAction?nukiId=XXXXXXXX&deviceType=2&action=3
[3/4/2021, 9:55:10 AM] [Nuki] Nuki_Bridge_XXXXXXXX: request 49: 200 OK
[3/4/2021, 9:55:10 AM] [Nuki] Haustür: set Lock Current State from 1 to **0**
[3/4/2021, 9:55:10 AM] [Nuki] Haustür: set Lock Current State from **0** to 1

Edit: Rolling back to Homebridge v1.2.5 before the characteristic changes has resolved the issue for now.

ebaauw commented 3 years ago

Looks like an issue with Siri, sending false instead of 0. They are messing with HAP-NodeJS, in the area of validating characteristic values. Not sure if that applies here, but could have caused a recent change. You might try an older version of Homebridge.

I couldn’t get Siri to buzz me in recently, but sort of blamed that on Wifi issues. Maybe it’s the same issue; I need to investigate.

crouchingtiger commented 3 years ago

@ebaauw Yes I edited above to say I rolled back to 1.2.5 so I can at least get my doors opening again. I've lost my HomePod chime option recently too, which I'm trying to investigate.

I took a look for changes at https://github.com/homebridge/HAP-NodeJS/blob/fddb0af56683be8b527610f5b318d46fd26368b9/src/lib/definitions/CharacteristicDefinitions.ts#L1923 but imagine the issue lays elsewhere in wrapping / sanitising the output. I've learnt to never rely on API data, even (or especially) if it comes from Apple / Siri / HomeKit devs ;)

I'll mark this as closed for now, I've opened up https://github.com/homebridge/homebridge/issues/2855 to track it there (since it seemingly affects the other Nuki plugin).

ebaauw commented 3 years ago

So with Homebridge v1.2.5, the log shows 0 instead of false when opening with Siri?

crouchingtiger commented 3 years ago

I posted the log differences at https://github.com/homebridge/homebridge/issues/2855#issuecomment-790536069 with the HAP-NodeJS:Accessory debug flag. You can see HAP-NodeJS:Accessory processes the characteristic change differently between Homebridge versions and Siri/Home app.

crouchingtiger commented 3 years ago

Issue is now resolved in the latest Homebridge beta.