Documentation ¶
Index ¶
- Constants
- Variables
- func IsValid(msg string) (bool, string)
- type Ambient
- type Cable
- type Dimension
- type Home
- type HomeError
- type Message
- type Plant
- func (p *Plant) ExportPlant(f io.Writer) error
- func (p *Plant) FormatToJSON(msg Message) string
- func (p *Plant) ParseFrame(frame string) Message
- func (p *Plant) ParseFromJSON(jsonMessage string) Message
- func (p *Plant) ServerAddress() string
- func (p *Plant) WhereFromCode(code string) (Where, error)
- func (p *Plant) WhereFromDesc(text string) (Where, error)
- type PubSub
- type Value
- type What
- type Where
- type Who
Constants ¶
const COMMAND = "COMMAND"
const DIMENSIONGET = "DIMENSIONGET"
const DIMENSIONSET = "DIMENSIONSET"
const INVALID = "INVALID"
const PROJECT = "gohome-dev"
const REQUEST = "REQUEST"
const SPECIAL = "SPECIAL"
const SUBSCRIPTION = "home_listening"
const TOPIC = "calling_home"
Variables ¶
var ErrAmbientNotFound = errors.New("ambient not found")
ErrAmbientNotFound is returned when the desired where is not found in the conf file
var ErrConnectionFailed = errors.New("CONNECTION FAILED")
var ErrLightNotFound = errors.New("light not found")
ErrLightNotFound is returned when the desired loight is not found in the conf file
var ErrNAK = errors.New("NAK")
var ErrNoConnection = errors.New("NO CONNECTION")
var ErrNoData = errors.New("NO DATA")
var ErrServerNotFound = errors.New("SERVER NOT FOUND")
var ErrWhatNotFound = errors.New("WHAT not found")
var ErrWhereNotInPlant = errors.New("WHERE not found in the current plant configuration")
ErrWhereNotInPlant is returned whene a where numeric code is not found in the current plant configuration
var ErrWhoNotFound = errors.New("WHO not found")
var SystemMessages = map[string]Message{ "ACK": Message{Kind: SPECIAL, /* contains filtered or unexported fields */}, "NACK": Message{Kind: SPECIAL, /* contains filtered or unexported fields */}, "QUERY_ALL": Message{Kind: SPECIAL, /* contains filtered or unexported fields */}, "OPEN_COMMAND_SESSION": Message{Kind: SPECIAL, /* contains filtered or unexported fields */}, "OPEN_EVENT_SESSION": Message{Kind: SPECIAL, /* contains filtered or unexported fields */}, "OPEN_SCENARIO_SESSION": Message{Kind: SPECIAL, /* contains filtered or unexported fields */}, }
SystemMessages contains the OpenWebNet codes for various system messages
Functions ¶
Types ¶
type Home ¶
Home is a Btcino MyHome plant that can be controlled with a OpenWebNet enabled device (F452 ecc)
type HomeError ¶
type HomeError struct {
// contains filtered or unexported fields
}
HomeError wraps OWN errors
type Message ¶
type Message struct { Who *Who `json:"who"` What What `json:"what"` Where Where `json:"where"` Kind string `json:"kind"` // contains filtered or unexported fields }
func NewCommand ¶
NewCommand build a new Command to send to the home plant
func NewRequest ¶
NewRequest build a new Request to send to the home plant
func (Message) MarshalJSON ¶
type Plant ¶
type Plant struct { Name string `json:"name"` Num int `json:"num"` Address string `json:"address"` Ambients map[string]Ambient `json:"ambients"` }
func NewPlant ¶
NewPlant load a plant configuration from a json file. Return a pointer to the Plant that will be used.
func (*Plant) ExportPlant ¶
ExportPlant the current plant configuration to the given file
func (*Plant) FormatToJSON ¶
FormatToJSON returns the who, what, where of a message in a JSON formatted string
func (*Plant) ParseFrame ¶
ParseFrame parse a OWN frame and returns a structured message.
func (*Plant) ParseFromJSON ¶
func (*Plant) ServerAddress ¶
ServerAddress returns the server address for the loaded configuration
func (*Plant) WhereFromCode ¶
Decode returns where defined by the ambient and light names in the plant config file: <ambient>[.<light>]