Instance Property

value

The current value of the characteristic.

Declaration

@property(readonly, copy, nonatomic) id value;

Discussion

This is the last value that the system saw for the characteristic. Because multiple apps can access a given home, this value may change without your app changing it. To be sure you have the current value, call readValueWithCompletionHandler: and wait for the response before checking the value property.

You can also learn about external changes to the value when they happen by adopting the HMAccessoryDelegate protocol. Call the enableNotification:completionHandler: method to enable updates for a particular characteristic. Then implement the accessory:service:didUpdateValueForCharacteristic: method to receive the updates. You only receive updates for changes made outside your app, for example by Apple’s Home app, or by the accessory itself.

How you interpret the value depends on the characteristicType. From this, you can tell what the value represents, and infer whether the value contain a string, integer, floating point number, or Boolean. The characteristic’s metadata gives you additional information about how to interpret and present the value.

See Also

Controlling a Characteristic

- readValueWithCompletionHandler:

Reads the value for the characteristic.

- writeValue:completionHandler:

Modifies the value of the characteristic.

- updateAuthorizationData:completionHandler:

Sets or clears authorization data used when writing to the characteristic.