Documentation
¶
Index ¶
- func NewHomeAssistant(uri string) (oauth2.TokenSource, error)
- func NewHomeAssistantFromConfig(other map[string]any) (oauth2.TokenSource, error)
- func ValidatePhaseEntities(phases []string) ([]string, error)
- type Connection
- func (c *Connection) CallNumberService(entity string, value float64) error
- func (c *Connection) CallService(domain, service string, data map[string]any) error
- func (c *Connection) CallSwitchService(entity string, turnOn bool) error
- func (c *Connection) GetBoolState(entity string) (bool, error)
- func (c *Connection) GetChargeStatus(entity string) (api.ChargeStatus, error)
- func (c *Connection) GetFloatState(entity string) (float64, error)
- func (c *Connection) GetIntState(entity string) (int64, error)
- func (c *Connection) GetPhaseFloatStates(entities []string) (float64, float64, float64, error)
- func (c *Connection) GetState(entity string) (StateResponse, error)
- func (c *Connection) GetStates() ([]StateResponse, error)
- func (c *Connection) GetTimeState(entity string) (time.Time, error)
- type StateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHomeAssistant ¶
func NewHomeAssistant(uri string) (oauth2.TokenSource, error)
func NewHomeAssistantFromConfig ¶
func NewHomeAssistantFromConfig(other map[string]any) (oauth2.TokenSource, error)
func ValidatePhaseEntities ¶
ValidatePhaseEntities validates that phase entity arrays contain 1 or 3 entities
Types ¶
type Connection ¶
Connection represents a Home Assistant API connection
func NewConnection ¶
func NewConnection(log *util.Logger, uri, home string) (*Connection, error)
NewConnection creates a new Home Assistant connection
func (*Connection) CallNumberService ¶
func (c *Connection) CallNumberService(entity string, value float64) error
CallNumberService is a convenience method for setting number entity values
func (*Connection) CallService ¶
func (c *Connection) CallService(domain, service string, data map[string]any) error
CallService calls a Home Assistant service
func (*Connection) CallSwitchService ¶
func (c *Connection) CallSwitchService(entity string, turnOn bool) error
CallSwitchService is a convenience method for switch services
func (*Connection) GetBoolState ¶
func (c *Connection) GetBoolState(entity string) (bool, error)
GetBoolState retrieves the state of an entity as boolean
func (*Connection) GetChargeStatus ¶
func (c *Connection) GetChargeStatus(entity string) (api.ChargeStatus, error)
GetChargeStatus maps Home Assistant states to api.ChargeStatus
func (*Connection) GetFloatState ¶
func (c *Connection) GetFloatState(entity string) (float64, error)
GetFloatState retrieves the state of an entity as float64
func (*Connection) GetIntState ¶
func (c *Connection) GetIntState(entity string) (int64, error)
GetIntState retrieves the state of an entity as int64
func (*Connection) GetPhaseFloatStates ¶
GetPhaseFloatStates retrieves three phase values (currents, voltages, etc.)
func (*Connection) GetState ¶
func (c *Connection) GetState(entity string) (StateResponse, error)
GetState retrieves the state of an entity
func (*Connection) GetStates ¶
func (c *Connection) GetStates() ([]StateResponse, error)
GetStates retrieves the list of entities
func (*Connection) GetTimeState ¶
func (c *Connection) GetTimeState(entity string) (time.Time, error)
GetTimeState retrieves the state of an entity as time