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 ¶
View Source
var F embed.FS
Functions ¶
Types ¶
type EventEntityState ¶ added in v0.16.1
type EventEntityState struct { EntityId common.EntityId `json:"entity_id"` Value interface{} `json:"value"` State *events.EntityState `json:"state"` Attributes m.AttributeValue `json:"attributes"` Settings m.AttributeValue `json:"settings"` LastChanged *time.Time `json:"last_changed"` LastUpdated *time.Time `json:"last_updated"` }
type IGetTrigger ¶
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 ¶
NewStateChangedTrigger ...
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) 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) 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 TimeTrigger ¶
TimeTrigger ...
func (*TimeTrigger) AsyncAttach ¶
func (t *TimeTrigger) AsyncAttach(wg *sync.WaitGroup)
AsyncAttach ...
func (*TimeTrigger) Subscribe ¶
func (t *TimeTrigger) Subscribe(options Subscriber) error
Subscribe ...
func (*TimeTrigger) Unsubscribe ¶
func (t *TimeTrigger) Unsubscribe(options Subscriber) error
Unsubscribe ...
type TriggerStateChangedMessage ¶ added in v0.16.1
type TriggerStateChangedMessage struct { StorageSave bool `json:"storage_save"` DoNotSaveMetric bool `json:"do_not_save_metric"` PluginName string `json:"plugin_name"` EntityId common.EntityId `json:"entity_id"` OldState EventEntityState `json:"old_state"` NewState EventEntityState `json:"new_state"` }
Click to show internal directories.
Click to hide internal directories.