HAP.ValueStore behaviour (HAP v0.2.0) View Source

Defines the behaviour required of a module that wishes to act as the backing data store for a given HomeKit characteristic

Link to this section Summary

Callbacks

Return the value of a value hosted by this value store. The passed list of opts is as specified in the hosting HAP.Configuration and can be used to distinguish a particular value within a larger value store (perhaps by GPIO pin or similar)

Sets the value of a value hosted by this value store. The passed list of opts is as specified in the hosting HAP.Configuration and can be used to distinguish a particular value within a larger value store (perhaps by GPIO pin or similar)

Link to this section Types

Link to this section Callbacks

Specs

get_value(opts :: opts()) :: HAP.Characteristic.value()

Return the value of a value hosted by this value store. The passed list of opts is as specified in the hosting HAP.Configuration and can be used to distinguish a particular value within a larger value store (perhaps by GPIO pin or similar)

Returns the value stored by this value store

Specs

put_value(value :: HAP.Characteristic.value(), opts :: opts()) ::
  :ok | {:error, String.t()}

Sets the value of a value hosted by this value store. The passed list of opts is as specified in the hosting HAP.Configuration and can be used to distinguish a particular value within a larger value store (perhaps by GPIO pin or similar)

Returns :ok or {:error, reason}