Documentation ¶
Index ¶
- func Decode(input, output interface{}, hooks ...mapstructure.DecodeHookFunc) error
- func StringInterfaceToJsonRawMessage(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)
- func StringToTimeIndication(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)
- type Action
- type AnalogCommand
- type AnalogValueType
- type Command
- type CommandType
- type Comparable
- type DigitalCommand
- type EnabledDays
- type SimpleCommand
- type Status
- type TimeIndication
- type VersionIndication
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(input, output interface{}, hooks ...mapstructure.DecodeHookFunc) error
func StringToTimeIndication ¶ added in v1.8.0
Types ¶
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
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 ¶
VersionIndication returns info about the current version and the optional update available