triggers

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

README

TRIGGERS Plugin

Documentation

Documentation

Index

Constants

View Source
const (
	// StateChangeName ...
	StateChangeName = "state_change"
	// StateChangeFunctionName ...
	StateChangeFunctionName = "automationTriggerStateChanged"
)
View Source
const (
	// TopicSystem ...
	TopicSystem = "system/#"
	// SystemName ...
	SystemName = "system"
	// SystemFunctionName ...
	SystemFunctionName = "automationTriggerSystem"
)
View Source
const (
	// TimeName ...
	TimeName = "time"
	// TimeFunctionName ...
	TimeFunctionName = "automationTriggerTime"
	// TimeQueueSize ...
	TimeQueueSize = 10
)
View Source
const (
	// Name ...
	Name = "triggers"
	// TopicSystemStart ...
	TopicSystemStart = "system/event/start" //todo move
	// TopicSystemStop ...
	TopicSystemStop = "system/event/stop" //todo move

	Version = "0.0.1"
)
View Source
const (
	// CronOptionTrigger ...
	CronOptionTrigger = "cron"
)

Variables

Functions

func New

func New() supervisor.Pluggable

New ...

Types

type IGetTrigger

type IGetTrigger interface {
	GetTrigger(string) (ITrigger, error)
}

IGetTrigger ...

type IRegistrar

type IRegistrar interface {
	RegisterTrigger(ITrigger) error
	UnregisterTrigger(string) error
	TriggerList() []string
}

IRegistrar ...

type ITrigger

type ITrigger interface {
	Name() string
	AsyncAttach(wg *sync.WaitGroup)
	Subscribe(Subscriber) error
	Unsubscribe(Subscriber) error
	FunctionName() string
}

todo deAttach

func NewStateChangedTrigger

func NewStateChangedTrigger(eventBus bus.Bus) ITrigger

NewStateChangedTrigger ...

func NewSystemTrigger

func NewSystemTrigger(eventBus bus.Bus) ITrigger

NewSystemTrigger ...

func NewTimeTrigger

func NewTimeTrigger(eventBus bus.Bus,
	scheduler *scheduler.Scheduler) ITrigger

NewTimeTrigger ...

type StateChangeTrigger

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

StateChangeTrigger ...

func (*StateChangeTrigger) AsyncAttach

func (t *StateChangeTrigger) AsyncAttach(wg *sync.WaitGroup)

AsyncAttach ...

func (*StateChangeTrigger) FunctionName

func (b *StateChangeTrigger) FunctionName() string

FunctionName ...

func (*StateChangeTrigger) Name

func (b *StateChangeTrigger) Name() string

Name ...

func (*StateChangeTrigger) Subscribe

func (t *StateChangeTrigger) Subscribe(options Subscriber) error

Subscribe ...

func (*StateChangeTrigger) Unsubscribe

func (t *StateChangeTrigger) Unsubscribe(options Subscriber) error

Unsubscribe ...

type Subscriber

type Subscriber struct {
	EntityId *common.EntityId
	Handler  interface{}
	Payload  m.Attributes
}

Subscriber ...

type SystemTrigger

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

SystemTrigger ...

func (*SystemTrigger) AsyncAttach

func (t *SystemTrigger) AsyncAttach(wg *sync.WaitGroup)

AsyncAttach ...

func (*SystemTrigger) FunctionName

func (b *SystemTrigger) FunctionName() string

FunctionName ...

func (*SystemTrigger) Name

func (b *SystemTrigger) Name() string

Name ...

func (*SystemTrigger) Subscribe

func (t *SystemTrigger) Subscribe(options Subscriber) error

Subscribe ...

func (*SystemTrigger) Unsubscribe

func (t *SystemTrigger) Unsubscribe(options Subscriber) error

Unsubscribe ...

type SystemTriggerMessage added in v0.14.0

type SystemTriggerMessage struct {
	Topic     string      `json:"topic"`
	EventName string      `json:"event_name"`
	Event     interface{} `json:"event"`
}

type TimeTrigger

type TimeTrigger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TimeTrigger ...

func (*TimeTrigger) AsyncAttach

func (t *TimeTrigger) AsyncAttach(wg *sync.WaitGroup)

AsyncAttach ...

func (*TimeTrigger) FunctionName

func (b *TimeTrigger) FunctionName() string

FunctionName ...

func (*TimeTrigger) Name

func (b *TimeTrigger) Name() string

Name ...

func (*TimeTrigger) Subscribe

func (t *TimeTrigger) Subscribe(options Subscriber) error

Subscribe ...

func (*TimeTrigger) Unsubscribe

func (t *TimeTrigger) Unsubscribe(options Subscriber) error

Unsubscribe ...

Jump to

Keyboard shortcuts

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