1
我使用https://github.com/etwmc/Personal-HomeKit-HAP-來模擬homekit兼容設備。 Siri不會接受顏色命令,如「將我的燈更換爲藍色」,並在沒有任何請求的情況下響應「您的燈不響應」。我認爲這是因爲我的特點不符合siri的期望,但哪些是正確的?使用homekit設置顏色的特性
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;
是的。我確實曝光了色調,亮度和飽和度,就像你在我的代碼中看到的那樣。他們在HomeKitDemo應用程序中工作正常,但siri似乎並不認爲它們是顏色。 – aep 2015-04-03 10:00:00
@aep你可以使用色相,好吧! (要更改顏色) 由於「顏色」不是特性,所以siri不會了解它,除非您爲顏色創建自定義特性(在這種情況下,還需要管理某些特性,因爲特性值的格式不會UIColor,我可以是字符串,浮動,int32/uint8等) – Samir 2015-04-06 09:00:01