glome/homeassistant

Types

pub opaque type HomeAssistant
pub type StateChangeFilter =
  fn(StateChangeEvent, HomeAssistant) -> Bool
pub type StateChangeHandler =
  fn(StateChangeEvent, HomeAssistant) -> Result(Nil, GlomeError)
pub type StateChangeHandlers =
  List(StateChangeHandlersEntry)
pub type StateChangeHandlersEntry {
  StateChangeHandlersEntry(
    entity_selector: EntitySelector,
    handler: StateChangeHandler,
    filter: StateChangeFilter,
  )
}

Constructors

  • StateChangeHandlersEntry(
      entity_selector: EntitySelector,
      handler: StateChangeHandler,
      filter: StateChangeFilter,
    )

Functions

pub fn add_constrained_handler(to home_assistant: HomeAssistant, for entity_selector: EntitySelector, handler handler: fn(
    StateChangeEvent,
    HomeAssistant,
  ) -> Result(Nil, GlomeError), constraint filter: fn(
    StateChangeEvent,
    HomeAssistant,
  ) -> Bool) -> HomeAssistant
pub fn add_handler(to home_assistant: HomeAssistant, for entity_selector: EntitySelector, handler handler: fn(
    StateChangeEvent,
    HomeAssistant,
  ) -> Result(Nil, GlomeError)) -> HomeAssistant
pub fn call_service(home_assistant: HomeAssistant, domain: Domain, service: Service, service_data: Option(
    String,
  )) -> Result(String, GlomeError)
pub fn connect(config: Configuration, conn_handler: fn(
    HomeAssistant,
  ) -> HomeAssistant) -> Result(Nil, GlomeError)
pub fn get_state(from home_assistant: HomeAssistant, of entity_id: EntityId) -> Result(
  State,
  GlomeError,
)