ewilken / hap-rs

Rust implementation of the Apple HomeKit Accessory Protocol (HAP)
Apache License 2.0
196 stars 33 forks source link

How to pair with Apple Home app? #79

Open overheat opened 1 year ago

overheat commented 1 year ago

After cargo run --example occupancy_sensor, what should I do if I want to pair with my Home app on iPhone?

[2022-11-08T01:35:26Z INFO  hap::transport::http::server] binding TCP listener on [fdc1:6f78:d22f:4620:f5:a750:dbc9:28c1]:32000
[2022-11-08T01:35:26Z DEBUG hap::transport::mdns] attempting to set mDNS records
[2022-11-08T01:35:26Z DEBUG hap::transport::mdns] setting mDNS records: ["c#=2", "ff=0", "id=0a:14:1e:28:32:3c", "md=Acme Occupancy Sensor", "pv=1.0", "s#=1", "sf=1", "ci=10"]

Thanks.

vallentin commented 1 year ago

So I am by no means an expert, and only just started playing around with this library myself. But when I did cargo run --example switch on a computer with WiFi and ensuring that the server was available on my local network.

Then when I clicked "Add Accessory" in the Home app, then it appeared automatically. After selecting the accessory, the pin code I was prompted, was simply the pin in the example code, i.e.:

https://github.com/ewilken/hap-rs/blob/acf45bdb00e23c81b67b3d5116c113335dc83f16/examples/switch.rs#L30