types

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: GPL-3.0 Imports: 9 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)

func StringToTimeIndication added in v1.8.0

func StringToTimeIndication(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
	StatusCommandType
	StatusNotificationCommandType
	VersionRequestCommandType
	VersionReplyCommandType

	// Actor commands: request and reply
	ActionRequestCommandType
	ActionReplyCommandType

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

	// Telegram notifications
	TelegramNotificationCommandType

	// Systemd
	SystemdRequestCommandType
	SystemdReplyCommandType

	// Snapcast
	SnapcastManagerCommandType
	SnapcastClientCommandType
	SnapcastGroupCommandType

	// special command types
	AnyIncomingCommandType
	AnyOutgoingCommandType
	RemoteStopCommandType
)

Command types types used in various plugins

func (CommandType) String

func (i CommandType) String() string

type Comparable added in v1.8.0

type Comparable interface {
	Compare(other Comparable) (int8, error)
}

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 int64

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

func ParseTimeIndication added in v1.8.0

func ParseTimeIndication(input string) (data TimeIndication, err error)

func (TimeIndication) Compare added in v1.8.0

func (t TimeIndication) Compare(other Comparable) (int8, error)

func (TimeIndication) MarshalJSON added in v1.8.0

func (sq TimeIndication) MarshalJSON() ([]byte, error)

func (*TimeIndication) UnmarshalJSON added in v1.8.0

func (sq *TimeIndication) UnmarshalJSON(data []byte) (err error)

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