Documentation
¶
Index ¶
- Constants
- func NewCron() (cron *cr.Cron)
- type Action
- type ActionBind
- type ActionPrototypes
- type Core
- func (c *Core) AddFlow(flow *m.Flow) (err error)
- func (c *Core) AddNode(node *m.Node) (n *Node, err error)
- func (b *Core) AddWorkflow(workflow *m.Workflow) (err error)
- func (c *Core) DeleteWorkflow(workflow *m.Workflow) (err error)
- func (c *Core) DoAction(deviceActionId int64) (result string, err error)
- func (b *Core) DoWorker(worker *m.Worker) (err error)
- func (c *Core) GetFlow(id int64) (*Flow, error)
- func (c *Core) GetNodeById(nodeId int64) *Node
- func (b *Core) GetNodes() (nodes map[int64]*Node)
- func (b *Core) GetWorkflow(workflowId int64) (workflow *Workflow, err error)
- func (b *Core) InitWorkflows() (err error)
- func (c *Core) ReloadNode(node *m.Node) (err error)
- func (c *Core) RemoveFlow(flow *m.Flow) error
- func (b *Core) RemoveNode(node *m.Node) (err error)
- func (b *Core) RemoveWorker(worker *m.Worker) (err error)
- func (c *Core) Run() (err error)
- func (b *Core) Shutdown()
- func (b *Core) Stop() (err error)
- func (c *Core) UpdateFlow(flow *m.Flow) error
- func (b *Core) UpdateFlowFromDevice(device *m.Device) (err error)
- func (b *Core) UpdateWorker(_worker *m.Worker) (err error)
- func (c *Core) UpdateWorkflow(workflow *m.Workflow) (err error)
- func (c *Core) UpdateWorkflowScenario(workflowId int64) (err error)
- type Device
- func (d Device) ModBus(f string, address, count uint16, command []uint16) (result DevModBusResponse)
- func (d Device) Mqtt(path string, payload []byte) (result DevMqttResponse)
- func (d Device) RunCommand(name string, args []string) (result DevCommandResponse)
- func (d Device) SmartBus(command []byte) (result DevSmartBusResponse)
- func (d Device) Zigbee2mqtt(path string, payload []byte) (result DevZigbee2mqttResponse)
- type DeviceBind
- func (d *DeviceBind) GetDescription() string
- func (d *DeviceBind) GetModel() *m.Device
- func (d *DeviceBind) GetName() string
- func (d *DeviceBind) ModBus(f string, address, count uint16, command []uint16) (result DevModBusResponse)
- func (d *DeviceBind) Mqtt(path string, payload []byte) (result DevMqttResponse)
- func (d *DeviceBind) RunCommand(name string, args []string) (result DevCommandResponse)
- func (d *DeviceBind) Send(payload interface{}) (result interface{})
- func (d *DeviceBind) SmartBus(command []byte) (result DevSmartBusResponse)
- func (d *DeviceBind) Zigbee2mqtt(path string, payload []byte) (result DevZigbee2mqttResponse)
- type Flow
- func (f *Flow) AddWorker(model *m.Worker) (err error)
- func (f *Flow) GetMessage() *Message
- func (f *Flow) InitWorkers() (err error)
- func (f *Flow) NewMessage(ctx context.Context) (err error)
- func (f *Flow) NewScript(s ...*m.Script) (engine *scripts.Engine, err error)
- func (f *Flow) Remove()
- func (f *Flow) RemoveWorker(worker *m.Worker) (err error)
- func (f *Flow) SetMessage(msg *Message)
- func (f *Flow) UpdateWorker(worker *m.Worker) (err error)
- type FlowBind
- type FlowElement
- type FlowLink
- type Gateway
- type Map
- type MapBind
- type MapElement
- type MapElementBind
- type Message
- func (m *Message) Clear()
- func (m *Message) Copy() (msg *Message)
- func (m *Message) GetVar(key string) (value interface{})
- func (m *Message) Ok()
- func (m *Message) SetError(err string)
- func (m *Message) SetVar(key string, value interface{})
- func (m *Message) Setdir(d bool)
- func (m *Message) Update(newMsg *Message)
- type MessageEmitter
- type MessageHandler
- type Node
- func (n *Node) Connect() *Node
- func (n *Node) GetConnStatus() string
- func (n *Node) GetStat() NodeStat
- func (n *Node) IsConnected() bool
- func (n *Node) Model() *m.Node
- func (n *Node) MqttPublish(topic string, msg interface{})
- func (n *Node) Remove()
- func (n *Node) Send(device *m.Device, command []byte) (result NodeResponse, err error)
- func (n *Node) UpdateClientParams(params *m.Node)
- type NodeBind
- type NodeMessage
- type NodeResponse
- type NodeStat
- type NodeStatModel
- type NodeStatus
- type Nodes
- type Status
- type Storage
- type Task
- type Worker
- type Workflow
- func (wf *Workflow) AddFlow(flow *m.Flow) (err error)
- func (wf *Workflow) DoWorker(model *m.Worker) (err error)
- func (wf *Workflow) GetFLow(flowId int64) (flow *Flow, err error)
- func (wf *Workflow) NewScript(model *m.Script) (engine *scripts.Engine, err error)
- func (wf *Workflow) RemoveFlow(flow *m.Flow) (err error)
- func (wf *Workflow) RemoveWorker(_worker *m.Worker) (err error)
- func (wf *Workflow) Restart() (err error)
- func (wf *Workflow) Run() (err error)
- func (wf *Workflow) SetScenario(systemName string) (err error)
- func (wf *Workflow) Stop() (err error)
- func (wf *Workflow) UpdateFlow(flow *m.Flow) (err error)
- func (wf *Workflow) UpdateScenario() (err error)
- func (wf *Workflow) UpdateWorker(_worker *m.Worker) (err error)
- type WorkflowBind
- func (w *WorkflowBind) GetDescription() string
- func (w *WorkflowBind) GetName() string
- func (w *WorkflowBind) GetScenario() string
- func (w *WorkflowBind) GetScenarioName() string
- func (w *WorkflowBind) GetVar(key string) interface{}
- func (w *WorkflowBind) SetScenario(system_name string)
- func (w *WorkflowBind) SetVar(key string, value interface{})
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct { Device *m.Device Node *Node ScriptEngine *scripts.Engine // contains filtered or unexported fields }
Action ...
func NewAction ¶
func NewAction(device *m.Device, deviceAction *m.DeviceAction, node *Node, flow *Flow, scriptService *scripts.ScriptService, mqtt *mqtt.Mqtt, adaptors *adaptors.Adaptors, zigbee2mqtt *zigbee2mqtt.Zigbee2mqtt) (action *Action, err error)
NewAction ...
type ActionBind ¶
type ActionBind struct { Id int64 Name string Description string // contains filtered or unexported fields }
Javascript Binding
Action
.Id .Name .Description .Device()
func NewActionBind ¶ added in v0.2.0
func NewActionBind(id int64, name, desc string, action *Action) *ActionBind
NewActionBind ...
type ActionPrototypes ¶
type ActionPrototypes interface { After(*Flow) error Run(*Flow) error Before(*Flow) error Type() string }
ActionPrototypes ...
type Core ¶
Core ...
func NewCore ¶
func NewCore(adaptors *adaptors.Adaptors, scripts *scripts.ScriptService, graceful *graceful_service.GracefulService, cron *cr.Cron, mqtt *mqtt.Mqtt, streamService *stream.StreamService, zigbee2mqtt *zigbee2mqtt.Zigbee2mqtt, metric *metrics.MetricManager) (core *Core, err error)
NewCore ...
func (*Core) AddWorkflow ¶
добавление рабочего процесс
func (*Core) DeleteWorkflow ¶
нельзя удалить workflow, если присутствуют связанные сущности
func (*Core) GetWorkflow ¶
GetWorkflow ...
func (*Core) InitWorkflows ¶
инициализация всего рабочего процесса, с запуском дочерни подпроцессов
func (*Core) RemoveWorker ¶
RemoveWorker ...
func (*Core) UpdateFlowFromDevice ¶
UpdateFlowFromDevice ...
func (*Core) UpdateWorker ¶
UpdateWorker ...
func (*Core) UpdateWorkflow ¶
UpdateWorkflow ...
func (*Core) UpdateWorkflowScenario ¶
UpdateWorkflowScenario ...
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device ...
func NewDevice ¶ added in v0.2.0
func NewDevice(dev *m.Device, node *Node, mqtt *mqtt.Mqtt, adaptors *adaptors.Adaptors, zigbee2mqtt *zigbee2mqtt.Zigbee2mqtt) *Device
NewDevice ...
func (Device) ModBus ¶ added in v0.0.19
func (d Device) ModBus(f string, address, count uint16, command []uint16) (result DevModBusResponse)
ModBus ...
func (Device) RunCommand ¶
run command
func (Device) Zigbee2mqtt ¶ added in v0.2.0
Zigbee2mqtt ...
type DeviceBind ¶
type DeviceBind struct {
// contains filtered or unexported fields
}
Javascript Binding
Device
.GetName() .GetModel() .GetDescription() .RunCommand(command []string) .SmartBus(command []byte) .ModBus(func string, address, count int64, command []byte) .Zigbee2mqtt(path, payload) .Mqtt(path, payload) .Send(params interface)
func NewDeviceBind ¶ added in v0.2.0
func NewDeviceBind(model *m.Device, node *Node, mqtt *mqtt.Mqtt, adaptors *adaptors.Adaptors, zigbee2mqtt *zigbee2mqtt.Zigbee2mqtt) *DeviceBind
NewDeviceBind ...
func (*DeviceBind) ModBus ¶
func (d *DeviceBind) ModBus(f string, address, count uint16, command []uint16) (result DevModBusResponse)
ModBus ...
func (*DeviceBind) Mqtt ¶ added in v0.2.0
func (d *DeviceBind) Mqtt(path string, payload []byte) (result DevMqttResponse)
Mqtt ...
func (*DeviceBind) RunCommand ¶
func (d *DeviceBind) RunCommand(name string, args []string) (result DevCommandResponse)
RunCommand ...
func (*DeviceBind) Send ¶ added in v0.2.0
func (d *DeviceBind) Send(payload interface{}) (result interface{})
Send ...
func (*DeviceBind) SmartBus ¶
func (d *DeviceBind) SmartBus(command []byte) (result DevSmartBusResponse)
SmartBus ...
func (*DeviceBind) Zigbee2mqtt ¶ added in v0.2.0
func (d *DeviceBind) Zigbee2mqtt(path string, payload []byte) (result DevZigbee2mqttResponse)
Zigbee2mqtt ...
type Flow ¶
type Flow struct { Storage Model *m.Flow Connections []*m.Connection FlowElements []*FlowElement Node *Node sync.Mutex Workers map[int64]*Worker // contains filtered or unexported fields }
Flow ...
func NewFlow ¶
func NewFlow(model *m.Flow, workflow *Workflow, adaptors *adaptors.Adaptors, scripts *scripts.ScriptService, cron *cr.Cron, core *Core, mqtt *mqtt.Mqtt, zigbee2mqtt *zigbee2mqtt.Zigbee2mqtt) (flow *Flow, err error)
NewFlow ...
func (*Flow) RemoveWorker ¶
RemoveWorker ...
type FlowBind ¶
type FlowBind struct {
// contains filtered or unexported fields
}
Javascript Binding
Flow
.GetName() .GetDescription() .SetVar(string, interface) .GetVar(string) .Node()
type FlowElement ¶
type FlowElement struct { Model *m.FlowElement Flow *Flow Workflow *Workflow ScriptEngine *scripts.Engine Prototype ActionPrototypes Action *Action // contains filtered or unexported fields }
FlowElement ...
func NewFlowElement ¶
func NewFlowElement(model *m.FlowElement, flow *Flow, workflow *Workflow, adaptors *adaptors.Adaptors) (flowElement *FlowElement, err error)
NewFlowElement ...
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map ...
func NewMap ¶ added in v0.1.2
func NewMap(metric *metrics.MetricManager, adaptors *adaptors.Adaptors) *Map
NewMap ...
func (*Map) GetElement ¶
func (b *Map) GetElement(elementName string) (element *MapElement, err error)
GetElement ...
func (*Map) NewMapElement ¶
func (b *Map) NewMapElement(elementName string, stateSystemName *string) (*MapElement, error)
NewMapElement ...
func (*Map) SetElementState ¶
SetElementState ...
type MapBind ¶
type MapBind struct {
Map *Map
}
Javascript Binding
Map
.SetElementState(elementName, newState) .GetElement(elementName) -> MapElementBind
func (*MapBind) GetElement ¶
func (e *MapBind) GetElement(elementName string) (element *MapElementBind)
GetElement ...
func (*MapBind) SetElementState ¶
SetElementState ...
type MapElement ¶
type MapElement struct { Map *Map Options interface{} State *m.DeviceState // contains filtered or unexported fields }
MapElement ...
func NewMapElement ¶ added in v0.2.0
func NewMapElement(elementName string, systemName *string, _map *Map, adaptors *adaptors.Adaptors) (*MapElement, error)
NewMapElement ...
func (*MapElement) CustomHistory ¶ added in v0.2.0
func (e *MapElement) CustomHistory(logLevel, t, desc string)
CustomHistory ...
type MapElementBind ¶
type MapElementBind struct {
// contains filtered or unexported fields
}
Javascript Binding
MapElement
.SetState(name) .GetState() .SetOptions(options) .GetOptions() .Story(logLevel, type, description)
func (*MapElementBind) GetOptions ¶
func (e *MapElementBind) GetOptions() interface{}
GetOptions ...
func (*MapElementBind) SetOptions ¶
func (e *MapElementBind) SetOptions(options interface{})
SetOptions ...
func (*MapElementBind) Story ¶ added in v0.2.0
func (e *MapElementBind) Story(logLevel, t, desc string)
Story ...
type Message ¶
type Message struct { Error string Success bool Direction bool Mqtt bool // contains filtered or unexported fields }
Message ...
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node ...
func (*Node) GetConnStatus ¶ added in v0.0.25
GetConnStatus ...
func (*Node) MqttPublish ¶ added in v0.0.21
MqttPublish ...
func (*Node) UpdateClientParams ¶ added in v0.0.25
UpdateClientParams ...
type NodeBind ¶
type NodeBind struct {
// contains filtered or unexported fields
}
Javascript Binding
Node
.Name() .Status() .Stat() .Description() .IsConnected()
type NodeMessage ¶
type NodeMessage struct { DeviceId int64 `json:"device_id"` DeviceType common.DeviceType `json:"device_type"` Properties json.RawMessage `json:"properties"` Command json.RawMessage `json:"command"` }
NodeMessage ...
type NodeResponse ¶
type NodeResponse struct { DeviceId int64 `json:"device_id"` DeviceType common.DeviceType `json:"device_type"` Properties json.RawMessage `json:"properties"` Response json.RawMessage `json:"response"` Status string `json:"status"` Time float64 `json:"time"` }
NodeResponse ...
type NodeStat ¶ added in v0.0.25
type NodeStat struct { Status NodeStatus `json:"status"` Thread int `json:"thread"` Rps int64 `json:"rps"` Min int64 `json:"min"` Max int64 `json:"max"` StartedAt time.Time `json:"started_at"` LastPing time.Time `json:"last_ping"` ConnStatus string `json:"conn_status"` IsConnected bool `json:"is_connected"` }
NodeStat ...
type NodeStatModel ¶
type NodeStatModel struct { Status NodeStatus `json:"status"` Thread int `json:"thread"` Rps int64 `json:"rps"` Min int64 `json:"min"` Max int64 `json:"max"` StartedAt time.Time `json:"started_at"` }
NodeStatModel ...
type Worker ¶
Worker ...
type Workflow ¶
type Workflow struct { Storage sync.Mutex Flows map[int64]*Flow // contains filtered or unexported fields }
Workflow ...
func NewWorkflow ¶
func NewWorkflow(model *m.Workflow, adaptors *adaptors.Adaptors, scripts *scripts.ScriptService, cron *cr.Cron, core *Core, mqtt *mqtt.Mqtt, zigbee2mqtt *zigbee2mqtt.Zigbee2mqtt, metric *metrics.MetricManager) (workflow *Workflow)
NewWorkflow ...
func (*Workflow) RemoveFlow ¶
RemoveFlow ...
func (*Workflow) RemoveWorker ¶ added in v0.0.25
RemoveWorker ...
func (*Workflow) SetScenario ¶
SetScenario ...
func (*Workflow) UpdateFlow ¶
UpdateFlow ...
func (*Workflow) UpdateScenario ¶
UpdateScenario ...
type WorkflowBind ¶
type WorkflowBind struct {
// contains filtered or unexported fields
}
Javascript Binding
Workflow
.GetName() .GetDescription() .SetVar(string, interface) .GetVar(string) .GetScenario() string .GetScenarioName() string .SetScenario(string)
func (*WorkflowBind) GetDescription ¶
func (w *WorkflowBind) GetDescription() string
GetDescription ...
func (*WorkflowBind) GetScenarioName ¶
func (w *WorkflowBind) GetScenarioName() string
GetScenarioName ...
func (*WorkflowBind) SetScenario ¶
func (w *WorkflowBind) SetScenario(system_name string)
SetScenario ...
func (*WorkflowBind) SetVar ¶
func (w *WorkflowBind) SetVar(key string, value interface{})
SetVar ...
Source Files
¶
- action.go
- action_bind.go
- core.go
- cron.go
- device.go
- device_bind.go
- flow.go
- flow_bind.go
- flow_element.go
- flow_link.go
- gateway.go
- map.go
- map_bind.go
- map_element.go
- map_element_bind.go
- message.go
- message_emitter.go
- message_handler.go
- models.go
- node.go
- node_bind.go
- prototypes.go
- status.go
- storage.go
- task.go
- worker.go
- workflow.go
- workflow_bind.go