Hassock.Device (hassock v0.3.0)

Copy Markdown View Source

A device from Home Assistant's device registry (config/device_registry/list).

disabled_by ("user", "integration", "config_entry", ...) and entry_type ("service" for integrations that aren't physical devices) are kept as HA's strings.

Summary

Functions

The name HA shows: the user's name if set, else the integration's.

Build from an HA registry map. Unknown keys are ignored, missing keys are nil.

Types

t()

@type t() :: %Hassock.Device{
  area_id: String.t() | nil,
  disabled_by: String.t() | nil,
  entry_type: String.t() | nil,
  hw_version: String.t() | nil,
  id: String.t(),
  labels: [String.t()],
  manufacturer: String.t() | nil,
  model: String.t() | nil,
  model_id: String.t() | nil,
  name: String.t() | nil,
  name_by_user: String.t() | nil,
  sw_version: String.t() | nil,
  via_device_id: String.t() | nil
}

Functions

display_name(device)

@spec display_name(t()) :: String.t() | nil

The name HA shows: the user's name if set, else the integration's.

from_map(map)

@spec from_map(map()) :: t()

Build from an HA registry map. Unknown keys are ignored, missing keys are nil.