Add option to align FindMyAccessories key generation
Sometimes the key generation diverges for example if the accessory has no power. FindMy solves this be re-aligning the key generation if a btle connection is established. FindMy.app stores there alignment records in the KeyAlignmentRecord directory.
This PR extends the FindMyAccessory class to read those records during from_plist-generation and re-sync the key generation by this
That's really cool, thank you for taking the time to implement this! I had no idea Apple made it so easy to retrieve sync data.
To what extent did you test this? My own setup is a bit flaky at the moment, but if you tested it extensively then I'm happy to merge it. Fetching reports before the lastIndexObservationDate still works, correct?
I only tested it a bit and not with reports before the lastIndexObservationDate. I'm unsure what the behaviour here should be. Should it just assume that for all dates before that, the calculation is done relative to the sync date? Or should it use the paired_at timestamp for dates before the sync? Or use the one that is closer? Or both? The code currently calculates relative to lastIndexObservationDate, which IMHO is the right choice, as this is the latest known correct (timestamp, index)-mapping we have
Yeah I think you're right, the index doesn't just "jump" on its own so the last known good mapping is probably the best reference point. As long as it's roughly correct it should be fine anyway, since that ~12hr margin is still used when making requests.
I'll merge this once I find some time to work on the library again, the changes should be backwards compatible anyway so no existing features should break because of it.
Sorry for taking a while to review this. Thanks again!