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

Document how to make the server portable #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,36 @@ By doing so, the first accessory `a1` appears as a bridge in HomeKit.
When adding the accessories to HomeKit, iOS only shows the bridge accessory.
Once the bridge was added, the other accessories appear automatically.

HomeKit requires that every accessory has a unique id, which must not change between system restarts.
`hap` automatically assigns the ids for you based on the order in which the accessories are added to the server.
HomeKit requires that every accessory has a unique ID, which must not change between system restarts.
`hap` automatically assigns the IDs for you based on the order in which the accessories are added to the server.

The best would be to specify the unique id for every accessory yourself, like this
The best would be to specify the unique ID for every accessory yourself, like this

```go
a1.Id = 1
a2.Id = 2
```

## Making your server portable

As noted above, HomeKit requires that every accessory has a unique ID and it must not change between system restarts.
If you want to run your server in a k3s cluster or generally want to make it portable so you can move it to a different
computer (like a new Raspberry Pi), a certain number of requirements and steps are necessary:

1. The bridge has the ID `1`.
2. All of your accessories have unique IDs that don't change. This is important: `hap` automatically assigns the IDs for you
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. All of your accessories have unique IDs that don't change. This is important: `hap` automatically assigns the IDs for you
2. All of your accessories have unique IDs that don't change.\
**This is important:** `hap` automatically assigns the IDs for you

This would probably read better.

based on the order in which the accessories are added to the server. If you add more accessories in the middle, all of the
following accessory IDs will change, causing weird issues in HomeKit where a light switch could turn into a thermostat.
3. A backup of the stored files (if you're using the file store) are available at the new location. This includes:
- `version`
- `schema`
- `uuid`
- `keypair`
- `configHash`
- `*.pairing`

Shut down the server running at the old location before moving the files to the new location and starting the server there.

## Accessory Architecture

HomeKit uses a hierarchical architecture to define accessories, services and characeristics.
Expand Down