我正在使用https://github.com/etwmc/Personal-HomeKit-HAP-来模拟与 homekit 兼容的设备。Siri 不会接受颜色命令,例如“将我的灯更改为蓝色”,以“您的灯没有响应”作为响应,而显然没有请求。我假设是因为我的特征不符合 siri 的期望,但哪些是正确的?
printf("Initial Accessory\n");
accSet = &AccessorySet::getInstance();
Accessory *lightAcc = new Accessory();
addInfoServiceToAccessory(lightAcc, "Light 1", "ET", "Light", "12345678", &lightIdentify);
accSet->addAccessory(lightAcc);
Service *lightService = new Service(charType_lightBulb);
lightAcc->addService(lightService);
stringCharacteristics *lightServiceName = new stringCharacteristics(charType_serviceName, premission_read, 0);
lightServiceName->setValue("Light");
lightAcc->addCharacteristics(lightService, lightServiceName);
boolCharacteristics *powerState = new boolCharacteristics(charType_on, premission_read|premission_write|premission_notify);
powerState->setValue("true");
powerState->valueChangeFunctionCall = &changeLightState;
lightAcc->addCharacteristics(lightService, powerState);
intCharacteristics *brightnessState = new intCharacteristics(charType_brightness, premission_read|premission_write|premission_notify, 0, 100, 1, unit_percentage);
brightnessState->setValue("50");
brightnessState->valueChangeFunctionCall = &changeLightIntensity;
lightAcc->addCharacteristics(lightService, brightnessState);
intCharacteristics *saturationState= new intCharacteristics(charType_saturation, premission_read|premission_write|premission_notify, 0, 100, 1, unit_percentage);
saturationState->setValue("100");
saturationState->valueChangeFunctionCall = &changeLightSat;
lightAcc->addCharacteristics(lightService, saturationState);
intCharacteristics *hueState= new intCharacteristics(charType_hue, premission_read|premission_write|premission_notify, 0, 360, 1, unit_arcDegree);
hueState->setValue("0");
hueState->valueChangeFunctionCall = &changeLightColor;