Documentation
¶
Index ¶
- type Command
- type CommandAck
- type CommandParameter
- type CommandParameters
- type CommandRequest
- type CommandRequestRetryOption
- type CommandStatus
- type Config
- type Device
- type DeviceType
- type DeviceTypeKnxProtocol
- type DeviceTypeModbusProtocol
- type DeviceTypeModbusRegister
- type DownlinkRetryOption
- type Event
- type ExecutionRetryOption
- type LocationPointSchema
- type Measure
- type Node
- type NodeProtocol
- type Platform
- type Project
- func (p Project) CreateEvent(ctx context.Context, event Event) error
- func (p Project) GetDevice(ctx context.Context, uuid string) (Device, error)
- func (p Project) GetDeviceType(ctx context.Context, uuid string) (DeviceType, error)
- func (p Project) GetDeviceTypes(ctx context.Context) ([]DeviceType, error)
- func (p Project) GetDevices(ctx context.Context) ([]Device, error)
- func (p Project) GetNode(ctx context.Context, uuid string) (Node, error)
- func (p Project) GetNodes(ctx context.Context) ([]Node, error)
- func (p Project) GetRule(ctx context.Context, uuid string) (Rule, error)
- func (p Project) GetRules(ctx context.Context) ([]Rule, error)
- func (p Project) SendCommand(ctx context.Context, command Command) error
- type Rule
- type RuleAction
- type RuleCondition
- type RuleTrigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Uuid string `json:"uuid"`
Name string `json:"name"`
ProjectId string `json:"projectId"`
NodeId *string `json:"nodeId,omitempty"`
DeviceId *string `json:"deviceId,omitempty"`
Parameters CommandParameters `json:"parameters"`
Metadata map[string]any `json:"metadata,omitempty"`
Status CommandStatus `json:"status"`
DownlinkRetry *DownlinkRetryOption `json:"downlinkRetry,omitempty"`
ExecutionRetry *ExecutionRetryOption `json:"executionRetry,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
ReceivedAt *time.Time `json:"receivedAt,omitempty"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
FailedAt *time.Time `json:"failedAt,omitempty"`
}
type CommandAck ¶
type CommandAck struct {
Uuid string `json:"uuid"`
Status CommandStatus `json:"status"`
Extras map[string]any `json:"-"`
}
func (CommandAck) MarshalJSON ¶
func (c CommandAck) MarshalJSON() ([]byte, error)
func (*CommandAck) UnmarshalJSON ¶
func (c *CommandAck) UnmarshalJSON(data []byte) error
type CommandParameter ¶
type CommandParameters ¶
type CommandParameters []CommandParameter
func (CommandParameters) MarshalJSON ¶
func (c CommandParameters) MarshalJSON() ([]byte, error)
func (*CommandParameters) UnmarshalJSON ¶
func (c *CommandParameters) UnmarshalJSON(data []byte) error
type CommandRequest ¶
type CommandRequest struct {
Name string `json:"name"`
ProjectId string `json:"projectId"`
NodeId *string `json:"nodeId,omitempty"`
DeviceId *string `json:"deviceId,omitempty"`
Parameters CommandParameters `json:"parameters"`
Metadata map[string]any `json:"metadata,omitempty"`
DownlinkRetry *CommandRequestRetryOption `json:"downlinkRetry,omitempty"`
ExecutionRetry *CommandRequestRetryOption `json:"executionRetry,omitempty"`
}
func (CommandRequest) MakeCommand ¶
func (c CommandRequest) MakeCommand(status ...CommandStatus) Command
type CommandRequestRetryOption ¶
type CommandRequestRetryOption struct {
MaxRetries *int `json:"maxRetries,omitempty"`
}
type CommandStatus ¶
type CommandStatus string
const ( CMD_STATUS_PENDING CommandStatus = "pending" CMD_STATUS_RECEIVED CommandStatus = "received" CMD_STATUS_COMPLETED CommandStatus = "completed" CMD_STATUS_FAILED CommandStatus = "failed" )
type Device ¶
type Device struct {
Uuid string `json:"uuid,omitempty"`
ProjectID string `json:"projectId"`
DeviceTypeID string `json:"deviceTypeId,omitempty"`
NodeID string `json:"nodeId,omitempty"`
Encoder string `json:"encoder,omitempty"`
Decoder string `json:"decoder,omitempty"`
FirmwareVersion string `json:"firmwareVersion,omitempty"`
PlantID string `json:"plantId,omitempty"`
Location *LocationPointSchema `json:"location,omitempty"`
SerialNumber string `json:"serialNumber,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
DeviceType *DeviceType `json:"deviceType,omitempty"`
Metadata map[string]any `json:"metadata"`
State any `json:"state"`
StateUpdatedAt any `json:"stateUpdatedAt"`
LastActivityAt string `json:"lastActivityAt"`
LastCommunicationAt string `json:"lastCommunicationAt"`
ConnectivityStatus string `json:"connectivityStatus"`
LastConnectionAt string `json:"lastConnectionAt"`
LastDisconnectionAt string `json:"lastDisconnectionAt"`
Tags []string `json:"tags"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// contains filtered or unexported fields
}
type DeviceType ¶
type DeviceType struct {
Uuid string `json:"uuid,omitempty"`
ProjectID string `json:"projectId"`
Visibility string `json:"visibility,omitempty"`
Encoder string `json:"encoder,omitempty"`
Decoder string `json:"decoder,omitempty"`
FirmwareID string `json:"firmwareId,omitempty"`
FirmwareVersions []string `json:"firmwareVersions"`
Model string `json:"model,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
Category string `json:"category,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Protocols *struct {
Modbus *DeviceTypeModbusProtocol `json:"modbus,omitempty"`
Knx *DeviceTypeKnxProtocol `json:"knx,omitempty"`
} `json:"protocols,omitempty"`
Metadata map[string]any `json:"metadata"`
Commands any `json:"commands"`
Events any `json:"events"`
Properties any `json:"properties"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// contains filtered or unexported fields
}
type DeviceTypeKnxProtocol ¶
type DeviceTypeModbusProtocol ¶
type DeviceTypeModbusProtocol struct {
Endianness string `json:"endianness"`
Registers []DeviceTypeModbusRegister `json:"registers"`
}
type DeviceTypeModbusRegister ¶
type DeviceTypeModbusRegister struct {
Register uint16 `json:"register"`
Read bool `json:"read"`
ModbusFunctionRead int `json:"modbusFunctionRead"`
Write bool `json:"write"`
ModbusFunctionWrite int `json:"modbusFunctionWrite,omitempty"`
Words byte `json:"words"`
BitwiseReading bool `json:"bitwiseReading"`
Properties []struct {
Index int `json:"index"`
Name string `json:"name"`
} `json:"properties"`
ScaleFactor *float64 `json:"scaleFactor,omitempty"`
Type string `json:"type"`
}
type DownlinkRetryOption ¶
type Event ¶
type Event struct {
Uuid string `json:"uuid,omitempty"`
ProjectID string `json:"projectId"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
EventTime time.Time `json:"eventTime,omitempty"`
Source string `json:"source"`
Metadata map[string]any `json:"metadata,omitempty"`
Data any `json:"data,omitempty"`
}
type ExecutionRetryOption ¶
type LocationPointSchema ¶
type Node ¶
type Node struct {
Uuid string `json:"uuid,omitempty"`
ProjectID string `json:"projectId"`
PlantID string `json:"plantId,omitempty"`
Name string `json:"name"`
Model string `json:"model,omitempty"`
NodeTypeID string `json:"nodeTypeId,omitempty"`
SerialNumber string `json:"serialNumber,omitempty"`
Location *LocationPointSchema `json:"location,omitempty"`
Protocols []NodeProtocol `json:"protocols,omitempty"`
Metadata map[string]any `json:"metadata"`
Retry *struct {
Enabled bool `json:"enabled"`
MaxRetries int `json:"maxRetries"`
BackoffBase float64 `json:"backoffBase"`
BackoffFactor float64 `json:"backoffFactor"`
BackoffTimeLimit int `json:"backoffTimeLimit"`
} `json:"retry,omitempty"`
ConnectivityStatus string `json:"connectivityStatus"`
LastConnectionAt string `json:"lastConnectionAt"`
LastCommunicationAt string `json:"lastCommunicationAt"`
LastDisconnectionAt string `json:"lastDisconnectionAt"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags"`
Rules []string `json:"rules,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// contains filtered or unexported fields
}
type NodeProtocol ¶
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
func (Platform) GetProject ¶
type Project ¶
type Project struct {
Uuid string `json:"uuid"`
Name string `json:"name"`
Description string `json:"description"`
Metadata map[string]any `json:"metadata,omitempty"`
Features []any `json:"features"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// contains filtered or unexported fields
}
func (Project) GetDeviceType ¶
func (Project) GetDeviceTypes ¶
func (p Project) GetDeviceTypes(ctx context.Context) ([]DeviceType, error)
type Rule ¶
type Rule struct {
Uuid string `json:"uuid"`
ProjectId string `json:"projectId"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Tags []string `json:"tags,omitempty"`
Status string `json:"status"`
AllowConcurrent bool `json:"allowConcurrent"`
Mode string `json:"mode"`
Triggers []RuleTrigger `json:"triggers"`
Actions []RuleAction `json:"actions"`
ElseActions []RuleAction `json:"elseActions"`
Condition *RuleCondition `json:"condition,omitempty"`
// contains filtered or unexported fields
}
type RuleAction ¶
type RuleAction struct {
Type string `json:"type"`
// Type wasm
Label *string `json:"label,omitempty"`
Language *string `json:"language,omitempty"`
Source *string `json:"source,omitempty"`
Binary *string `json:"binary,omitempty"`
Hash *string `json:"hash,omitempty"`
// Type log
Value *string `json:"value,omitempty"`
// Type webhook
Uri *string `json:"uri,omitempty"`
Payload *string `json:"payload,omitempty"`
// Type command
Command map[string]any `json:"command,omitempty"`
DeviceId *string `json:"deviceId,omitempty"`
// Type delay
Time *int64 `json:"time,omitempty"`
}
type RuleCondition ¶
Click to show internal directories.
Click to hide internal directories.