trigger

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alarm

type Alarm struct {
	engine.TriggerNode
	Hour   int
	Minute int
	Days   []time.Weekday // empty → daily
	// contains filtered or unexported fields
}

Alarm fires at a specific local time of day, optionally restricted to a set of weekdays. Empty Days means every day.

func NewAlarm

func NewAlarm(id string, timeOfDay string, days []string) (*Alarm, error)

NewAlarm builds an Alarm from a "HH:MM" string and an optional list of day abbreviations ("mon", "tue", ...). Returns an error on malformed input.

func (*Alarm) Close

func (a *Alarm) Close() error

func (*Alarm) Setup

func (a *Alarm) Setup(_ context.Context) error

func (*Alarm) Wait

func (a *Alarm) Wait(ctx context.Context) (engine.Event, error)

type Delay

type Delay struct {
	engine.TriggerNode
	Duration time.Duration
	// contains filtered or unexported fields
}

Delay fires exactly once after its configured duration, measured from Setup. Subsequent Wait calls block on ctx indefinitely — the single-shot semantics mirror the codegen pattern (Ticker::OneShot at startup).

func NewDelay

func NewDelay(id string, d time.Duration) *Delay

func (*Delay) Close

func (d *Delay) Close() error

func (*Delay) Setup

func (d *Delay) Setup(_ context.Context) error

func (*Delay) Wait

func (d *Delay) Wait(ctx context.Context) (engine.Event, error)

type Direction

type Direction string

Direction selects which side of a crossing fires the trigger.

const (
	DirRising  Direction = "rising"
	DirFalling Direction = "falling"
	DirBoth    Direction = "both"
)

type Edge

type Edge string

Edge selects which transitions fire the trigger.

const (
	EdgeRising  Edge = "rising"
	EdgeFalling Edge = "falling"
	EdgeBoth    Edge = "both"
)

type OnMqttMessage

type OnMqttMessage struct {
	engine.TriggerNode
	// contains filtered or unexported fields
}

OnMqttMessage fires whenever a message matching the configured topic filter arrives on the bound MQTT channel. The payload is parsed as bare JSON into a value of the declared dataType; mismatches are logged and dropped so a single bad message can't crash the trigger goroutine.

func NewOnMqttMessage

func NewOnMqttMessage(id string, ch *channel.MQTT, topic string, dataType workflow.DataType, binding workflow.OutputBinding, qos byte) (*OnMqttMessage, error)

NewOnMqttMessage creates a new OnMqttMessage trigger.

func (*OnMqttMessage) Close

func (*OnMqttMessage) Close() error

func (*OnMqttMessage) Outputs

func (t *OnMqttMessage) Outputs() map[string]workflow.DataType

func (*OnMqttMessage) Wait

func (t *OnMqttMessage) Wait(ctx context.Context) (engine.Event, error)

type OnPinEdge

type OnPinEdge struct {
	engine.TriggerNode
	// contains filtered or unexported fields
}

OnPinEdge fires when a digital pin sees the configured edge transition.

func NewOnPinEdge

func NewOnPinEdge(id string, gpioin *channel.GPIOInput, edge Edge) *OnPinEdge

NewOnPinEdge subscribes to the channel's edge stream and returns the trigger.

func (*OnPinEdge) Close

func (p *OnPinEdge) Close() error

func (*OnPinEdge) Wait

func (p *OnPinEdge) Wait(ctx context.Context) (engine.Event, error)

type OnSerialReceive

type OnSerialReceive struct {
	engine.TriggerNode
	// contains filtered or unexported fields
}

OnSerialReceive fires whenever a line is received on the configured UART channel, emitting the line (terminator stripped) to its output binding.

func NewOnSerialReceive

func NewOnSerialReceive(id string, uart *channel.UART, binding workflow.OutputBinding) *OnSerialReceive

NewOnSerialReceive creates a new OnSerialReceive trigger.

func (*OnSerialReceive) Close

func (t *OnSerialReceive) Close() error

func (*OnSerialReceive) Outputs

func (t *OnSerialReceive) Outputs() map[string]workflow.DataType

func (*OnSerialReceive) Wait

func (t *OnSerialReceive) Wait(ctx context.Context) (engine.Event, error)

type OnThreshold

type OnThreshold struct {
	engine.TriggerNode
	// contains filtered or unexported fields
}

OnThreshold fires when a watched numeric variable crosses a threshold.

func NewOnThreshold

func NewOnThreshold(
	id string,
	variable workflow.Reference,
	threshold float64,
	direction Direction,
	deadband float64,
	output *workflow.OutputBinding,
	scope *engine.Scope,
) *OnThreshold

func (*OnThreshold) Close

func (t *OnThreshold) Close() error

func (*OnThreshold) Outputs

func (t *OnThreshold) Outputs() map[string]workflow.DataType

Outputs advertises the triggering-value slot only when an emit-mode binding is configured — matches the convention used elsewhere for optional outputs.

func (*OnThreshold) Wait

func (t *OnThreshold) Wait(ctx context.Context) (engine.Event, error)

type Ticker

type Ticker struct {
	engine.TriggerNode
	Interval time.Duration
	// contains filtered or unexported fields
}

Ticker fires periodically at a fixed interval.

func NewTicker

func NewTicker(id string, interval time.Duration) *Ticker

func (*Ticker) Close

func (t *Ticker) Close() error

func (*Ticker) Setup

func (t *Ticker) Setup(_ context.Context) error

func (*Ticker) Wait

func (t *Ticker) Wait(ctx context.Context) (engine.Event, error)

Jump to

Keyboard shortcuts

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