Documentation
¶
Overview ¶
Package lutron interfaces with Lutron RadioRA2 home automation.
Applications can monitor lighting levels, monitor keypad LEDs, respond to keypad presses, and manage unprogrammed LEDs.
Index ¶
- Constants
- type Component
- type Conn
- type Dimmer
- func (d *Dimmer) AddMonitor(c chan LevelChange)
- func (d *Dimmer) DefaultFade() time.Duration
- func (d *Dimmer) Fade(level uint8, fade time.Duration) chan uint8
- func (d *Dimmer) Level() chan uint8
- func (d *Dimmer) Monitor() chan LevelChange
- func (d *Dimmer) Off() chan uint8
- func (d *Dimmer) On() chan uint8
- func (d *Dimmer) ReadLevel() chan uint8
- func (d *Dimmer) SetDefaultFade(fade time.Duration)
- func (d *Dimmer) SetLevel(level uint8) chan uint8
- type HybridKeypad
- type Keypad
- type KeypadButton
- type LedGroup
- type LevelChange
- type PendingLedUpdates
- type Switch
Constants ¶
const ( ButtonPress = 3 ButtonRelease = 4 // Valid states for an LED on a keypad. LedOff = 0 LedOn = 1 LedNormalFlash = 2 // 1 flash every second. LedRapidFlash = 3 // 10 flashes every second. LedUndefined = 255 // IDs of buttons on a Pico remote "keypad". PicoButtonOn = 2 PicoButtonPreset = 3 PicoButtonOff = 4 PicoButtonRaise = 5 PicoButtonLower = 6 )
const (
DefaultFade = 2 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
Conn *Conn
// contains filtered or unexported fields
}
Any RadioRA2 compatible device.
type Conn ¶
type Conn struct {
Trace bool
// contains filtered or unexported fields
}
func (*Conn) AddDimmerMonitor ¶
func (c *Conn) AddDimmerMonitor(m chan LevelChange)
Adds a channel to receive updates when any dimmer is adjusted. The current level of every known dimmer will be sent on the channel.
Monitoring all dimmers is useful for logging lighting usage over time. Specific dimmer monitoring simplifies reacting to lighting changes with other automated actions. To monitor only specific dimmers use:
m := c.Dimmer(id).Monitor()
or
c.Dimmer(id).AddMonitor(m)
func (*Conn) Dimmer ¶
Get a reference to a Maestro style dimmer, switch or hybrid keypad. The integration id must be obtained from the RadioRA2 software.
func (*Conn) HybridKeypad ¶
func (c *Conn) HybridKeypad(id int) *HybridKeypad
Get a reference to a hybrid keypad. This is a union of the Dimmer and Keypad objects on the same integration id. Callers may either use the HybridKeypad object, or access the Dimmer and Keypad directly. The integration id must be obtained from the RadioRA2 software.
type Dimmer ¶
type Dimmer struct {
Component
// contains filtered or unexported fields
}
Maestro style dimmer (RRD-6CL, RRD-6NA, RRD-10ND, ...).
Switches (RRD-8ANS) are also supported, but may be better accessed using the simplified Switch wrapper type.
func (*Dimmer) AddMonitor ¶
func (d *Dimmer) AddMonitor(c chan LevelChange)
Adds a channel to receive updates when the dimmer is adjusted.
func (*Dimmer) DefaultFade ¶
Get the duration used to adjust the lighting level.
func (*Dimmer) Fade ¶
Set the level (0-100) over the fade duration, sending the new level on the returned channel when the main repeater has acknowledged it.
func (*Dimmer) Level ¶
Get the level of the dimmer and send it once on the returned channel. If the dimmer's level has not yet been observed it will be queried and the value will be sent after the main repeater has replied.
func (*Dimmer) Monitor ¶
func (d *Dimmer) Monitor() chan LevelChange
Creates a new channel receiving updates when the dimmer is adjusted.
func (*Dimmer) ReadLevel ¶
Get the level of the dimmer directly from the main repeater and send it once on the returned channel. ReadLevel() takes longer than Level() as the read must be performed remotely on the main repeater.
func (*Dimmer) SetDefaultFade ¶
Set the duration for adjusting the lighting level.
type HybridKeypad ¶
Hybrid keypads contain both a dimmer and a keypad. The dimmer controls the lighting load wired into the back of the hybrid keypad component, while the keys on the face can be programmed for any purpose.
type Keypad ¶
type Keypad struct {
Component
// contains filtered or unexported fields
}
func (*Keypad) Button ¶
func (k *Keypad) Button(button uint8) *KeypadButton
Create a reference to a button on the keypad. Buttons are numbered 1-N. See integration guide for mapping, e.g. 1B keypads use only button 4.
type KeypadButton ¶
type KeypadButton struct {
// contains filtered or unexported fields
}
func (*KeypadButton) Monitor ¶
func (b *KeypadButton) Monitor() chan uint8
Creates a new channel receiving ButtonPress each time the button is pressed. ButtonRelease events are not sent.
func (*KeypadButton) MonitorButton ¶
func (b *KeypadButton) MonitorButton() chan uint8
Creates a new channel receiving ButtonPress followed by ButtonRelease each time the button is pressed. The common usage is to monitor only ButtonPress with Monitor() as most callers do not need to observe ButtonRelease.
func (*KeypadButton) MonitorLed ¶
func (b *KeypadButton) MonitorLed(events ...uint8) chan uint8
Creates a new channel receiving LED state change events. Monitoring LEDs can be a useful way to react when a specific scene is selected or lights in a room are turned on or turned off. If no events are selected LedOff and LedOn will be selected by default.
func (*KeypadButton) Press ¶
func (b *KeypadButton) Press() chan uint8
Press the button on the keypad by sending ButtonPress immediately followed by ButtonRelease. The returned channel is signaled once with ButtonRelease when the repeater has acknowledged the action.
If the application is monitoring the button the monitoring channel(s) will also be signaled as the repeater acknowledges the action.
func (*KeypadButton) SetLed ¶
func (b *KeypadButton) SetLed(state uint8) chan uint8
Set the state of a button's LED to LedOn, LedOff, LedNormalFlash or LedRapidFlash. LED states can only be set if the button is unconfigured in the RadioRA2 software.
type LedGroup ¶
type LedGroup struct {
// contains filtered or unexported fields
}
Collection of keypad buttons that should behave like radio buttons. At most one button in the group should have LedOn state.
func NewLedGroup ¶
func NewLedGroup(buttons ...*KeypadButton) *LedGroup
Create a "radio group" of keypad buttons. Select() can be used to set LedOn for one button and LedOff for the others in the group.
func (*LedGroup) Select ¶
func (g *LedGroup) Select(sel *KeypadButton) *PendingLedUpdates
"Select" one button from a group of buttons by turning on the selected button's LED and turning off all other LEDs in the group. A wait object is returned to allow the caller to wait for the updates to process.
Selecting nil will turn off all LEDs in the group.
type LevelChange ¶
type PendingLedUpdates ¶
type PendingLedUpdates struct {
// contains filtered or unexported fields
}
Partial results after selecting an LED in a group.
func (*PendingLedUpdates) Wait ¶
func (u *PendingLedUpdates) Wait()
Wait for LED updates to be acknowledged by the main repeater.
type Switch ¶
type Switch struct {
// contains filtered or unexported fields
}
Maestro style switch (RRD-8ANS). Switches are modeled as dimmers that have only two levels, 0 (off) and 100 (on). The switch type is a lightweight wrapper around the dimmer to simplify its API.
Maestro style dimmers (RRD-6CL, RRD-6NA, RRD-10ND, ...) are also supported by this type, but are limited to "instant full on" and "instant full off". To access the dimming controls, use Dimmer.
func (*Switch) AddMonitor ¶
func (s *Switch) AddMonitor(c chan LevelChange)
Adds a channel to receive updates when the dimmer is adjusted. For a switch any non-zero level means "on", while 0 means "off".
func (*Switch) IsOn ¶
Get the status of the switch and send it once on the returned channel. If the switch's level has not yet been observed it will be queried and the value will be sent after the main repeater has replied. For a switch any non-zero level means "on", while 0 means "off".
func (*Switch) Monitor ¶
func (s *Switch) Monitor() chan LevelChange
Creates a new channel receiving updates when the switch is adjusted. For a switch any non-zero level means "on", while 0 means "off".