linkedge

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TriggerTypeSchedule 触发器:时间表
	TriggerTypeSchedule triggerType = "schedule"
	// TriggerTypeDevicePoint 触发器:设备点位
	TriggerTypeDevicePoint triggerType = "devicePoint"
	// TriggerTypeDeviceEvent 触发器:设备事件
	TriggerTypeDeviceEvent triggerType = "deviceEvent"

	// ConditionTypeDevicePoint 执行条件:设备点位
	ConditionTypeDevicePoint conditionType = "devicePoint"
	//执行条件:有些运行时间段
	ConditionExecuteTime conditionType = "executeTime"
	// ConditionLastTime 执行条件 持续时间
	ConditionLastTime conditionType = "lastTime"
	// ConditionDateInterval 日期间隔,示例:01-01 ~ 05-01
	// Deprecated: 已废弃,请拆分为多个条件,例如:年(数组)、月(数组)、日(数组)、周(数组)、时间段(数组)
	ConditionDateInterval conditionType = "dateInterval"
	// ConditionYears 执行条件-年(数组)
	ConditionYears conditionType = "years"
	// ConditionMonths 执行条件-月(数组)
	ConditionMonths conditionType = "months"
	// ConditionDays 执行条件-日(数组)
	ConditionDays conditionType = "days"
	// ConditionWeeks 执行条件-周(数组)
	ConditionWeeks conditionType = "weeks"
	// ConditionTimes 执行条件-时间段(数组)
	ConditionTimes conditionType = "times"

	// 执行类型:设置设备点位
	ActionTypeDevicePoint ActionType = "devicePoint"
	// 执行类型:触发场景联动
	ActionTypeLinkEdge ActionType = "linkEdge"

	ConditionEq conditionSymbol = "="
	ConditionNe conditionSymbol = "!="
	ConditionGt conditionSymbol = ">"
	ConditionGe conditionSymbol = ">="
	ConditionLt conditionSymbol = "<"
	ConditionLe conditionSymbol = "<="

	EventCodeLinkEdgeTrigger = "linkEdgeTrigger"
	//场景联动执行结果:全部成功、部分成功、全部失败
	LinkEdgeExecuteResultAllSuccess  = "success"
	LinkEdgeExecuteResultPartSuccess = "partSuccess"
	LinkEdgeExecuteResultAllFail     = "fail"
)
View Source
const (
	LinkConfigPath = "./config/linkedge" // 场景联动配置路径
)

Variables

View Source
var ActionListIsEmptyErr = errors.New("linkEdge action list cannot be empty")

ActionListIsEmptyErr action 列表为空错误

Functions

This section is empty.

Types

type ActionType

type ActionType string

type BaseResponse

type BaseResponse struct {
	Success   bool        `json:"success"`
	ErrorCode int         `json:"errorCode"`
	ErrorMsg  string      `json:"errorMsg"`
	Data      interface{} `json:"data"`
}

type EnvConfig

type EnvConfig struct {
	ConfigPath string
}

type Export

type Export struct {
	EnvConfig EnvConfig
	// contains filtered or unexported fields
}

func NewExport

func NewExport() *Export

func (*Export) ExportTo

func (export *Export) ExportTo(deviceData plugin.DeviceData)

点位变化触发场景联动

func (*Export) Init

func (export *Export) Init() error

func (*Export) IsReady

func (export *Export) IsReady() bool

func (*Export) OnEvent

func (export *Export) OnEvent(eventCode string, key string, eventValue interface{}) error

继承Export OnEvent接口

type ModelConfig

type ModelConfig struct {
	//场景ID
	Id string `json:"id,omitempty"`
	//是否可用
	Enable bool `json:"enable"`
	//场景名称
	Name string `json:"name"`
	//场景标签
	Tags []string `json:"tags"`
	// 场景描述
	Description string `json:"description"`
	// 静默期,单位:秒
	SilentPeriod int64 `json:"silentPeriod"`
	// 触发器
	Trigger []interface{} `json:"trigger"`
	// 场景联动的执行条件
	Condition []interface{} `json:"condition"`
	// 执行动作
	Action []interface{} `json:"action"`
	// contains filtered or unexported fields
}

场景联动配置模型

func (ModelConfig) GetExecuteTime

func (mc ModelConfig) GetExecuteTime() time.Time

获取该场景最近一次执行时间

Jump to

Keyboard shortcuts

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