I'm working with various devices that have HomeKit Support.
I can see all the characteristics per service of the device accessory, but is there a way I can get all of that data at once vs. individually?
func getAllCharacteristics(for accessory: HMAccessory) {
for service in accessory.services {
for characteristic in service.characteristics {
// print specifics
}
}
}
I can use the above to print out everything for an accessory. I'm just trying to find the best way to get it all into a dictionary or json object.
Something like:
[
{
"accessory_name": {
"services": [
"service_name": {
"characteristics": [
"characteristic_name": "characteristic_value",
"characteristic_name": "characteristic_value"
]
},
]
}
}
]