Documentation
¶
Index ¶
- Variables
- func NewDailySchedule() scheduleBuilder
- func NewEntityListener() elBuilder1
- func NewEventListener() eventListenerBuilder1
- func NewInterval() intervalBuilder
- type App
- func (a *App) Cleanup()
- func (a *App) GetService() *Service
- func (a *App) GetState() State
- func (a *App) RegisterEntityListeners(etls ...EntityListener)
- func (a *App) RegisterEventListeners(evls ...EventListener)
- func (a *App) RegisterIntervals(intervals ...Interval)
- func (a *App) RegisterSchedules(schedules ...DailySchedule)
- func (a *App) Start()
- type BaseEventMsg
- type DailySchedule
- type DurationString
- type EntityData
- type EntityListener
- type EntityListenerCallback
- type EntityState
- type EventData
- type EventListener
- type EventListenerCallback
- type EventZWaveJSValueNotification
- type Interval
- type IntervalCallback
- type NewAppRequest
- type ScheduleCallback
- type Service
- type State
- type StateImpl
- func (s *StateImpl) AfterSunrise(offset ...DurationString) bool
- func (s *StateImpl) AfterSunset(offset ...DurationString) bool
- func (s *StateImpl) BeforeSunrise(offset ...DurationString) bool
- func (s *StateImpl) BeforeSunset(offset ...DurationString) bool
- func (s *StateImpl) Equals(entityId string, expectedState string) (bool, error)
- func (s *StateImpl) Get(entityId string) (EntityState, error)
- func (s *StateImpl) ListEntities() ([]EntityState, error)
- type TimeString
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidArgs = errors.New("invalid arguments provided")
Functions ¶
func NewDailySchedule ¶
func NewDailySchedule() scheduleBuilder
func NewEntityListener ¶
func NewEntityListener() elBuilder1
func NewEventListener ¶
func NewEventListener() eventListenerBuilder1
func NewInterval ¶
func NewInterval() intervalBuilder
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func NewApp ¶
func NewApp(request NewAppRequest) (*App, error)
NewApp establishes the websocket connection and returns an object you can use to register schedules and listeners.
func (*App) GetService ¶
func (*App) RegisterEntityListeners ¶
func (a *App) RegisterEntityListeners(etls ...EntityListener)
func (*App) RegisterEventListeners ¶
func (a *App) RegisterEventListeners(evls ...EventListener)
func (*App) RegisterIntervals ¶
func (*App) RegisterSchedules ¶
func (a *App) RegisterSchedules(schedules ...DailySchedule)
type BaseEventMsg ¶
type BaseEventMsg struct {
Event struct {
EventType string `json:"event_type"`
} `json:"event"`
}
type DailySchedule ¶
type DailySchedule struct {
// contains filtered or unexported fields
}
func (DailySchedule) Hash ¶
func (s DailySchedule) Hash() string
func (DailySchedule) String ¶
func (s DailySchedule) String() string
type DurationString ¶
type DurationString string
DurationString represents a duration, such as "2s" or "24h". See https://pkg.go.dev/time#ParseDuration for all valid time units.
type EntityData ¶
type EntityListener ¶
type EntityListener struct {
// contains filtered or unexported fields
}
type EntityListenerCallback ¶
type EntityListenerCallback func(*Service, State, EntityData)
type EntityState ¶
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
type EventListenerCallback ¶
type EventZWaveJSValueNotification ¶
type EventZWaveJSValueNotification struct {
ID int `json:"id"`
Type string `json:"type"`
Event struct {
EventType string `json:"event_type"`
Data struct {
Domain string `json:"domain"`
NodeID int `json:"node_id"`
HomeID int64 `json:"home_id"`
Endpoint int `json:"endpoint"`
DeviceID string `json:"device_id"`
CommandClass int `json:"command_class"`
CommandClassName string `json:"command_class_name"`
Label string `json:"label"`
Property string `json:"property"`
PropertyName string `json:"property_name"`
PropertyKey string `json:"property_key"`
PropertyKeyName string `json:"property_key_name"`
Value string `json:"value"`
ValueRaw int `json:"value_raw"`
} `json:"data"`
Origin string `json:"origin"`
TimeFired time.Time `json:"time_fired"`
} `json:"event"`
}
type IntervalCallback ¶
type NewAppRequest ¶
type NewAppRequest struct {
// Required
URL string
// Optional
// Deprecated: use URL instead
// IpAddress of your Home Assistant instance i.e. "localhost"
// or "192.168.86.59" etc.
IpAddress string
// Optional
// Deprecated: use URL instead
// Port number Home Assistant is running on. Defaults to 8123.
Port string
// Required
// Auth token generated in Home Assistant. Used
// to connect to the Websocket API.
HAAuthToken string
// Required
// EntityId of the zone representing your home e.g. "zone.home".
// Used to pull latitude/longitude from Home Assistant
// to calculate sunset/sunrise times.
HomeZoneEntityId string
// Optional
// Whether to use secure connections for http and websockets.
// Setting this to `true` will use `https://` instead of `https://`
// and `wss://` instead of `ws://`.
Secure bool
}
type ScheduleCallback ¶
type Service ¶
type Service struct {
AdaptiveLighting *services.AdaptiveLighting
AlarmControlPanel *services.AlarmControlPanel
Climate *services.Climate
Cover *services.Cover
HomeAssistant *services.HomeAssistant
Light *services.Light
Lock *services.Lock
MediaPlayer *services.MediaPlayer
Switch *services.Switch
InputBoolean *services.InputBoolean
InputButton *services.InputButton
InputText *services.InputText
InputDatetime *services.InputDatetime
InputNumber *services.InputNumber
Event *services.Event
Notify *services.Notify
Number *services.Number
Scene *services.Scene
Script *services.Script
Timer *services.Timer
TTS *services.TTS
Vacuum *services.Vacuum
ZWaveJS *services.ZWaveJS
}
type State ¶
type State interface {
AfterSunrise(...DurationString) bool
BeforeSunrise(...DurationString) bool
AfterSunset(...DurationString) bool
BeforeSunset(...DurationString) bool
ListEntities() ([]EntityState, error)
Get(entityId string) (EntityState, error)
Equals(entityId, state string) (bool, error)
}
type StateImpl ¶
type StateImpl struct {
// contains filtered or unexported fields
}
State is used to retrieve state from Home Assistant.
func (*StateImpl) AfterSunrise ¶
func (s *StateImpl) AfterSunrise(offset ...DurationString) bool
func (*StateImpl) AfterSunset ¶
func (s *StateImpl) AfterSunset(offset ...DurationString) bool
func (*StateImpl) BeforeSunrise ¶
func (s *StateImpl) BeforeSunrise(offset ...DurationString) bool
func (*StateImpl) BeforeSunset ¶
func (s *StateImpl) BeforeSunset(offset ...DurationString) bool
func (*StateImpl) ListEntities ¶
func (s *StateImpl) ListEntities() ([]EntityState, error)
ListEntities returns a list of all entities in Home Assistant. see rest documentation for more details: https://developers.home-assistant.io/docs/api/rest/#actions
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
generate
command
Package main provides the generate command for generating Home Assistant entity constants
|
Package main provides the generate command for generating Home Assistant entity constants |
|
http
http is used to interact with the home assistant REST API.
|
http is used to interact with the home assistant REST API. |
|
websocket
Package websocket is used to interact with the Home Assistant websocket API.
|
Package websocket is used to interact with the Home Assistant websocket API. |
Click to show internal directories.
Click to hide internal directories.