ewilken / hap-rs

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

Battery's `charging_state` and `battery_level` characteristics are defined as optional even though they're required. #64

Closed gbaranski closed 2 years ago

gbaranski commented 2 years ago

you can find that here

https://github.com/ewilken/hap-rs/blob/main/src/service/generated/battery.rs#L34-L37

And according to the specification, those two are required. Screenshot 2022-01-14 at 18 36 24

ewilken commented 2 years ago

Thanks for checking! I just re-ran the codegen under macOS 12.0.1 and it generated the two characteristics as optional. So Apple's own implementation in macOS ist diverging from the spec here. Are you reading the latest version of the spec? And is the iOS controller complaining (read: not pairing) about our implementation? If it works, I'd say let's just stick with replicating Apple's implementation and call it a day.

gbaranski commented 2 years ago

Are you reading the latest version of the spec?

Yes, I think so.

And is the iOS controller complaining (read: not pairing) about our implementation?

It does connect, but it seemed weird.

Thanks for clarifying, should I keep the issue open?

ewilken commented 2 years ago

I'd say let's close it. But please feel free to reopen should you run into any related issues!