Documentation
¶
Index ¶
- type Access
- func (a *Access) Bootstrap() (Bootstrap, error)
- func (a *Access) CallService(domain, service string, entityID string) error
- func (a *Access) ChangeState(id, state string) (s State, err error)
- func (a *Access) CheckAPI() error
- func (a *Access) FilterStates(domains ...string) (s States, err error)
- func (a *Access) FireEvent(eventType string, eventData interface{}) error
- func (a *Access) GetDevice(state State) Device
- func (a *Access) GetState(id string) (s State, err error)
- func (a *Access) ListStates() (s States, err error)
- func (a *Access) ListenEvents() (*EventListener, error)
- func (a *Access) NewLight(id string) (light *Light)
- func (a *Access) NewLock(id string) (lock *Lock)
- func (a *Access) NewSwitch(id string) (s *Switch)
- type Bootstrap
- type Device
- type EventListener
- type Light
- type Lock
- type State
- type StateChange
- type StateChangedEvent
- type States
- type Switch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Access ¶
type Access struct {
// contains filtered or unexported fields
}
func NewAccess ¶
NewAccess returns a new *Access to be used to interface with the Home Assistant system.
func (*Access) CallService ¶
CallService calls a service with a domain, service, and entity id.
func (*Access) ChangeState ¶
ChangeState changes the state of a device
func (*Access) CheckAPI ¶
CheckAPI checks whether or not the API is running. It returns an error if it is not running.
func (*Access) FilterStates ¶
FilterStates returns a list of states filtered by the list of domains
func (*Access) ListStates ¶
ListStates gets an array of state objects
func (*Access) ListenEvents ¶
func (a *Access) ListenEvents() (*EventListener, error)
type Bootstrap ¶
type Bootstrap struct { Config struct { Components []string `json:"components"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` LocationName string `json:"location_name"` TemperatureUnit string `json:"temperature_unit"` Timezone string `json:"time_zone"` Version string `json:"version"` } `json:"config"` Events []struct { Event string `json:"event"` ListenerCount int `json:"listener_count"` } `json:"events"` Services []struct { Domain string `json:"domain"` Services map[string]struct { Description string `json:"description"` Fields interface{} `json:"fields"` } `json:"services"` } `json:"services"` States []struct { Attributes struct { Auto bool `json:"auto"` EntityID []string `json:"entity_id"` FriendlyName string `json:"friendly_name"` Hidden bool `json:"hidden"` Order int `json:"order"` } `json:"attributes"` EntityID string `json:"entity_id"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` State string `json:"state"` } `json:"states"` }
Bootstrap is an obsolete hass struct, seems to be removed
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
func (*EventListener) Close ¶
func (e *EventListener) Close() error
Close closes the event listener library
func (*EventListener) NextStateChanged ¶
func (e *EventListener) NextStateChanged() (StateChangedEvent, error)
NextStateChanged waits and returns for the next state_changed event.
type Light ¶
type Light struct {
// contains filtered or unexported fields
}
Light describes a Light class
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock describes a Lock class
type State ¶
type State struct { Attributes struct { Auto bool `json:"auto"` FriendlyName string `json:"friendly_name"` Hidden bool `json:"hidden"` Order int `json:"order"` AssumedState bool `json:"assumed_state"` } `json:"attributes"` EntityID string `json:"entity_id"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` State string `json:"state"` }
State is the struct for an object state
type StateChange ¶
StateChange is used for changing state on an entity
type StateChangedEvent ¶
type StateChangedEvent struct { Origin string `json:"origin"` EventType string `json:"event_type"` TimeFired time.Time `json:"time_fired"` Data struct { OldState struct { EntityID string `json:"entity_id"` State string `json:"state"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` Attributes struct { EntityID []string `json:"entity_id"` Order int `json:"order"` Hidden bool `json:"hidden"` FriendlyName string `json:"friendly_name"` Auto bool `json:"auto"` } `json:"attributes"` } `json:"old_state"` EntityID string `json:"entity_id"` NewState struct { EntityID string `json:"entity_id"` State string `json:"state"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` Attributes struct { EntityID []string `json:"entity_id"` Order int `json:"order"` Hidden bool `json:"hidden"` FriendlyName string `json:"friendly_name"` Auto bool `json:"auto"` } `json:"attributes"` } `json:"new_state"` } `json:"data"` }