Documentation
¶
Index ¶
- func Decode(input, output interface{}, hooks ...mapstructure.DecodeHookFunc) error
- func IntToJsIntArr(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)
- func StringInterfaceToJsonRawMessage(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)
- func StringToJsonTime(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)
- type Action
- type Command
- type CommandType
- type DigitalCommand
- type EnabledDays
- type JSIntArr
- type JSONTime
- type SimpleCommand
- type Status
- type TimedCommand
- 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 IntToJsIntArr ¶
func StringToJsonTime ¶
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 SUNSET // Sunset related command SUNRISE // Sunrise Related command )
Available command types
type Command ¶
type Command struct {
Type CommandType
Data json.RawMessage
}
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 TimerCommandType StatusSubscriptionCommandType StatusNotificationCommandType StatusUpdateCommandType VersionRequestCommandType VersionReplyCommandType SunsetCommandType )
Message types used in various plugins
func (CommandType) String ¶
func (i CommandType) String() string
type DigitalCommand ¶
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
const ( Noday EnabledDays = 0x00 Sunday EnabledDays = 0x01 Monday EnabledDays = 0x02 Tuesday EnabledDays = 0x04 Wednesday EnabledDays = 0x08 Thursday EnabledDays = 0x10 Friday EnabledDays = 0x20 Saturday EnabledDays = 0x40 )
Days of the week
type JSIntArr ¶
type JSIntArr []Action
JSIntArr an int array that can be rapresented in javascript like an integer or like an array of integers
func (JSIntArr) MarshalJSON ¶
func (*JSIntArr) UnmarshalJSON ¶
type JSONTime ¶
JSONTime a time specialization that allows a compact string rapresentation: hh:mm
func (JSONTime) MarshalJSON ¶
MarshalJSON returns the js string that represent the current hours and minutes
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON returns the time corresponding to the string "15:04"
type SimpleCommand ¶
type SimpleCommand struct {
Command JSIntArr `json:",JSIntArr"`
}
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 TimedCommand ¶
type TimedCommand struct {
Action JSIntArr `json:",JSIntArr"`
TimerID uint16 `json:",int,omitempty"`
Time JSONTime `json:",string,omitempty"`
Repeat EnabledDays `json:",int,omitempty"`
Command *Command
}
TimedCommand represent a command with an associated delay in minutes if TimerID is zero it means it is a new timer. otherwise it should edit the timer with the corresponding id
type VersionIndication ¶
VersionIndication returns info about the current version and the optional update available