A button entity for Homex
Implements a Homex.Entity. See module for available callbacks.
https://www.home-assistant.io/integrations/button.mqtt/
Options
:name(String.t/0) - Required. the name of the entity:enabled_by_default(boolean/0) - Flag which defines if the entity should be enabled when first added. The default value istrue.:device_class- The type/class of the button to set the icon in the frontend. The device_class can be nil. The default value isnil.
Example
defmodule MyButton do
use Homex.Entity.Button, name: "my-button"
def handle_press(entity) do
IO.puts("my button was pressed")
entity
end
end
Summary
Callbacks
@callback handle_press(entity :: Homex.Entity.t()) :: entity :: Homex.Entity.t()
get's called when the button is pressed in Home Assistant
@callback set_attributes(entity :: Homex.Entity.t(), attributes :: Map.t()) :: entity :: Homex.Entity.t()
sets the buttons attributes