Repository navigation
Description
Summary
An HKSV accessory with category_id: doorbell cannot be added in the Apple Home app. Pairing itself succeeds, the Home app reads /accessories, then closes the connection and shows "Unable to Add Accessory: Accessory out of compliance". The same stream pairs and records fine as a plain HKSV camera.
Environment
- go2rtc
1.9.14+dev.6361dcb(Home Assistant add-on "go2rtc (dev)") - Apple Home app on iPhone (iOS version: FILL IN), Apple TV 4K as home hub
- Source: 2N IP Solo intercom
Config
homekit:
front_gate:
name: Front Gate
category_id: doorbell
hksv: true
motion: api
speaker: true
device_id: frontgate2Also tried with motion: continuous and motion: detect, and without device_id. Same result each time.
What happens (trace log)
[homekit] new server: {"name":"Front Gate","port":1984,"info":{"c#":"1","ci":"18","ff":"0","id":"2D:8F:71:D2:74:65","md":"go2rtc/1.9.14+dev.6361dcb","pv":"1.1","s#":"1","sf":"1","sh":"JBNJ2w=="}}
15:20:14.740 [api] POST /pair-setup 192.168.1.5:51067
15:20:23.765 [hksv] add pair id=... perm=1 stream=front_gate
15:20:23.818 [api] POST /pair-verify 192.168.1.5:51068
15:20:23.822 [hksv] new conn stream=front_gate
15:20:23.828 [hksv] GET /accessories stream=front_gate
15:20:23.845 [hksv] connection closed stream=front_gate
The Home app drops the connection 17 ms after receiving the accessory JSON, so it is rejecting the accessory description, not the pairing.
What looks wrong in the accessory JSON
The Doorbell service is returned as:
{"type":"121","iid":286396416,"characteristics":[
{"iid":286396531,"type":"73","format":"uint8","perms":["ev","pr"]}
]}Two things stand out when compared with the camera accessory on the same server, which pairs fine:
- Programmable Switch Event (
73) has novaluekey. It is the only characteristic withprpermission in the whole accessory that has no value. Other implementations return"value": nullfor it, which is what the HAP spec asks for on read. - No service is marked
primary. Other implementations mark the Doorbell service as the primary service for a video doorbell.
Everything else in the accessory is identical to the working camera, apart from the added Speaker (113) service, and that paired fine on this stream when it was a camera.
I have not confirmed which of the two the Home app objects to. There are no duplicate iids.
Suggested fix
- Serialize characteristic
73with an explicit"value": null. - Mark the Doorbell service as
"primary": true.
Note
After the failed attempt go2rtc keeps the pairing it saved (pairings: is written to the config), so the accessory stops advertising as unpaired and has to be cleared by hand before trying again.
Activity
emmanuel-blin commentedon Oct 25, 2026
I hit the same "Accessory out of compliance" error with
hksv: trueon a doorbell, and a two-line change fixed it for me.Setup
dev), running as the go2rtc binary inside Frigate 0.18.2category_id: doorbell,speaker: true,hksv: true,motion: apiCause
In
ServiceDoorbell()(pkg/hap/camera/services_hksv.go), characteristic73(Programmable Switch Event) hasValue: nil.hap.Character.Valueisjson:"value,omitempty", so the characteristic goes out with novaluekey at all. For this characteristic HAP expects the key to be present, withnullon reads. Also, none of the HKSV doorbell's services is marked primary. HAP-NodeJS-based doorbells make the Doorbell service primary.Change
func ServiceDoorbell() *hap.Service { return &hap.Service{ Type: "121", Primary: true, // added Characters: []*hap.Character{ { Type: "73", Format: hap.FormatUInt8, Value: json.RawMessage("null"), // was nil Perms: hap.EVPR,Result
POST /api/homekit/doorbell?id=<stream>shows the native doorbell notification with the live view.TestTriggerDoorbell.TestAqaraG3,TestHomebridge,TestScryptedand onetlv8test fail, but they fail the same way on the unpatched commit.Caveats
nullvalue.TriggerDoorbell()setsValue = 0, later reads return0instead ofnull. iOS didn't object in my testing. Resetting it tonullafter the notification makesTestTriggerDoorbellfail, so I left it alone.frankea commentedon Nov 9, 2026
Same error here, with one more data point: making the Doorbell service primary is not enough by itself.
Setup
1.9.15+dev.38e3009(HA OS, the "go2rtc (dev)" image with a locally patched binary)homekit://client → Frigate restream → go2rtc HKSV servercategory_id: doorbell,hksv: true,motion: apiWhat I tried, in order (each time with a fresh
device_idand the stalepairings:entry removed)speakernot setspeaker: truePrimary: true+ an extra Stateless Programmable Switch (89) with char73; char73still serialized without avaluekey/accessories(below)Together with the patch in the comment above (primary +
nullworks), #3 suggests the missing"value": nullon73is the necessary part.Reference: the certified Aqara G4's Doorbell service (read with a second controller pairing):
{"iid":25,"type":"121","primary":true,"characteristics":[ {"type":"23","format":"string","perms":["pr"],"value":"Video Doorbell"}, {"type":"73","format":"uint8","perms":["pr","ev"],"value":null,"minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}, {"type":"11A","format":"bool","perms":["pr","pw","ev"],"value":0}, {"type":"232","format":"tlv8","perms":["pr","ev"],"value":"AQEA"}, {"type":"119","format":"uint8","perms":["pr","pw","ev"],"value":50,"minValue":0,"maxValue":100,"minStep":1}]}The G4 also has a HAP Protocol Information service (
A2, version1.1.0), and its Camera Event Recording Management service is linked to both Data Stream Management and the Motion Sensor ("linked":[29,33]). It has no Stateless Programmable Switch.What #4 changes (I made these together, so I can't say which beyond the
nullare required):pkg/hap/character.go: uncommentMinValue/MaxValue/MinStep/ValidVal, and add aMarshalJSONthat writes"value": nullfor characteristics withprpermission and a nil value. That serializes73like the G4. The camera accessories (no nilprvalues) are unchanged.ServiceDoorbell():73getsMinValue: 0, MaxValue: 2, MinStep: 1, ValidVal: []any{0}.NewHKSVDoorbellAccessory():doorbell.Primary = true, addhap.ServiceHAPProtocolInformation(), andrecordingMgmt.Linked = []int{dataStreamMgmt.IID, motionSensor.IID}.TriggerDoorbell(): fire every char73(only relevant if a Stateless Programmable Switch is added).pkg/hksvtests pass.TestAqaraG3/TestHomebridge/TestScryptedand onetlv8test fail the same way on the unpatched commit, as noted above.Also confirming the note in the issue: each failed attempt leaves a
pairings:entry, so the accessory advertisessf=0and disappears from "More options" until it's removed by hand. #2641 doesn't touchServiceDoorbell, so this is still open ondevas far as I can tell.fix(hksv): make the video doorbell accessory pass Home app compliance
fix(hksv): make the video doorbell accessory pass Home app compliance