service

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
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

func (*ConfigService) Init

func (s *ConfigService) Init(bus core.Bus) error

Init load the service

func (*ConfigService) Key

func (s *ConfigService) Key() string

Key that identifies 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) Key

func (s *ItemService) Key() string

Key that identifies 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) Init

func (s *ScriptService) Init(bus core.Bus) error

Init load the service

func (*ScriptService) Key

func (s *ScriptService) Key() string

Key that identifies 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

func (e *TimeEntry) DaysToWait(today time.Weekday) int

DaysToWait returns the amount of days between today and trigger

func (*TimeEntry) Next

func (e *TimeEntry) Next(now time.Time) time.Time

Next returns the next time for trigger

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer triggers on time entries

func (*Timer) AddEntry

func (t *Timer) AddEntry(entry TimeEntry)

AddEntry to timer

func (*Timer) AddItemValue

func (t *Timer) AddItemValue(itemValue string)

AddItemValue to set on trigger event

func (*Timer) Dump

func (t *Timer) Dump() map[string]interface{}

Dump timer information

func (*Timer) ListEntries

func (t *Timer) ListEntries() []TimeEntry

ListEntries return time entries

func (*Timer) RemoveEntry

func (t *Timer) RemoveEntry(idx int)

RemoveEntry from timer

func (*Timer) RemoveItemValue

func (t *Timer) RemoveItemValue(itemValue string)

RemoveItemValue from timer

func (*Timer) Start

func (t *Timer) Start()

Start the timer handling

func (*Timer) Stop

func (t *Timer) Stop()

Stop the timer handling

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) Init

func (s *TimerService) Init(bus core.Bus) error

Init load the service

func (*TimerService) Key

func (s *TimerService) Key() string

Key that identifies 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) Start

func (s *TimerService) Start(bus core.Bus) error

Start timers

func (*TimerService) Update

func (s *TimerService) Update(bus core.Bus)

Update saves actual timers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL