Homex.Entity behaviour (homex v0.1.0)
View SourceDefines the behaviour and struct for an entity implementation
Summary
Callbacks
The Home Assistant component config definition
Configures the intial state for the switch
Handle a new message from the subscriptions
If an update_interval is set, this callback will be fired
The given name of the entity
The Home Assistant platform
The list of topics to subscribe to
The unique id of the entity
Functions
Gets the value from the Entity struct
Checks if the given module implements the behaviour from this module
Puts a value into the Entity struct to retrieve it later. Can be used as a key-value store for user data
Types
Callbacks
@callback config() :: map()
The Home Assistant component config definition
Configures the intial state for the switch
@callback handle_message( {topic :: String.t(), payload :: term()}, entity :: t() ) :: entity :: t()
Handle a new message from the subscriptions
@callback handle_timer(entity :: Entity.t()) :: entity :: t()
If an update_interval is set, this callback will be fired
@callback name() :: String.t()
The given name of the entity
@callback platform() :: String.t()
The Home Assistant platform
@callback subscriptions() :: [String.t()]
The list of topics to subscribe to
@callback unique_id() :: String.t()
The unique id of the entity
Functions
Gets the value from the Entity struct
Checks if the given module implements the behaviour from this module
Puts a value into the Entity struct to retrieve it later. Can be used as a key-value store for user data