Using Hap as a client to request data from a HomeKit device?
Thanks for a great library!
I'm trying to get data from a HomeKit device. In HC there was a client example and I wondering if there is an easy way to do the same with Hap?
Was wondering about that too. I tested the old example from hc-repository but didn't get it to work.
There is currently no client implementation available. But as long as you don't have access to the encryptions keys of the HomeKit accessory, you won't be able to read any data from it.
From which HomeKit accessory do you want to read data from?
I have Aqara hub with som temperature sensor I like to read data from. I managed to read data from an virtual sensor in HomeKit Accessory Simulator with your older hc library. Isn't the encryption keys generated when you connect and pair the device and it will work if I can present the numeric code on the HomeKit device when pairing with the device?
Yes, the encryption keys are exchanged during pairing. But once you pair with the Aqara hub, you won't be able to add the hub to HomeKit on iOS anymore because accessories can only be paired once. You would then have to reset the accessory then.
Hi,
I was asking the same question in #14
So made my implementation.
https://github.com/hkontrol/hkontroller
Take a look at examples folder.
The only problem I faced was to use standard http client with encrypted connection, so I did implement two things:
- Background goroutine that is reading data and transforming
EVENTmessages on fly. - RoundTripper interface implementation to be able to use encrypted connection for http requests.
Some things sill is implemented poor and have to be rethinked in future.