Documentation
¶
Index ¶
- Variables
- func NewDailySchedule() scheduleBuilder
- func NewEntityListener() elBuilder1
- func NewEventListener() eventListenerBuilder1
- func NewInterval() intervalBuilder
- type App
- func (app *App) Cleanup()
- func (app *App) Close() error
- func (app *App) GetService() *Service
- func (app *App) GetState() State
- func (app *App) RegisterEntityListeners(etls ...EntityListener)
- func (app *App) RegisterEventListeners(evls ...EventListener)
- func (app *App) RegisterIntervals(intervals ...Interval)
- func (app *App) RegisterSchedules(schedules ...DailySchedule)
- func (app *App) Start()
- type BaseEventMsg
- type ConditionCheck
- func CheckAllowlistDates(eList []time.Time) ConditionCheck
- func CheckDisabledEntity(s State, infos []internal.EnabledDisabledInfo) ConditionCheck
- func CheckEnabledEntity(s State, infos []internal.EnabledDisabledInfo) ConditionCheck
- func CheckExceptionDates(eList []time.Time) ConditionCheck
- func CheckExceptionRanges(eList []types.TimeRange) ConditionCheck
- func CheckStartEndTime(s types.TimeString, isStart bool) ConditionCheck
- func CheckStatesMatch(listenerState, s string) ConditionCheck
- func CheckThrottle(throttle time.Duration, lastRan *carbon.Carbon) ConditionCheck
- func CheckWithinTimeRange(startTime, endTime string) ConditionCheck
- type DailySchedule
- type EntityData
- type EntityListener
- type EntityListenerCallback
- type EntityState
- type EventData
- type EventListener
- type EventListenerCallback
- type Interval
- type IntervalCallback
- type Item
- type ScheduleCallback
- type Service
- type State
- type StateImpl
- func (s *StateImpl) AfterSunrise(offset ...types.DurationString) bool
- func (s *StateImpl) AfterSunset(offset ...types.DurationString) bool
- func (s *StateImpl) BeforeSunrise(offset ...types.DurationString) bool
- func (s *StateImpl) BeforeSunset(offset ...types.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)
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 types.NewAppRequest) (*App, error)
NewApp establishes the websocket connection and returns an object you can use to register schedules and listeners.
func (*App) Close ¶
Close performs a clean shutdown of the application. It cancels the context, closes the websocket connection, and ensures all background processes are properly terminated.
func (*App) GetService ¶
func (*App) RegisterEntityListeners ¶
func (app *App) RegisterEntityListeners(etls ...EntityListener)
func (*App) RegisterEventListeners ¶
func (app *App) RegisterEventListeners(evls ...EventListener)
func (*App) RegisterIntervals ¶
func (*App) RegisterSchedules ¶
func (app *App) RegisterSchedules(schedules ...DailySchedule)
type BaseEventMsg ¶
type BaseEventMsg struct { Event struct { EventType string `json:"event_type"` } `json:"event"` }
type ConditionCheck ¶ added in v0.7.1
type ConditionCheck struct {
// contains filtered or unexported fields
}
func CheckAllowlistDates ¶ added in v0.7.1
func CheckAllowlistDates(eList []time.Time) ConditionCheck
func CheckDisabledEntity ¶ added in v0.7.1
func CheckDisabledEntity(s State, infos []internal.EnabledDisabledInfo) ConditionCheck
func CheckEnabledEntity ¶ added in v0.7.1
func CheckEnabledEntity(s State, infos []internal.EnabledDisabledInfo) ConditionCheck
func CheckExceptionDates ¶ added in v0.7.1
func CheckExceptionDates(eList []time.Time) ConditionCheck
func CheckExceptionRanges ¶ added in v0.7.1
func CheckExceptionRanges(eList []types.TimeRange) ConditionCheck
func CheckStartEndTime ¶ added in v0.7.1
func CheckStartEndTime(s types.TimeString, isStart bool) ConditionCheck
func CheckStatesMatch ¶ added in v0.7.1
func CheckStatesMatch(listenerState, s string) ConditionCheck
func CheckThrottle ¶ added in v0.7.1
func CheckThrottle(throttle time.Duration, lastRan *carbon.Carbon) ConditionCheck
func CheckWithinTimeRange ¶ added in v0.7.1
func CheckWithinTimeRange(startTime, endTime string) ConditionCheck
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 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 IntervalCallback ¶
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(...types.DurationString) bool BeforeSunrise(...types.DurationString) bool AfterSunset(...types.DurationString) bool BeforeSunset(...types.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 ...types.DurationString) bool
func (*StateImpl) AfterSunset ¶
func (s *StateImpl) AfterSunset(offset ...types.DurationString) bool
func (*StateImpl) BeforeSunrise ¶
func (s *StateImpl) BeforeSunrise(offset ...types.DurationString) bool
func (*StateImpl) BeforeSunset ¶
func (s *StateImpl) BeforeSunset(offset ...types.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 is used to interact with the home assistant REST API.
|
http is used to interact with the home assistant REST API. |
connect
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.