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:
- "Set CHARACTERISTICONENAME to VALUE in HOME"
- "Turn ACCESSORYNAME on in HOME"
- "Set CHARACTERISTICTWONAME to VALUE in HOME"
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 ]