schema

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallResponse

type CallResponse struct {
	ChangedStates   []*State       `json:"changed_states"`
	ServiceResponse map[string]any `json:"service_response"`
}

CallResponse is returned when calling a service with return_response=true.

type Domain

type Domain struct {
	Domain   string              `json:"domain"`
	Services map[string]*Service `json:"services,omitempty"`
}

func (Domain) String

func (v Domain) String() string

type Event

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

type Field

type Field struct {
	Required bool                `json:"required,omitempty"`
	Example  any                 `json:"example,omitempty"`
	Selector map[string]Selector `json:"selector,omitempty"`
}

func (Field) String

func (v Field) String() string

type Selector

type Selector struct {
	Text              string  `json:"text,omitempty"`
	Mode              string  `json:"mode,omitempty"`
	Min               float32 `json:"min,omitempty"`
	Max               float32 `json:"max,omitempty"`
	UnitOfMeasurement string  `json:"unit_of_measurement,omitempty"`
}

type Service

type Service struct {
	Call        string           `json:"call,omitempty"`
	Name        string           `json:"name,omitempty"`
	Description string           `json:"description,omitempty"`
	Fields      map[string]Field `json:"fields,omitempty"`
}

func (Service) String

func (v Service) String() string

type State

type State struct {
	Entity       string         `json:"entity_id"`
	LastChanged  time.Time      `json:"last_changed"`
	LastReported time.Time      `json:"last_reported"`
	LastUpdated  time.Time      `json:"last_updated"`
	State        string         `json:"state"`
	Attributes   map[string]any `json:"attributes"`
	Context      struct {
		Id       string `json:"id,omitempty"`
		ParentId string `json:"parent_id,omitempty"`
		UserId   string `json:"user_id,omitempty"`
	} `json:"context"`
}

func (State) Class

func (s State) Class() string

Class determines how the state should be interpreted, or will return "" if it's unknown

func (State) Domain

func (s State) Domain() string

Domain is used to determine the services which can be called on the entity

func (State) Name

func (s State) Name() string

Name is the friendly name of the entity

func (State) String

func (s State) String() string

func (State) UnitOfMeasurement

func (s State) UnitOfMeasurement() string

UnitOfMeasurement provides the unit of measurement for the state, or "" if there is no unit of measurement

func (State) Value

func (s State) Value() string

Value is the current state of the entity, or empty if the state is unavailable

Jump to

Keyboard shortcuts

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