ios - HMCharacteristicWriteAction what to pass for targetValue -
in homekit code is
hmaction *myaction = [[hmcharacteristicwriteaction alloc] initwithcharacteristic:[[lightbulbservice characteristics] objectatindex:0] targetvalue:characteristicvalue];
hmcharacteristicwriteaction have method initwithcharacterstic requried 2 parameter
1) initwithcharacteristic need pass, hmservice object.
2) targetvalue, need pass targetvalue ?
i need know is, target value characteristic ?
the target value depends on characteristic writing. lightbulb may support characteristics such as
hmcharacteristictypehue
- integer 0-360 (degrees)hmcharacteristictypesaturation
- integer 0 - 100 (percentage)hmcharacteristictypebrightness
- integer 0 - 100 (percentage).hmcharacteristictypepowerstate
- boolean on or off.
you can pretty guarantee lightbulb support hmcharacteristictypepowerstate
. others maybe not. lightbulb can support additional characteristics, defined manufacturer - strobe might support 'blink rate' characteristic example.
Comments
Post a Comment