types

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(input, output interface{}, hooks ...mapstructure.DecodeHookFunc) error

func StringInterfaceToJsonRawMessage

func StringInterfaceToJsonRawMessage(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)

Types

type Action

type Action uint16

Action is an enum of all the possible commands

const (
	SET    Action = iota // Turn on/activate something
	RESET                // Turn off/deactivate something
	TOGGLE               // Toggle something from on/activated to off/deactivated
	PUSH                 // Used to define actions shuch as the one of pushing a button
	GET                  // Retrieve a value
)

Available actions

type AnalogCommand added in v1.5.0

type AnalogCommand struct {
	ApplianceID string          `json:"applianceID"`
	Value       float64         `json:"value,float"`
	ValueType   AnalogValueType `json:"value_type,int,omitempty"`
}

AnalogCommand is a command to set a value on an analog device. By default the ValueType is 0: Absolute.

type AnalogValueType added in v1.5.0

type AnalogValueType uint8

AnalogValueType is an enum to define how to handle an analog value

const (
	Absolute AnalogValueType = iota
	Relative
)

Available AnalogValueType

type Command

type Command struct {
	Type CommandType     `json:"type"`
	Data json.RawMessage `json:"data"`
}

Command is the root object in every message

func NewCommand

func NewCommand(t CommandType, data interface{}) *Command

NewCommand creates a command given a type and his content

func (*Command) String

func (c *Command) String() string

type CommandType

type CommandType uint8

CommandType represent the type of the current message

const (
	HeartbeatType CommandType = iota
	DigitalCommandType
	AnalogCommandType
	StatusSubscriptionCommandType
	StatusNotificationCommandType
	VersionRequestCommandType
	VersionReplyCommandType

	// Actor commands: request and reply
	ActionRequestCommandType
	ActionReplyCommandType

	// private commands (sent on the loopback address)
	StatusUpdateCommandType
	IODeviceStatusChangedCommandType

	// Telegram notifications
	TelegramNotificationCommandType

	// special command types
	AnyIncomingCommandType
	AnyOutgoingCommandType
)

Command types types used in various plugins

func (CommandType) String

func (i CommandType) String() string

type DigitalCommand

type DigitalCommand struct {
	Action      Action `json:"action,int"`
	ApplianceID string `json:"applianceID"`
}

DigitalCommand used to instruct the appliance to execute a Command on a gpio pin

type EnabledDays

type EnabledDays uint16

EnabledDays days on which a TimedCommand is enabled used as binary flag

type SimpleCommand

type SimpleCommand struct {
	Action Action `json:"action,int"`
}

SimpleCommand is used to send a basic request regarding the whole system

type Status

type Status map[string]interface{}

Status is the response to a status request Command the key is the handler name value can be anything

type TimeIndication added in v1.5.0

type TimeIndication struct {
	Hour   int `json:"hour"`
	Minute int `json:"minute"`
}

TimeIndication defines a basic struct for time with resolution of 1 min

type VersionIndication

type VersionIndication struct {
	CurrentVersion   string
	AvailableVersion string
}

VersionIndication returns info about the current version and the optional update available

Jump to

Keyboard shortcuts

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