Documentation ¶
Overview ¶
Package nodes describes the shared nodes definition language between the controller and the devices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TypesMap map[Type]reflect.Type
TypesMap is the list of known types and their associated name.
Functions ¶
This section is empty.
Types ¶
type Anim1D ¶
type Anim1D struct { APA102 bool I2C I2CRef SPI SPIRef // NumberLights is the number of lights controlled by this device. If lower // than the actual number of lights, the remaining lights will flash oddly. NumberLights int FPS int }
Anim1D is an APA102 LED strip.
type Button ¶
type Button struct {
Pin string
}
Button represents a physical GPIO input pin of type Button.
type Dev ¶
type Dev struct { // Name is the display name of this nodes collection: the device. Name string Nodes map[ID]*Node }
Dev is the configuration for all the nodes on a device.
The Dev is the micro-computer (a Rasberry Pi, C.H.I.P., ESP8266) that exposes nodes.
The controller stores this data on the MQTT server upon startup and upon configuration update.
The device fetches this data from the MQTT server upon startup. So when a device configuration occurs, the device should restart. This is really just restarting the Go process so this is nearly instant.
func (*Dev) ToSerialized ¶
func (d *Dev) ToSerialized() *SerializedDev
ToSerialized is used by the controller to serialize the device description.
Serialization should never fail.
type Display ¶
Display is an ssd1306 display.
TODO(maruel): make it more generic so other kind of display are supported.
type IR ¶
type IR struct { }
IR is an InfraRed Remote receiver.
In practice, only lirc is supported.
type NodeCfg ¶
type NodeCfg interface { Validator // contains filtered or unexported methods }
NodeCfg is the descriptor of a node.
type PIR ¶
type PIR struct {
Pin string
}
PIR represents a GPIO physical pin that is connected to a motion detector.
type Property ¶
type Property struct { Unit string `json:"$unit"` DataType string `json:"$datatype"` Format string `json:"$format"` Settable bool `json:"$settable"` }
Property defines one property of a node.
A Node can have multiple properties. For example a buzzer could have separate knob for frequency and intensity.
type SerializedDev ¶
type SerializedDev struct { Name string `json:"$name"` Nodes map[ID]*SerializedNode }
SerializedDev is the serialized form of Dev as stored on the MQTT server.
func (*SerializedDev) ToDev ¶
func (s *SerializedDev) ToDev() (*Dev, error)
ToDev is used by the device to deserialize the configuration.
type SerializedNode ¶
type SerializedNode struct { Name string `json:"$name"` Type Type `json:"$type"` Properties map[ID]Property `json:"$properties"` Config []byte `json:"$config"` }
SerializedNode is loosely based on https://github.com/marvinroger/homie#node-attributes
It is the serialized form of Node.
type Sound ¶
type Sound struct {
DeviceID string // Empty to use the default sound card.
}
Sound is a sound output device.