Reputation: 9596
I would like to associate a SIRI name to CUSTOM characteristics of a home kit accessory that I defined using the HomeKit Simulator (see this question for details on how I did it).
I would be able to do something like:
This is easily possible using predefined characteristics, however I need to be able to do it with custom characteristics.
Any idea how I can achieve this?
EDIT: Only the HMService class has an "updateName" function. HMCharacteristic does not have it.
This is what I get if I try to access the service name and related characteristic manufacturer description:
for (int i=0; i< [accessory.services count]; i++) {
HMService * service = [accessory.services objectAtIndex:i];
for (int j=0; j< [service.characteristics count]; j++) {
HMCharacteristic * characteristic = [service.characteristics objectAtIndex:j];
NSLog(@"service name: %@", service.name);
if ([characteristic.properties containsObject:HMCharacteristicPropertySupportsEventNotification]) {
NSLog(@"description of characteristic: %@", characteristic.metadata);
[characteristic enableNotification:TRUE completionHandler:^(NSError *error) {
if (error) {
NSLog(@"Error while enabling notification");
}
else {
NSLog(@"Notification enabled");
}
}];
}
}
}
service name: MyServiceName service 2015-08-21 09:40:20.833 AppName[217:5673] description of characteristic: [%@ Format: string, Max length: 1, Manufacturer Description: SomethingCustom Mode ]
Upvotes: 0
Views: 996
Reputation: 3742
I suspect it isn't possible. Siri has hard-coded relationships with homekit that allows it to communicate with defined types of accessories.
One note is that siri uses the service name to figure out where to direct commands. So if you have a thermostat that's called "upstairs", you can tell siri to "set the temperature upstairs to 65 degrees". Siri's interpretation of your interaction with services is complex and it looks like apple's only supporting their defined services so they can provide the experience that they want.
Upvotes: 1