package module
Version: v0.0.0-...-20de377 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 13 Imported by: 0


Go Insteon

Go Report Card Build Status GoDoc Coverage Status

This package provides a Go interface to Insteon networks and the ability to control Insteon devices. This package is being actively developed and the API is subject to change. Consider this library to be in an alpha stage of development

CLI Utility

The package provides the "ic" command line tool to perform various administrative tasks related to the Insteon network and its devices.

Insteon Network Daemon

TODO: A REST interface to the Insteon network. Will include abstractions for common tasks such as creating virtual N-Way light switches as well as scenes

Insteon Network Client

TODO: A client application to the Insteon Network Daemon


The package can be used directly from other go programs by means of the package. See the godocs for more information.




View Source
const (
	// CmdAssignToAllLinkGroup Assign to ALL-Link Group
	CmdAssignToAllLinkGroup = Command(0x000100) // Assign to All-Link Group

	// CmdDeleteFromAllLinkGroup Delete from All-Link Group
	CmdDeleteFromAllLinkGroup = Command(0x000200) // Delete from All-Link Group

	// CmdProductDataReq Product Data Request
	CmdProductDataReq = Command(0x000300) // Product Data Request

	// CmdFxUsernameReq FX Username Request
	CmdFxUsernameReq = Command(0x000301) // Fx Username Request

	// CmdDeviceTextStringReq Device Text String Request
	CmdDeviceTextStringReq = Command(0x000302) // Text String Request

	// CmdExitLinkingMode Exit Linking Mode
	CmdExitLinkingMode = Command(0x000800) // Exit Linking Mode

	// CmdEnterLinkingMode Enter Linking Mode
	CmdEnterLinkingMode = Command(0x000900) // Enter Linking Mode

	// CmdEnterUnlinkingMode Enter Unlinking Mode
	CmdEnterUnlinkingMode = Command(0x000a00) // Enter Unlinking Mode

	// CmdGetEngineVersion Get Insteon Engine Version
	CmdGetEngineVersion = Command(0x000d00) // Engine Version

	// CmdPing Ping Request
	CmdPing = Command(0x000f00) // Ping Request

	// CmdIDRequest Send ID Request which will prompt the device to respond with a Set Button Pressed Controller/Responder
	CmdIDRequest = Command(0x001000) // ID Request

	// CmdGetOperatingFlags is used to request a given operating flag
	CmdGetOperatingFlags = Command(0x001f00) // Get Operating Flags

Standard Direct Commands

View Source
const (
	// CmdProductDataResp Product Data Response
	CmdProductDataResp = Command(0x010300) // Product Data Response

	// CmdFxUsernameResp FX Username Response
	CmdFxUsernameResp = Command(0x010301) // Fx Username Response

	// CmdDeviceTextStringResp Device Text String Response
	CmdDeviceTextStringResp = Command(0x010302) // Text String Response

	// CmdSetDeviceTextString sets the device text string
	CmdSetDeviceTextString = Command(0x010303) // Set Text String

	// CmdSetAllLinkCommandAlias sets the command alias to use for all-linking
	CmdSetAllLinkCommandAlias = Command(0x010304) // Set All-Link Command Alias

	// CmdSetAllLinkCommandAliasData sets the extended data to be used if the command alias is an extended command
	CmdSetAllLinkCommandAliasData = Command(0x010305) // Set All-Link Command Alias Data

	// CmdExitLinkingModeExt Exit Linking Mode
	CmdExitLinkingModeExt = Command(0x010800) // Exit Linking Mode (i2cs)

	// CmdEnterLinkingModeExt Enter Linking Mode (extended command for I2CS devices)
	CmdEnterLinkingModeExt = Command(0x010900) // Enter Linking Mode (i2cs)

	// CmdEnterUnlinkingModeExt Enter Unlinking Mode (extended command for I2CS devices)
	CmdEnterUnlinkingModeExt = Command(0x010a00) // Enter Unlinking Mode (i2cs)

	// CmdSetOperatingFlags is used to set a given operating flag
	CmdSetOperatingFlags = Command(0x012000) // Set Operating Flags

	// CmdExtendedGetSet is used to get and set extended data (ha ha)
	CmdExtendedGetSet = Command(0x012e00) // Extended Get/Set

	// CmdReadWriteALDB Read/Write ALDB
	CmdReadWriteALDB = Command(0x012f00) // Read/Write ALDB

Extended Direct Commands

View Source
const (
	// CmdAllLinkRecall is an all-link command to recall the state assigned to the entry in the all-link database
	CmdAllLinkRecall = Command(0x0c1100) // All-link recall

	// CmdAllLinkAlias2High will execute substitute Direct Command
	CmdAllLinkAlias2High = Command(0x0c1200) // All-link Alias 2 High

	// CmdAllLinkAlias1Low will execute substitute Direct Command
	CmdAllLinkAlias1Low = Command(0x0c1300) // All-link Alias 1 Low

	// CmdAllLinkAlias2Low will execute substitute Direct Command
	CmdAllLinkAlias2Low = Command(0x0c1400) // All-link Alias 2 Low

	// CmdAllLinkAlias3High will execute substitute Direct Command
	CmdAllLinkAlias3High = Command(0x0c1500) // All-link Alias 3 High

	// CmdAllLinkAlias3Low will execute substitute Direct Command
	CmdAllLinkAlias3Low = Command(0x0c1600) // All-link Alias 3 Low

	// CmdAllLinkAlias4High will execute substitute Direct Command
	CmdAllLinkAlias4High = Command(0x0c1700) // All-link Alias 4 High

	// CmdAllLinkAlias4Low will execute substitute Direct Command
	CmdAllLinkAlias4Low = Command(0x0c1800) // All-link Alias 4 Low

	// CmdAllLinkAlias5 will execute substitute Direct Command
	CmdAllLinkAlias5 = Command(0x0c2100) // All-link Alias 5

All-Link Messages

View Source
const (
	// CmdSetButtonPressedResponder Broadcast command indicating the set button has been pressed
	CmdSetButtonPressedResponder = Command(0x080100) // Set-button Pressed (responder)

	// CmdSetButtonPressedController Broadcast command indicating the set button has been pressed
	CmdSetButtonPressedController = Command(0x080200) // Set-button Pressed (controller)

	// CmdTestPowerlinePhase is used for determining which powerline phase (A/B) to which the device is attached
	CmdTestPowerlinePhase = Command(0x080300) // Test Powerline Phase

	// CmdHeartbeat is a broadcast command that is received periodically if it has been set up using the extended get/set command
	CmdHeartbeat = Command(0x080400) // Heartbeat

	// CmdBroadCastStatusChange is sent by a device when its status changes
	CmdBroadCastStatusChange = Command(0x082700) // Broadcast Status Change

Standard Broadcast Messages

View Source
const (
	// CmdLightOn
	CmdLightOn = Command(0x001100) // Light On

	// CmdLightOnFast
	CmdLightOnFast = Command(0x001200) // Light On Fast

	// CmdLightOff
	CmdLightOff = Command(0x001300) // Light Off

	// CmdLightOffFast
	CmdLightOffFast = Command(0x001400) // Light Off Fast

	// CmdLightBrighten
	CmdLightBrighten = Command(0x001500) // Brighten Light

	// CmdLightDim
	CmdLightDim = Command(0x001600) // Dim Light

	// CmdLightStopManual
	CmdLightStopManual = Command(0x001800) // Manual Light Change Stop

	// CmdLightStatusRequest
	CmdLightStatusRequest = Command(0x001900) // Status Request

	// CmdLightInstantChange
	CmdLightInstantChange = Command(0x002100) // Light Instant Change

	// CmdLightManualOn
	CmdLightManualOn = Command(0x002201) // Manual On

	// CmdLightManualOff
	CmdLightManualOff = Command(0x002301) // Manual Off

	// CmdTapSetButtonOnce
	CmdTapSetButtonOnce = Command(0x002501) // Set Button Tap

	// CmdTapSetButtonTwice
	CmdTapSetButtonTwice = Command(0x002502) // Set Button Tap Twice

	// CmdLightSetStatus
	CmdLightSetStatus = Command(0x002700) // Set Status

	// CmdLightOnAtRamp
	CmdLightOnAtRamp = Command(0x002e00) // Light On At Ramp

	// CmdLightOnAtRampV67
	CmdLightOnAtRampV67 = Command(0x003400) // Light On At Ramp

	// CmdLightOffAtRamp
	CmdLightOffAtRamp = Command(0x002f00) // Light Off At Ramp

	// CmdLightOffAtRampV67
	CmdLightOffAtRampV67 = Command(0x003500) // Light Off At Ramp

Lighting Standard Direct Messages

View Source
const (
	// CmdStartBrighten
	CmdStartBrighten = Command(0x001701) // Manual Start Brighten

	// CmdStartDim
	CmdStartDim = Command(0x001700) // Manual Start Dim

	// CmdEnableProgramLock
	CmdEnableProgramLock = Command(0x002000) // Enable Program Lock

	// CmdDisableProgramLock
	CmdDisableProgramLock = Command(0x002001) // Disable Program Lock

	// CmdEnableTxLED
	CmdEnableTxLED = Command(0x002002) // Enable Tx LED

	// CmdDisableTxLED
	CmdDisableTxLED = Command(0x002003) // Disable Tx LED

	// CmdEnableResumeDim
	CmdEnableResumeDim = Command(0x002004) // Enable Resume Dim

	// CmdDisableResumeDim
	CmdDisableResumeDim = Command(0x002005) // Disable Resume Dim

	// CmdEnableLoadSense
	CmdEnableLoadSense = Command(0x002006) // Enable Load Sense

	// CmdDisableLoadSense
	CmdDisableLoadSense = Command(0x002007) // Disable Load Sense

	// CmdDisableLED
	CmdDisableLED = Command(0x002008) // Disable Backlight

	// CmdEnableLED
	CmdEnableLED = Command(0x002009) // Enable Backlight

	// CmdSetKeyBeep
	CmdSetKeyBeep = Command(0x00200a) // Enable Key Beep

	// CmdClearKeyBeep
	CmdClearKeyBeep = Command(0x00200b) // Disable Key Beep

Dimmer Convenience Commands

View Source
const (
	// CmdDecreaseTemp Decrease Temperature
	CmdDecreaseTemp = Command(0x006800) // Decrease Temp

	// CmdIncreaseTemp Increase Temperature
	CmdIncreaseTemp = Command(0x006900) // Increase Temp

	// CmdGetZoneInfo Get Zone Information
	CmdGetZoneInfo = Command(0x006a00) // Get Zone Info

	// CmdGetThermostatMode Get Mode
	CmdGetThermostatMode = Command(0x006b02) // Get Mode

	// CmdGetAmbientTemp Get Ambient Temperature
	CmdGetAmbientTemp = Command(0x006b03) // Get Ambient Temp

	// CmdSetHeat Set Heat
	CmdSetHeat = Command(0x006b04) // Set Heat

	// CmdSetCool Set Cool
	CmdSetCool = Command(0x006b05) // Set Cool

	// CmdSetModeAuto Set Mode Auto
	CmdSetModeAuto = Command(0x006b06) // Set Auto

	// CmdSetFan Turn Fan On
	CmdSetFan = Command(0x006b07) // Turn Fan On

	// CmdClearFan Turn Fan Off
	CmdClearFan = Command(0x006b08) // Turn Fan Off

	// CmdThermOff Turn Thermostat Off
	CmdThermOff = Command(0x006b09) // Turn Thermostat Off

	// CmdSetProgramHeat Set mode to Program Heat
	CmdSetProgramHeat = Command(0x006b0a) // Set Program Heat

	// CmdSetProgramCool Set mode to Program Cool
	CmdSetProgramCool = Command(0x006b0b) // Set Program Cool

	// CmdSetProgramAuto Set mode to Program Auto
	CmdSetProgramAuto = Command(0x006b0c) // Set Program Auto

	// CmdGetEquipmentState Get Equipment State
	CmdGetEquipmentState = Command(0x006b0d) // Get State

	// CmdSetEquipmentState Set Equipment State
	CmdSetEquipmentState = Command(0x006b0e) // Set State

	// CmdGetTempUnits Get Temperature Units
	CmdGetTempUnits = Command(0x006b0f) // Get Temp Units

	// CmdSetFahrenheit Set Units to Fahrenheit
	CmdSetFahrenheit = Command(0x006b10) // Set Units Fahrenheit

	// CmdSetCelsius Set Units to Celsius
	CmdSetCelsius = Command(0x006b11) // Set Units Celsius

	// CmdGetFanOnSpeed Get Fan On-Speed
	CmdGetFanOnSpeed = Command(0x006b12) // Get Fan On-Speed

	// CmdSetFanOnLow Set Fan On-Speed to Low
	CmdSetFanOnLow = Command(0x006b13) // Set Fan-Speed Low

	// CmdSetFanOnMed Set Fan On-Speed to Med
	CmdSetFanOnMed = Command(0x006b14) // Set Fan-Speed Med

	// CmdSetFanOnHigh Set Fan On-Speed to High
	CmdSetFanOnHigh = Command(0x006b15) // Set Fan-Speed High

	// CmdEnableStatusMessage Enable Status Change Messages
	CmdEnableStatusMessage = Command(0x006b16) // Enable Status Change

	// CmdDisableStatusMessage Disable Status Change Messages
	CmdDisableStatusMessage = Command(0x006b17) // Disable Status Change

	// CmdSetCoolSetpoint Set Cool Set-Point
	CmdSetCoolSetpoint = Command(0x006c00) // Set Cool Set-Point

	// CmdSetHeatSetpoint Set Heat Set-Point
	CmdSetHeatSetpoint = Command(0x006d00) // Set Heat Set-Point

Thermostat Standard Direct Messages

View Source
const (
	// CmdZoneTempUp Increase Zone Temp
	CmdZoneTempUp = Command(0x016800) // Increase Zone Temp

	// CmdZoneTempDown Decrease Zone Temp
	CmdZoneTempDown = Command(0x016900) // Decrease Zone Temp

	// CmdSetZoneCoolSetpoint Set Zone Cooling Set Point
	CmdSetZoneCoolSetpoint = Command(0x016c00) // Set Zone Cool Set-Point

	// CmdSetZoneHeatSetpoint Set Zone Heating Set Point
	CmdSetZoneHeatSetpoint = Command(0x016d00) // Set Zone Heat Set-Point

Thermostat Extended Direct Messages

View Source
const (
	GeneralizeDomain        Domain = 0x00
	DimmerDomain                   = 0x01
	SwitchDomain                   = 0x02
	NetworkDomain                  = 0x03
	IrrigationDomain               = 0x04
	ThermostatDomain               = 0x05
	PoolSpaDomain                  = 0x06
	SensorActuatorDomain           = 0x07
	HomeEntertainmentDomain        = 0x08
	EnergyMgmtDomain               = 0x09
	ApplianceDomain                = 0x0a
	PlumbingDomain                 = 0x0b
	CommunicationDomain            = 0x0c
	ComputerDomain                 = 0x0d
	WindowCoveringsDomain          = 0x0e
	AccessDomain                   = 0x0f
	SecurityDomain                 = 0x10
	SurveillanceDomain             = 0x11
	AutomotiveDomain               = 0x12
	PetCareDomain                  = 0x13
	ToysDomain                     = 0x14
	TimekeepingDomain              = 0x15
	HolidayDomain                  = 0x16
	UnassignedDomain               = 0xff
View Source
const (
	AvailableController   = RecordControlFlags(0x40)
	UnavailableController = RecordControlFlags(0xc0)
	AvailableResponder    = RecordControlFlags(0x00)
	UnavailableResponder  = RecordControlFlags(0x80)

RecordControlFlags indicating the different availability/type of link records

View Source
const (
	// BaseLinkDBAddress is the base address of devices All-Link database
	BaseLinkDBAddress = MemAddress(0x0fff)

	// LinkRecordSize is the size, in bytes, of a single All-Link record
	LinkRecordSize = MemAddress(8)
View Source
const (
	// LevelNone - log nothing to Stderr
	LevelNone = LogLevel(iota)

	// LevelInfo - log normal information (warnings) to Stderr

	// LevelDebug - log debug information (used for development and troubleshooting)

	// LevelTrace - log everything, including I/O
View Source
const (
	// StandardMsgLen is the length of an insteon standard message minus one byte (the crc byte)
	StandardMsgLen = 9

	// ExtendedMsgLen is the length of an insteon extended message minus one byte (the crc byte)
	ExtendedMsgLen = 23
View Source
const (
	MsgTypeDirect            MessageType = 0    // D
	MsgTypeDirectAck                     = 0x20 // D (Ack)
	MsgTypeDirectNak                     = 0xA0 // D (Nak)
	MsgTypeAllLinkCleanup                = 0x40 // C
	MsgTypeAllLinkCleanupAck             = 0x60 // C (Ack)
	MsgTypeAllLinkCleanupNak             = 0xE0 // C (Nak)
	MsgTypeBroadcast                     = 0x80 // B
	MsgTypeAllLinkBroadcast              = 0xC0 // A

All of the valid message types

View Source
const (
	StandardBroadcast        = Flags(0x8a)
	StandardAllLinkBroadcast = Flags(0xca)
	StandardDirectMessage    = Flags(0x0a)
	StandardDirectAck        = Flags(0x2a)
	StandardDirectNak        = Flags(0xaa)
	ExtendedDirectMessage    = Flags(0x1a)
	ExtendedDirectAck        = Flags(0x3a)
	ExtendedDirectNak        = Flags(0xba)

Flags for common message types


View Source
var (
	// ErrBufferTooShort indicates a buffer underrun when unmarshalling data
	ErrBufferTooShort = errors.New("Buffer is too short")

	// ErrReadTimeout indicates the timeout period expired while waiting for
	// a specific message
	ErrReadTimeout = errors.New("Read Timeout")

	// ErrAckTimeout indicates the timeout period expired while waiting for
	// ack message for a previously sent Direct message
	ErrAckTimeout = errors.New("Ack Timeout")

	// ErrWriteTimeout indicates the timeout period expired while waiting to
	// write a message
	ErrWriteTimeout = errors.New("Write Timeout")

	// ErrSendTimeout indicates the timeout period expired while trying to
	// send a message
	ErrSendTimeout = errors.New("Send Timeout")

	// ErrNotSupported indicates some feature (namely an updateable All-Link database) is
	// not supported by the underyling Insteon device
	ErrNotSupported = errors.New("Feature is not supported by the device")

	// ErrNotImplemented indicates that a device function has not yet been implemented
	ErrNotImplemented = errors.New("Command is not yet implemented")

	// ErrUnexpectedResponse is returned when a Nak is not understood
	ErrUnexpectedResponse = errors.New("Unexpected response from device")

	// ErrNotLinked indicates the device does not have an all-link entry in its
	// database
	ErrNotLinked = errors.New("Not in All-Link group")

	// ErrNotLinkable indicates a linking function was requested on a non-linkable device
	ErrNotLinkable = errors.New("Device is not remotely linkable")

	// ErrNoLoadDetected is an error returned by the device (this error condition is not documented)
	ErrNoLoadDetected = errors.New("No load detected")

	// ErrUnknownCommand is returned by the device (as a Nak) in response to an unknown command byte
	ErrUnknownCommand = errors.New("Unknown command")

	// ErrNak indicates a negative acknowledgement was received in response to a sent message
	ErrNak = errors.New("NAK received")

	// ErrUnknown is returned by a connection when a NAK occurred but the error code
	// is not known
	ErrUnknown = errors.New("Device returned unknown error")

	// ErrIllegalValue is returned by I2Cs devices (this error condition is not documented)
	ErrIllegalValue = errors.New("Illegal value in command")

	// ErrIncorrectChecksum is returned by I2Cs devices when an invalid checksum is detected
	ErrIncorrectChecksum = errors.New("I2CS invalid checksum")

	// ErrPreNak is returned by I2Cs devices (this error condition is not documented)
	ErrPreNak = errors.New("Database search took too long")

	// ErrAddrFormat is returned when unmarshalling an address from text and the
	// text is in an unsupported format
	ErrAddrFormat = errors.New("address format is xx.xx.xx (digits in hex)")

	// ErrInvalidMemAddress indicates a link record memory address is invalid
	ErrInvalidMemAddress = errors.New("Invalid memory address")

	// ErrVersion is returned when an engine version value is not known
	ErrVersion = errors.New("Unknown Insteon Engine Version")

	// ErrLinkIndexOutOfRange indicates that the index exceeds the length of the all-link database
	ErrLinkIndexOutOfRange = errors.New("Link index is beyond the bounds of the link database")

	// ErrReceiveComplete is used when calling the Receive() utility function.  If the callback is finished
	// receiving then it returns ErrReceiveComplete to indicate the Receive() function can return
	ErrReceiveComplete = errors.New("Completed receiving")

	// ErrReceiveContinue is used when calling the Receive() utility function.  If the callback
	// wants to continue receiving it will return this error.  This causes the Receive() function
	// to update the timeout and wait for a new message
	ErrReceiveContinue = errors.New("Continue receiving")

	// ErrInvalidThermostatMode indicates an unknown mode was supplied to the SetMode function
	ErrInvalidThermostatMode = errors.New("invalid mode")

	// ErrInvalidUnit indicates the given value for Unit is not either Fahrenheit or Celsius
	ErrInvalidUnit = errors.New("Invalid temperature unit")

	// ErrInvalidFanSpeed indicates the value provided for FanSpeed is either unsupported or
	// unknown
	ErrInvalidFanSpeed = errors.New("Invalid fan speed")
View Source
var (
	// Log is the global log object. The default level is set to Info
	Log = &Logger{Level: LevelNone, Logger: log.New(os.Stderr, "", log.LstdFlags)}
View Source
var (
	// MaxLinkDbAge is the amount of time to wait until the local link database
	// is considered old
	MaxLinkDbAge = time.Hour
View Source
var Wildcard = Address{0, 0, 0}


func IDRequest

func IDRequest(bus Bus, dst Address) (version FirmwareVersion, devCat DevCat, err error)

func IsError

func IsError(check, err error) bool

IsError will determine if `check` is wrapping an underlying error. If so, the underlying error is compared to `err`.

func PropagationDelay

func PropagationDelay(ttl uint8, extended bool) (pd time.Duration)

PropagationDelay attempts to calculate the amount of time an Insteon message needs in order to completely propogate (including relays) throughout the network. This is based on the number of AC zero crossings, the number of times a message can be repeated (ttl) and whether or not the message is an extended message

func Retry

func Retry(retries int, cb func() error) (err error)


type Address

type Address [3]byte

Address is a 3 byte insteon address

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

MarshalJSON will convert the address to a JSON string

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

MarshalText fulfills the requiresments of encoding.TextMarshaler so that Address can be used as a map key in other encoding

func (*Address) Set

func (a *Address) Set(str string) error

Set satisfies the flag.Value interface

func (Address) String

func (a Address) String() string

String will format the Address object into a form common to Insteon devices: 00.00.00 where each byte is represented in hexadecimal form (e.g. 01.b4.a5) the string will always be 8 characters long, bytes are zero padded

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON will populate the address from the input JSON string

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(text []byte) error

UnmarshalText converts a human readable string into an Insteon address. If the address cannot be parsed then UnmarshalText returns an ErrAddressFormat error

type Addressable

type Addressable interface {
	// Address will return the 3 byte destination address of the device.
	// All device implemtaions must be able to return their address
	Address() Address

Addressable is any receiver that can be queried for its address

type AllLinkable

type AllLinkable interface {
	// AssignToAllLinkGroup should be called after the set button
	// has been pressed on a responder. If the set button was pressed
	// then this method will assign the responder to the given
	// All-Link Group
	AssignToAllLinkGroup(Group) error

	// DeleteFromAllLinkGroup removes an All-Link record from a responding
	// device during an Unlinking session
	DeleteFromAllLinkGroup(Group) error

AllLinkable is any device that has an all-link database that can be programmed remotely

type BufError

type BufError struct {
	Cause error // the underlying error
	Need  int   // the number of bytes required
	Got   int   // the length of the supplied buffer

BufError has information to indicate a buffer error

func (*BufError) Error

func (be *BufError) Error() string

Error will indicate what caused a buffer error to occur

type Bus

type Bus interface {
	On(Address, Matcher, func(*Message)) (unsubscribe func())
	Publish(*Message) (*Message, error)
	Subscribe(src Address, matcher Matcher) <-chan *Message
	Unsubscribe(src Address, ch <-chan *Message)
	Config() ConnectionConfig

func NewBus

func NewBus(writer MessageWriter, messages <-chan *Message, options ...ConnectionOption) (Bus, error)

type Category

type Category byte

Category indicates the specific kind of device within a domain. For instance, a LampLing and a SwitchLinc Dimmer are both within the Dimmable device domain

type CmdMatcher

type CmdMatcher Command

func (CmdMatcher) Matches

func (m CmdMatcher) Matches(msg *Message) bool

type Command

type Command int

Command is a 3 byte sequence that indicates command flags (direct, all-link or broadcast, standard/extended) and two byte commands

func (Command) Command0

func (cmd Command) Command0() int

func (Command) Command1

func (cmd Command) Command1() int

func (Command) Command2

func (cmd Command) Command2() int

func (*Command) Set

func (cmd *Command) Set(value string) error

func (Command) String

func (cmd Command) String() string

func (Command) SubCommand

func (cmd Command) SubCommand(command2 int) Command

SubCommand will return a new command where the subcommand byte is updated to reflect command2 from the arguments

type Commandable

type Commandable interface {
	// SendCommand will send the given command bytes to the device including
	// a payload (for extended messages). If payload length is zero then a standard
	// length message is used to deliver the commands.
	SendCommand(cmd Command, payload []byte) (err error)

	Send(cmd Command, payload []byte) (ack Command, err error)

Commandable indicates that the implementation exists to send commands

type ConnectionConfig

type ConnectionConfig struct {
	DefaultTimeout time.Duration
	Retries        int
	TTL            uint8
	BufSize        int

func (ConnectionConfig) Timeout

func (cc ConnectionConfig) Timeout(extended bool) time.Duration

type ConnectionOption

type ConnectionOption func(*ConnectionConfig) error

ConnectionOption provides a means to customize the connection config

func ConnectionBufSize

func ConnectionBufSize(size int) ConnectionOption

ConnectionBufSize sets the receive buffer size for incoming messages

func ConnectionRetry

func ConnectionRetry(retries int) ConnectionOption

func ConnectionTTL

func ConnectionTTL(ttl uint8) ConnectionOption

ConnectionTTL will set the connection's time to live flag

func ConnectionTimeout

func ConnectionTimeout(timeout time.Duration) ConnectionOption

ConnectionTimeout is a ConnectionOption that will set the connection's default read timeout. Normally, the read timeout is based on the number of zero crossings required to send and retry the message. With each retry the Insteon engine automatically increases the TTL. The following table displays the calcualted timeouts based on the message size and starting TTL: Starting TTL | Standard Msg | Extended Msg

0 | 1.40 Seconds | 2.22 Seconds
1 | 1.70 Seconds | 2.69 Seconds
2 | 1.90 Seconds | 3.01 Seconds
3 | 2.00 Seconds | 3.17 Seconds

type DevCat

type DevCat [2]byte

DevCat is a 2 byte value including a device category and sub-category. Devices are grouped by categories (thermostat, light, etc) and then each category has specific types of devices such as on/off switches and dimmer switches

func (DevCat) Category

func (dc DevCat) Category() Category

Category returns the device's category. For instance a DevCat with the Domain "Dimmable" may return the Category for LampLinc or SwitchLinc Dimmer

func (DevCat) Domain

func (dc DevCat) Domain() Domain

Domain returns what device domain a particular device belongs to

func (DevCat) In

func (dc DevCat) In(domains ...Domain) bool

In determines if the DevCat domain is found in the list

func (DevCat) MarshalJSON

func (dc DevCat) MarshalJSON() ([]byte, error)

MarshalJSON will convert the DevCat to a valid JSON byte string

func (DevCat) String

func (dc DevCat) String() string

String returns a string representation of the DevCat in the form of category.subcategory where those fields are the 2 digit hex representation of their corresponding values

func (*DevCat) UnmarshalJSON

func (dc *DevCat) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON will unmarshal the input json byte string into the DevCat receiver

type Device

type Device interface {

	ExtendedGet([]byte) ([]byte, error)

	// LinkDatabase will return a LinkDatabase if the underlying device
	// supports it.  If the underlying device (namely I1 devices) does
	// not support the All-Link database then an ErrNotSupported will
	// be returned
	LinkDatabase() (Linkable, error)

	// Info will return the device's information
	Info() DeviceInfo

Device is the most basic capability that any device must implement. Devices can be sent commands and can receive messages

func Create

func Create(bus Bus, info DeviceInfo) (device Device, err error)

Create will return either an I1Device, an I2Device or an I2CsDevice based on the supplied EngineVersion

func New

func New(bus Bus, info DeviceInfo) (Device, error)

New will use the supplied DeviceInfo to create a device instance for the given connection. For instance, if the DevCat is 0x01 with an I2CS EngineVersion then a Dimmer with an underlying i2CsDevice will be returned

type DeviceInfo

type DeviceInfo struct {
	Address         Address         `json:"address"`
	DevCat          DevCat          `json:"devCat"`
	FirmwareVersion FirmwareVersion `json:"firmwareVersion"`
	EngineVersion   EngineVersion   `json:"engineVersion"`

DeviceInfo is a record of information about known devices on the network

type Dimmer

type Dimmer struct {
	// contains filtered or unexported fields

func NewDimmer

func NewDimmer(device Device, bus Bus, info DeviceInfo) *Dimmer

NewDimmer is a factory function that will return a dimmer switch configured appropriately for the given firmware version. All dimmers are switches, so the first argument is a Switch object used to compose the new dimmer

func (*Dimmer) Brighten

func (dd *Dimmer) Brighten() error

func (*Dimmer) Config

func (dd *Dimmer) Config() (config DimmerConfig, err error)

func (*Dimmer) Dim

func (dd *Dimmer) Dim() error

func (*Dimmer) InstantChange

func (dd *Dimmer) InstantChange(level int) error

func (*Dimmer) OffAtRamp

func (dd *Dimmer) OffAtRamp(rate int) error

func (*Dimmer) OnAtRamp

func (dd *Dimmer) OnAtRamp(level, rate int) error

func (*Dimmer) OnFast

func (dd *Dimmer) OnFast() error

func (*Dimmer) SetStatus

func (dd *Dimmer) SetStatus(level int) error

func (*Dimmer) StartBrighten

func (dd *Dimmer) StartBrighten() error

func (*Dimmer) StartDim

func (dd *Dimmer) StartDim() error

func (*Dimmer) StopManualChange

func (dd *Dimmer) StopManualChange() error

func (*Dimmer) String

func (dd *Dimmer) String() string

type DimmerConfig

type DimmerConfig struct {
	// HouseCode is the device X10 house code
	HouseCode int

	// UnitCode is the device X10 unit code
	UnitCode int

	// Ramp is the default ramp rate
	Ramp int

	// OnLevel is the default on level
	OnLevel int

	// SNT is the Signal to Noise Threshold
	SNT int

DimmerConfig includes the X10 configuration as well as default ramp and on levels

func (*DimmerConfig) MarshalBinary

func (dc *DimmerConfig) MarshalBinary() ([]byte, error)

MarshalBinary will convert the DimmerConfig receiver to a byte string

func (*DimmerConfig) UnmarshalBinary

func (dc *DimmerConfig) UnmarshalBinary(buf []byte) error

UnmarshalBinary will parse the byte buffer into the receiver

type Domain

type Domain byte

Domain represents an entire domain of similar devices (dimmers, switches, thermostats, etc)

type EngineVersion

type EngineVersion int

EngineVersion indicates the Insteon engine version that the device is running

const (
	VerI1 EngineVersion = iota

Insteon Engine Versions

func GetEngineVersion

func GetEngineVersion(bus Bus, dst Address) (version EngineVersion, err error)

type EquipmentState

type EquipmentState byte

func (EquipmentState) CoolActive

func (es EquipmentState) CoolActive() bool

func (EquipmentState) HeatActive

func (es EquipmentState) HeatActive() bool

func (EquipmentState) ProgrammableOutputAvailable

func (es EquipmentState) ProgrammableOutputAvailable() bool

func (EquipmentState) ProgrammableOutputState

func (es EquipmentState) ProgrammableOutputState() bool

func (EquipmentState) String

func (es EquipmentState) String() string

type FXDevice

type FXDevice interface {
	FXUsername() (string, error)

FXDevice indicates the device is capable of user-defined FX commands

type FanSpeed

type FanSpeed int
const (
	SingleSpeed FanSpeed = 0x00 // Single Speed
	LowSpeed    FanSpeed = 0x01 // Low Speed
	MedSpeed    FanSpeed = 0x02 // Medium Speed
	HighSpeed   FanSpeed = 0x03 // High Speed

func (FanSpeed) String

func (i FanSpeed) String() string

type FirmwareVersion

type FirmwareVersion int

FirmwareVersion indicates the software/firmware revision number of a device

func (FirmwareVersion) String

func (fv FirmwareVersion) String() string

String will return the hexadecimal string of the firmware version

type Flags

type Flags byte

Flags is the flags byte in an insteon message

func Flag

func Flag(messageType MessageType, extended bool, hopsLeft, maxHops uint8) Flags

Flag allows building of MessageFlags from component parts.

func (Flags) Ack

func (f Flags) Ack() bool

Ack indicates if the message was an acknowledgement

func (Flags) Extended

func (f Flags) Extended() bool

Extended will indicate if the insteon message is extended length

func (Flags) MaxTTL

func (f Flags) MaxTTL() uint8

MaxTTL is the maximum number of times a message can be repeated

func (Flags) Nak

func (f Flags) Nak() bool

Nak indicates if the message was a negative-acknowledgement

func (*Flags) SetTTL

func (f *Flags) SetTTL(ttl uint8)

func (Flags) Standard

func (f Flags) Standard() bool

Standard will indicate if the insteon message is standard length

func (Flags) String

func (f Flags) String() string

func (Flags) TTL

func (f Flags) TTL() uint8

TTL is the remaining number of times an insteon message will be retransmitted. This is decremented each time a message is repeated

func (Flags) Type

func (f Flags) Type() MessageType

Type will return the MessageType of the flags

type Group

type Group byte

Group is the Insteon group to which the Link Record corresponds

func (Group) String

func (g Group) String() string

String representation of the group number

func (*Group) UnmarshalText

func (g *Group) UnmarshalText(text []byte) error

UnmarshalText takes an input string and converts it to its Group equivalent. The decimal input value must be positive and less than 256

type LightFlags

type LightFlags [5]byte

LightFlags are the operating flags for a switch or dimmer

func (LightFlags) CleanupReport

func (lf LightFlags) CleanupReport() bool

CleanupReport enables sending All-link cleanup reports TODO: Confirm this description is correct

func (LightFlags) DBDelta

func (lf LightFlags) DBDelta() int

DBDelta indicates the number of changes that have been written to the all-link database

func (lf LightFlags) ErrorBlink() bool

ErrorBlink enables the device to blink the status LED when errors occur TODO: Confirm this description is correct

func (LightFlags) LED

func (lf LightFlags) LED() bool

LED indicates if the status LED is enabled

func (LightFlags) LoadSense

func (lf LightFlags) LoadSense() bool

LoadSense indicates if the device should activate when a load is added

func (LightFlags) ProgramLock

func (lf LightFlags) ProgramLock() bool

ProgramLock indicates if the Program Lock flag is set

func (LightFlags) ResumeDim

func (lf LightFlags) ResumeDim() bool

ResumeDim indicates if the switch will return to the previous on level or will return to the default on level

func (LightFlags) SNR

func (lf LightFlags) SNR() int

SNR indicates the current signal-to-noise ratio

func (LightFlags) TxLED

func (lf LightFlags) TxLED() bool

TxLED indicates whether the status LED will flash when Insteon traffic is received

func (LightFlags) X10Enabled

func (lf LightFlags) X10Enabled() bool

X10Enabled indicates if the device will respond to X10 commands

type LightState

type LightState struct {
	Level int

type LinkError

type LinkError struct {
	Link  *LinkRecord
	Cause error

func (*LinkError) Error

func (le *LinkError) Error() string

func (*LinkError) Unwrap

func (le *LinkError) Unwrap() error

type LinkID

type LinkID [5]byte

LinkID is the combination of bit 6 of the record control flags (controller/responder), the group ID and the 3 byte address

type LinkRecord

type LinkRecord struct {
	Flags   RecordControlFlags
	Group   Group
	Address Address
	Data    [3]byte

LinkRecord is a single All-Link record in an All-Link database

func ControllerLink(group Group, address Address) *LinkRecord

ControllerLink creates a LinkRecord that is set as a controller record with the group and responder address set to the given arguments

func ResponderLink(group Group, address Address) *LinkRecord

ResponderLink creates a LinkRecord that is set as a responder record with the group and controller address set to the given arguments

func (*LinkRecord) Equal

func (l *LinkRecord) Equal(other *LinkRecord) bool

Equal will determine if another LinkRecord is equivalent. The records are equivalent if they both have the same availability, type (controller/responder) and address

func (*LinkRecord) ID

func (l *LinkRecord) ID() LinkID

func (*LinkRecord) MarshalBinary

func (l *LinkRecord) MarshalBinary() ([]byte, error)

MarshalBinary converts the link-record to a byte string that can be used in a record request

func (*LinkRecord) MarshalText

func (l *LinkRecord) MarshalText() ([]byte, error)

MarshalText will convert the LinkRecord to a text string that can be used as input to the UnmarshalText. This is useful in allowing a user to manuall edit link records

func (*LinkRecord) String

func (l *LinkRecord) String() string

String converts the LinkRecord to a human readable string that looks similar to:

UR        1 01.02.03   00 1c 01

func (*LinkRecord) UnmarshalBinary

func (l *LinkRecord) UnmarshalBinary(buf []byte) (err error)

UnmarshalBinary will convert the byte string received in a message request to a LinkRecord

func (*LinkRecord) UnmarshalText

func (l *LinkRecord) UnmarshalText(buf []byte) (err error)

UnmarshalText takes an input text string and assigns the values to the RecordControlFlags receiver. The input text string should be in the following form:

Flags Group Address    Data
UR        1 01.02.03   00 1c 01

Each field is unmarshaled using the corresponding type's UnmarshalText functions

type LinkTransactionError

type LinkTransactionError struct {
	Errors []*LinkError

func (*LinkTransactionError) Error

func (lte *LinkTransactionError) Error() string

type Linkable

type Linkable interface {

	// EnterLinkingMode is the programmatic equivalent of holding down
	// the set button for two seconds. If the device is the first
	// to enter linking mode, then it is the controller. The next
	// device to enter linking mode is the responder.  LinkingMode
	// is usually indicated by a flashing GREEN LED on the device
	EnterLinkingMode(Group) error

	// EnterUnlinkingMode puts a controller device into unlinking mode
	// when the set button is then pushed (EnterLinkingMode) on a linked
	// device the corresponding links in both the controller and responder
	// are deleted.  EnterUnlinkingMode is the programmatic equivalent
	// to pressing the set button until the device beeps, releasing, then
	// pressing the set button again until the device beeps again. UnlinkingMode
	// is usually indicated by a flashing RED LED on the device
	EnterUnlinkingMode(Group) error

	// ExitLinkingMode takes a controller out of linking/unlinking mode.
	ExitLinkingMode() error

	// Links will return a list of LinkRecords that are present in
	// the All-Link database
	Links() ([]*LinkRecord, error)

	// UpdateLinks will write the given links to the device's all-link
	// database.  Links will be written to available records
	// (link records marked with an Available flag).  If no more
	// available records are found, then the links will be appended
	// to the all-link database.  If a communication failure occurs then
	// the appropriate error is returned (ErrReadTimeout, ErrAckTimeout, etc.)
	// If an existing link is found that has different flags then the existing
	// record is updated to reflect the new flags
	UpdateLinks(...*LinkRecord) error

	// WriteLinks will overwrite the entire device all-link database
	// with the list of links provided.  If a communication failure occurs
	// then the appropriate error is returned (ErrReadTimeout, ErrAckTimeout,
	// etc).
	WriteLinks(...*LinkRecord) error

Linkable is any device that can be put into linking mode and the link database can be managed remotely

type LogLevel

type LogLevel int

LogLevel indicates verbosity of logging

func (*LogLevel) Get

func (ll *LogLevel) Get() interface{}

Get returns the underlying LogLevel value in order to satisfy the flag.Value interface

func (*LogLevel) Set

func (ll *LogLevel) Set(s string) (err error)

Set sets the LogLevel to the matching input string. This function satisfies the Set function for the flag.Value interface

func (LogLevel) String

func (ll LogLevel) String() string

type Logger

type Logger struct {
	Level  LogLevel
	Logger *log.Logger

Logger is a struct that keeps track of a log level and only prints messages of that level or lower

func (*Logger) Debugf

func (s *Logger) Debugf(format string, v ...interface{})

Debugf will print a message at the Debug level

func (*Logger) Errorf

func (s *Logger) Errorf(err error, format string, v ...interface{})

Errorf will print a message at the Info level if the supplied error is non-nil

func (*Logger) Infof

func (s *Logger) Infof(format string, v ...interface{})

Infof will print a message at the Info level

func (*Logger) Tracef

func (s *Logger) Tracef(format string, v ...interface{})

Tracef will print a message at the Trace level

type Matcher

type Matcher interface {
	Matches(msg *Message) bool

func AckMatcher

func AckMatcher() Matcher

func AllLinkMatcher

func AllLinkMatcher() Matcher

func And

func And(matchers ...Matcher) Matcher

func Not

func Not(matcher Matcher) Matcher

func Or

func Or(matchers ...Matcher) Matcher

type Matches

type Matches func(msg *Message) bool

func (Matches) Matches

func (m Matches) Matches(msg *Message) bool

type MemAddress

type MemAddress int

MemAddress is an integer representing a specific location in a device's memory

func (MemAddress) String

func (ma MemAddress) String() string

type Message

type Message struct {
	Src     Address
	Dst     Address
	Flags   Flags
	Command Command
	Payload []byte

Message is a single insteon message

func ReadWithTimeout

func ReadWithTimeout(ch <-chan *Message, timeout time.Duration) (msg *Message, err error)

ReadWithTimeout will attempt to read a message from a channel and will return the read message. If no message is received after the timeout duration, then ErrReadTimeout is returned

func (*Message) Ack

func (m *Message) Ack() bool

Ack indicates if the message is an acknowledgement of a previously sent message

func (*Message) Broadcast

func (m *Message) Broadcast() bool

Broadcast indicates if the message is a broadcast message, as opposed to a direct message (sent directly to the local device)

func (*Message) Equals

func (m *Message) Equals(other *Message) bool

func (*Message) MarshalBinary

func (m *Message) MarshalBinary() (data []byte, err error)

MarshalBinary will convert the Message to a byte slice appropriate for sending out onto the insteon network

func (*Message) Nak

func (m *Message) Nak() bool

Nak indicates a negative acknowledgement. This indicates the device is rejecting a previously sent command

func (*Message) String

func (m *Message) String() (str string)

func (*Message) UnmarshalBinary

func (m *Message) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary will take a byte slice and unmarshal it into the Message fields

type MessageType

type MessageType int

MessageType is an integer representing one of a list of the following types

func (m MessageType) AllLink() bool

func (MessageType) Broadcast

func (m MessageType) Broadcast() bool

Broadcast will indicate whether the MessageType represents a broadcast message

func (MessageType) Direct

func (m MessageType) Direct() bool

Direct will indicate whether the MessageType represents a direct message

func (MessageType) String

func (m MessageType) String() string

type MessageWriter

type MessageWriter interface {
	WriteMessage(*Message) error

type NameableDevice

type NameableDevice interface {
	// TextString returns the information assigned to the device
	TextString() (string, error)

	// SetTextString assigns the information to the device
	SetTextString(string) error

NameableDevice is any device that have a settable text string

type Outlet

type Outlet struct {

func NewOutlet

func NewOutlet(device Device, bus Bus, info DeviceInfo) *Outlet

type PingableDevice

type PingableDevice interface {
	// Ping sends a ping request to the device and waits for a single ACK
	Ping() error

PingableDevice is any device that implements the Ping method

type ProductData

type ProductData struct {
	Key    ProductKey
	DevCat DevCat

ProductData contains information about the device including its product key and device category

func (*ProductData) MarshalBinary

func (pd *ProductData) MarshalBinary() ([]byte, error)

MarshalBinary will convert the ProductData to a binary byte string for sending on the network

func (*ProductData) UnmarshalBinary

func (pd *ProductData) UnmarshalBinary(buf []byte) error

UnmarshalBinary takes the input byte buffer and unmarshals it into the ProductData object

type ProductKey

type ProductKey [3]byte

ProductKey is a 3 byte code assigned by Insteon

func (ProductKey) String

func (p ProductKey) String() string

String returns the hexadecimal string for the product key

type PubSub

type PubSub interface {
	Publish(*Message) (*Message, error)

	Subscribe(matcher Matcher) <-chan *Message

	Unsubscribe(ch <-chan *Message)

	On(matcher Matcher, cb func(*Message)) (unsubscribe func())

type RecordControlFlags

type RecordControlFlags byte

RecordControlFlags indicate whether a link record is a controller or responder and whether it is available or in use

func (RecordControlFlags) Available

func (rcf RecordControlFlags) Available() bool

Available indicates if a link record is available and can be overwritten by a new record. Available is synonmous with "deleted"

func (RecordControlFlags) Controller

func (rcf RecordControlFlags) Controller() bool

Controller indicates that the device is a controller for the device in the link record

func (RecordControlFlags) InUse

func (rcf RecordControlFlags) InUse() bool

InUse indicates if a link record is currently in use by the device

func (RecordControlFlags) LastRecord

func (rcf RecordControlFlags) LastRecord() bool

LastRecord indicates if this link record is the last record (also known as the high water mark) in the database.

func (RecordControlFlags) Responder

func (rcf RecordControlFlags) Responder() bool

Responder indicates that the device is a reponder to the device listed in the link record

func (*RecordControlFlags) SetAvailable

func (rcf *RecordControlFlags) SetAvailable()

SetAvailable indicates that the record is no longer in use and can be overwritten

func (*RecordControlFlags) SetInUse

func (rcf *RecordControlFlags) SetInUse()

SetInUse indicates the the record is active/in use and cannot be overwritten

func (RecordControlFlags) String

func (rcf RecordControlFlags) String() string

String will be "A" or "U" (available or in use) followed by "C" or "R" (controller or responder). This string will always be two characters wide

func (*RecordControlFlags) UnmarshalText

func (rcf *RecordControlFlags) UnmarshalText(text []byte) (err error)

UnmarshalText takes a two character input string and converts it to the correct RecordControlFlags. The first character can be either "A" for available or "U" for unavailable (in use) and the second character is either "C" for controller or "R" for responder

type Switch

type Switch struct {
	// contains filtered or unexported fields

func NewSwitch

func NewSwitch(device Device, bus Bus, info DeviceInfo) *Switch

NewSwitch will return an initialize switch object that controls a physical switch on the netork

func (*Switch) Address

func (sd *Switch) Address() Address

func (*Switch) Config

func (sd *Switch) Config() (config SwitchConfig, err error)

func (*Switch) OperatingFlags

func (sd *Switch) OperatingFlags() (flags LightFlags, err error)

func (*Switch) SetBacklight

func (sd *Switch) SetBacklight(light bool) error

func (*Switch) SetLoadSense

func (sd *Switch) SetLoadSense(loadsense bool) error

func (*Switch) Status

func (sd *Switch) Status() (level int, err error)

Status sends a LightStatusRequest to determine the device's current level. For switched devices this is either 0 or 255, dimmable devices will be the current dim level between 0 and 255

func (*Switch) String

func (sd *Switch) String() string

func (*Switch) TurnOff

func (sd *Switch) TurnOff() error

func (*Switch) TurnOn

func (sd *Switch) TurnOn(level int) error

type SwitchConfig

type SwitchConfig struct {
	// HouseCode is the X10 house code of the switch or dimmer
	HouseCode int

	// UnitCode is the X10 unit code of the switch or dimmer
	UnitCode int

SwitchConfig contains the HouseCode and UnitCode for a switch's X10 configuration

func (*SwitchConfig) MarshalBinary

func (sc *SwitchConfig) MarshalBinary() ([]byte, error)

MarshalBinary will convert the receiver into a serialized byte buffer

func (*SwitchConfig) UnmarshalBinary

func (sc *SwitchConfig) UnmarshalBinary(buf []byte) error

UnmarshalBinary takes the given byte buffer and unmarshals it into the receiver

type Thermostat

type Thermostat struct {
	// contains filtered or unexported fields

func NewThermostat

func NewThermostat(device Device, bus Bus, info DeviceInfo) *Thermostat

NewThermostat will return a configured Thermostat object

func (*Thermostat) Address

func (therm *Thermostat) Address() Address

func (*Thermostat) DecreaseTemp

func (therm *Thermostat) DecreaseTemp(delta int) error

func (*Thermostat) DecreaseZoneTemp

func (therm *Thermostat) DecreaseZoneTemp(zone int, delta int) error

func (*Thermostat) GetAmbientTemp

func (therm *Thermostat) GetAmbientTemp() (temp int, err error)

func (*Thermostat) GetEquipmentState

func (therm *Thermostat) GetEquipmentState() (EquipmentState, error)

func (*Thermostat) GetFanSpeed

func (therm *Thermostat) GetFanSpeed() (FanSpeed, error)

func (*Thermostat) GetInfo

func (therm *Thermostat) GetInfo() (ti ThermostatInfo, err error)

func (*Thermostat) GetMode

func (therm *Thermostat) GetMode() (mode ThermostatMode, err error)

func (*Thermostat) GetTempUnit

func (therm *Thermostat) GetTempUnit() (Unit, error)

func (*Thermostat) GetZoneInfo

func (therm *Thermostat) GetZoneInfo(zone int) (zi ZoneInfo, err error)

func (*Thermostat) IncreaseTemp

func (therm *Thermostat) IncreaseTemp(delta int) error

func (*Thermostat) IncreaseZoneTemp

func (therm *Thermostat) IncreaseZoneTemp(zone int, delta int) error

func (*Thermostat) SetCoolSetpoint

func (therm *Thermostat) SetCoolSetpoint(zone int, temp int) error

func (*Thermostat) SetFanSpeen

func (therm *Thermostat) SetFanSpeen(speed FanSpeed) error

func (*Thermostat) SetHeatSetpoint

func (therm *Thermostat) SetHeatSetpoint(zone int, temp int) error

func (*Thermostat) SetMode

func (therm *Thermostat) SetMode(mode ThermostatMode) error

func (*Thermostat) SetStatusMessage

func (therm *Thermostat) SetStatusMessage(enabled bool) error

func (*Thermostat) SetTempUnit

func (therm *Thermostat) SetTempUnit(unit Unit) error

func (*Thermostat) SetZoneCoolSetpoint

func (therm *Thermostat) SetZoneCoolSetpoint(zone int, temp, deadband int) error

func (*Thermostat) SetZoneHeatSetpoint

func (therm *Thermostat) SetZoneHeatSetpoint(zone int, temp, deadband int) error

func (*Thermostat) Status

func (therm *Thermostat) Status() (status ThermostatStatus, err error)

func (*Thermostat) String

func (therm *Thermostat) String() string

type ThermostatFlags

type ThermostatFlags byte

func (ThermostatFlags) ButtonBeep

func (tf ThermostatFlags) ButtonBeep() bool

func (ThermostatFlags) ButtonLock

func (tf ThermostatFlags) ButtonLock() bool

func (ThermostatFlags) LinkingLock

func (tf ThermostatFlags) LinkingLock() bool

func (ThermostatFlags) TempFormat

func (tf ThermostatFlags) TempFormat() Unit

func (ThermostatFlags) TimeFormat

func (tf ThermostatFlags) TimeFormat() int

type ThermostatInfo

type ThermostatInfo struct {
	// Data Set 1
	Temp              float32
	Humidity          int
	TempOffset        int
	HumidityOffset    int
	Mode              ThermostatMode
	FanMode           int
	BacklightSeconds  int
	HysteresisMinutes int
	Flags             ThermostatFlags

	// Data Set 2
	HumidityLow         int
	HumidityHigh        int
	Rev                 int
	CoolSetPoint        int
	HeatSetPoint        int
	RFOffset            int
	EnergySetbackPoint  int
	ExternalTempOffset  int
	StatusReportEnabled bool
	ExternalPower       bool
	ExternalTemp        bool

func (*ThermostatInfo) String

func (ti *ThermostatInfo) String() string

func (*ThermostatInfo) UnmarshalBinary

func (ti *ThermostatInfo) UnmarshalBinary(data []byte) error

type ThermostatMode

type ThermostatMode byte
const (
	ThermostatOff ThermostatMode = 0x00 // Thermostat Off
	Heat          ThermostatMode = 0x01 // Heat Mode
	Cool          ThermostatMode = 0x02 // Cool Mode
	Auto          ThermostatMode = 0x03 // Auto Mode
	FanOn         ThermostatMode = 0x04 // Fan On
	ProgramAuto   ThermostatMode = 0x05 // Program Auto
	ProgramHeat   ThermostatMode = 0x06 // Program Heat
	ProgramCool   ThermostatMode = 0x07 // Program Cool
	FanOff        ThermostatMode = 0x08 // Fan Off

func (ThermostatMode) String

func (i ThermostatMode) String() string

type ThermostatStatus

type ThermostatStatus struct {
	Temperature int
	Humidity    int
	Setpoint    int
	Deadband    int
	Unit        Unit
	Mode        ThermostatMode
	State       EquipmentState

type Unit

type Unit int
const (
	Fahrenheit Unit = 0x00 // °F
	Celsius    Unit = 0x01 // °C

func (Unit) String

func (i Unit) String() string

type ZoneInfo

type ZoneInfo [4]int

func (ZoneInfo) Deadband

func (zi ZoneInfo) Deadband() int

func (ZoneInfo) Humidity

func (zi ZoneInfo) Humidity() int

func (ZoneInfo) Setpoint

func (zi ZoneInfo) Setpoint() int

func (ZoneInfo) Temperature

func (zi ZoneInfo) Temperature() int


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL