Documentation ¶
Index ¶
- Constants
- type ConfigService
- type ItemService
- type ScriptService
- func (s *ScriptService) APIEndpoints(bus core.Bus) []core.PathEntry
- func (s *ScriptService) AddModule(module core.ScriptModule) error
- func (s *ScriptService) Handlers() map[string]core.RequestHandler
- func (s *ScriptService) Init(bus core.Bus) error
- func (s *ScriptService) Key() string
- func (s *ScriptService) Shutdown(bus core.Bus)
- func (s *ScriptService) Start(bus core.Bus) error
- func (s *ScriptService) Update(bus core.Bus)
- type TimeEntry
- type Timer
- func (t *Timer) AddEntry(entry TimeEntry)
- func (t *Timer) AddItemValue(itemValue string)
- func (t *Timer) Dump() map[string]interface{}
- func (t *Timer) ListEntries() []TimeEntry
- func (t *Timer) RemoveEntry(idx int)
- func (t *Timer) RemoveItemValue(itemValue string)
- func (t *Timer) Start()
- func (t *Timer) Stop()
- type TimerService
- func (s *TimerService) APIEndpoints(bus core.Bus) []core.PathEntry
- func (s *TimerService) Events() map[string]api.SimpleHandler
- func (s *TimerService) Handlers() map[string]core.RequestHandler
- func (s *TimerService) Init(bus core.Bus) error
- func (s *TimerService) Key() string
- func (s *TimerService) SetEventTrigger(trigger core.EventTrigger)
- func (s *TimerService) Shutdown(bus core.Bus)
- func (s *TimerService) Start(bus core.Bus) error
- func (s *TimerService) Update(bus core.Bus)
Constants ¶
const ( Sunday int = 1 << iota Monday Tuesday Wednesday Thursday Friday Saturday Everyday = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday )
possible weekdays
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
ConfigService stores persistent configurations
func NewConfigService ¶
func NewConfigService(configFile string) *ConfigService
NewConfigService loads conf if exists and creates service
func (*ConfigService) Handlers ¶
func (s *ConfigService) Handlers() map[string]core.RequestHandler
Handlers for this service
type ItemService ¶
type ItemService struct {
// contains filtered or unexported fields
}
ItemService manages all items of application instance
func NewItemService ¶
func NewItemService() *ItemService
NewItemService creates the item service instance
func (*ItemService) APIEndpoints ¶
func (s *ItemService) APIEndpoints(bus core.Bus) []core.PathEntry
APIEndpoints for item service
func (*ItemService) Events ¶
func (s *ItemService) Events() map[string]api.SimpleHandler
Events returns all events that can be emitted
func (*ItemService) Handlers ¶
func (s *ItemService) Handlers() map[string]core.RequestHandler
Handlers for this service
func (*ItemService) SetEventTrigger ¶
func (s *ItemService) SetEventTrigger(trigger core.EventTrigger)
SetEventTrigger for service
type ScriptService ¶
type ScriptService struct {
// contains filtered or unexported fields
}
ScriptService manages all script instances
func (*ScriptService) APIEndpoints ¶
func (s *ScriptService) APIEndpoints(bus core.Bus) []core.PathEntry
APIEndpoints for service
func (*ScriptService) AddModule ¶
func (s *ScriptService) AddModule(module core.ScriptModule) error
AddModule to script definition
func (*ScriptService) Handlers ¶
func (s *ScriptService) Handlers() map[string]core.RequestHandler
Handlers for this service
func (*ScriptService) Shutdown ¶
func (s *ScriptService) Shutdown(bus core.Bus)
Shutdown saves actual scripts
func (*ScriptService) Start ¶
func (s *ScriptService) Start(bus core.Bus) error
Start scripts that are enabled
func (*ScriptService) Update ¶
func (s *ScriptService) Update(bus core.Bus)
Update saves actual scripts
type TimeEntry ¶
type TimeEntry struct { Active bool `json:"active"` Time int `json:"time"` // seconds since midnight Repeat int `json:"repeat"` State interface{} `json:"state"` }
TimeEntry holds information about next trigger time
func (*TimeEntry) DaysToWait ¶
DaysToWait returns the amount of days between today and trigger
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer triggers on time entries
func (*Timer) AddItemValue ¶
AddItemValue to set on trigger event
func (*Timer) ListEntries ¶
ListEntries return time entries
func (*Timer) RemoveItemValue ¶
RemoveItemValue from timer
type TimerService ¶
type TimerService struct {
// contains filtered or unexported fields
}
TimerService handles timer objects
func (*TimerService) APIEndpoints ¶
func (s *TimerService) APIEndpoints(bus core.Bus) []core.PathEntry
APIEndpoints for service
func (*TimerService) Events ¶
func (s *TimerService) Events() map[string]api.SimpleHandler
Events returns all events that can be emitted
func (*TimerService) Handlers ¶
func (s *TimerService) Handlers() map[string]core.RequestHandler
Handlers for this service
func (*TimerService) SetEventTrigger ¶
func (s *TimerService) SetEventTrigger(trigger core.EventTrigger)
SetEventTrigger for service
func (*TimerService) Shutdown ¶
func (s *TimerService) Shutdown(bus core.Bus)
Shutdown saves actual timers
func (*TimerService) Update ¶
func (s *TimerService) Update(bus core.Bus)
Update saves actual timers