homeassistant

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

homeassistant implements an API client for Home Assistant API https://developers.home-assistant.io/docs/api/rest/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
}

func New

func New(endPoint, apiKey string, opts ...client.ClientOpt) (*Client, error)

func (*Client) Actuators

func (c *Client) Actuators() ([]Sensor, error)

Actuators returns all button, switch and lock entities and their state

func (*Client) Events

func (c *Client) Events() ([]Event, error)

Events returns all the events and number of listeners

func (*Client) Health

func (c *Client) Health() (string, error)

ListModels returns all the models

func (*Client) Lights

func (c *Client) Lights() ([]Sensor, error)

Lights returns all light entities and their state

func (*Client) Sensors

func (c *Client) Sensors() ([]Sensor, error)

Sensors returns all sensor entities and their state

func (*Client) States

func (c *Client) States() ([]State, error)

States returns all the entities and their state

type Event

type Event struct {
	Event     string `json:"event"`
	Listeners uint   `json:"listener_count"`
}

type Sensor

type Sensor struct {
	Type   string `json:"type"`
	Entity string `json:"entity_id"`
	Name   string `json:"friendly_name"`
	Value  string `json:"state,omitempty"`
	Unit   string `json:"unit_of_measurement,omitempty"`
	Class  string `json:"device_class,omitempty"`
}

func (Sensor) String

func (s Sensor) String() string

type State

type State struct {
	Entity      string         `json:"entity_id"`
	LastChanged time.Time      `json:"last_changed"`
	State       string         `json:"state"`
	Attributes  map[string]any `json:"attributes"`
}

func (State) DeviceClass

func (s State) DeviceClass() string

func (State) Name

func (s State) Name() string

func (State) String

func (s State) String() string

func (State) UnitOfMeasurement

func (s State) UnitOfMeasurement() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL