insteon

package module
v0.0.0-...-ceae620 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: MIT Imports: 14 Imported by: 0

README

Insteon Hub Library for Go

A Go library for interfacing with Insteon Hubs. Currently, this library supports: the original 2242-222 (HUB1), the 2245-222 (HUB2), and the PLM Modems (2413S/2413U).

The library supports most of the Insteon PLM protocol and is capable of communicating with most devices and managing the All-Link databases on the modems and devices.

Usage Example:

    package example

    import(
    	"context"
    	
    	"github.com/swedishborgie/go-insteon"
    )
    
    func toggleLight() error {
        hub, err := insteon.NewHub2242("<address>:9761")
        // or
        // hub, err := insteon.NewHub2245("<address>", "<username>", "<password>")
        // or
        // hub, err := insteon.NewHubPLM("<serial port path>")
        if err != nil {
            return err
        }
    
        device, err := insteon.NewDevice(hub, insteon.Address{0x12, 0x34, 0x56})
        if err != nil {
            return err
        }

        ctx := context.Background()
    
        status, err := device.GetStatus(ctx)
        if err != nil {
            return err
        }
    
        if status.Level > 0 {
            return device.TurnOff(ctx)
        } else {
            return device.TurnOn(ctx)
        }
    }

Documentation for the Insteon devices can be found here:

A huge thank you to the insteon-mqtt project for documenting some of the more arcane idiosyncrasies associated with the protocol and devices.

Documentation

Index

Constants

View Source
const (
	StreamingCommandPause = 200 * time.Millisecond
	ChannelBufferSize     = 10
)
View Source
const (
	LinkCodeResponder  = LinkCode(0)
	LinkCodeController = LinkCode(1)
	LinkCodeAuto       = LinkCode(3)
	LinkCodeDeleted    = LinkCode(0xFF)
	LinkCodeUnknown    = LinkCode(0xFE)
)
View Source
const (
	ButtonEventSetTapped    = ButtonEventType(0x02)
	ButtonEventSetHeld      = ButtonEventType(0x03)
	ButtonEventSetReleased  = ButtonEventType(0x04)
	ButtonEventBtn2Tapped   = ButtonEventType(0x12)
	ButtonEventBtn2Held     = ButtonEventType(0x13)
	ButtonEventBtn2Released = ButtonEventType(0x14)
	ButtonEventBtn3Tapped   = ButtonEventType(0x22)
	ButtonEventBtn3Held     = ButtonEventType(0x23)
	ButtonEventBtn3Released = ButtonEventType(0x24)
	ButtonEventUnknown      = ButtonEventType(0xFF)
)
View Source
const (
	AllLinkCleanupStatusSuccess = AllLinkCleanupStatus(serialACK)
	AllLinkCleanupStatusFailure = AllLinkCleanupStatus(serialNAK)
	AllLinkCleanupStatusUnknown = AllLinkCleanupStatus(0xFF)
)
View Source
const (
	CommandFlagExtended        = 0x10
	CommandFlagAck             = 0x20
	CommandFlagGroup           = 0x40
	CommandFlagBroadcast       = 0x80
	CommandFlagRetransmitNever = 0x0
	CommandFlagRetransmitOnce  = 0x1
	CommandFlagRetransmitTwice = 0x2
	CommandFlagRetransmitMax   = 0x3
	CommandFlagHopsLeftNone    = 0x0
	CommandFlagHopsLeftOne     = 0x4
	CommandFlagHopsLeftTwo     = 0x8
	CommandFlagHopsLeftThree   = 0xC
)
View Source
const (
	CommDirectionHostToIM = iota
	CommDirectionIMToHost
	CommDirectionUnknown
)
View Source
const PLMBaudRate = 19200

Variables

View Source
var (
	ErrDBEntryNotFound      = errors.New("unable to find database entry")
	ErrDBEntryAlreadyExists = errors.New("database entry for this device already exists")
)
View Source
var (
	// ErrNotReady indicates the Hub received the command but isn't in a state where it's capable of processing it.
	ErrNotReady = errors.New("device not ready")
	// ErrAckTimeout indicates we didn't receive an acknowledgement in an appropriate amount of time.
	ErrAckTimeout = errors.New("ack timeout")
)
View Source
var ErrUnexpectedAckByte = errors.New("unexpected acknowledgement byte")

Functions

func GetProductDesc

func GetProductDesc(cat Category, sub SubCategory) string

Types

type Ack

type Ack struct {
	Response []byte
	Type     byte
}

func (*Ack) ID

func (a *Ack) ID() byte

func (*Ack) Length

func (a *Ack) Length() int

type Address

type Address [3]byte

func (Address) String

func (a Address) String() string

type AllLinkCleanup

type AllLinkCleanup struct {
	Status AllLinkCleanupStatus
}

func (*AllLinkCleanup) ID

func (cr *AllLinkCleanup) ID() byte

func (*AllLinkCleanup) Length

func (cr *AllLinkCleanup) Length() int

type AllLinkCleanupFailure

type AllLinkCleanupFailure struct {
	Group   byte
	Address Address
}

func (*AllLinkCleanupFailure) ID

func (cr *AllLinkCleanupFailure) ID() byte

func (*AllLinkCleanupFailure) Length

func (cr *AllLinkCleanupFailure) Length() int

type AllLinkCleanupStatus

type AllLinkCleanupStatus byte

type AllLinkCompleted

type AllLinkCompleted struct {
	LinkCode    LinkCode
	Group       byte
	Address     Address
	Category    Category
	SubCategory SubCategory
	Firmware    byte
}

func (*AllLinkCompleted) ID

func (cr *AllLinkCompleted) ID() byte

func (*AllLinkCompleted) Length

func (cr *AllLinkCompleted) Length() int

type AllLinkRecord

type AllLinkRecord struct {
	Flags   AllLinkRecordFlags
	Group   byte
	Address Address
	Data    [3]byte
}

func (*AllLinkRecord) ID

func (cr *AllLinkRecord) ID() byte

func (*AllLinkRecord) Length

func (cr *AllLinkRecord) Length() int

type AllLinkRecordFlags

type AllLinkRecordFlags byte
const (
	AllLinkRecordFlagsInUse     AllLinkRecordFlags = 0x80
	AllLinkRecordFlagsContoller AllLinkRecordFlags = 0x40
	AllLinkRecordFlagsLast      AllLinkRecordFlags = 0x2
)

func (AllLinkRecordFlags) Controller

func (al AllLinkRecordFlags) Controller() bool

func (AllLinkRecordFlags) InUse

func (al AllLinkRecordFlags) InUse() bool

func (AllLinkRecordFlags) Last

func (al AllLinkRecordFlags) Last() bool

func (AllLinkRecordFlags) String

func (al AllLinkRecordFlags) String() string

type ButtonEvent

type ButtonEvent struct {
	Event ButtonEventType
}

func (*ButtonEvent) ID

func (cr *ButtonEvent) ID() byte

func (*ButtonEvent) Length

func (cr *ButtonEvent) Length() int

type ButtonEventType

type ButtonEventType byte

type Category

type Category byte
const (
	CategoryGeneralController    Category = 0x00
	CategoryDimmableLighting     Category = 0x01
	CategorySwitchedLighting     Category = 0x02
	CategoryNetworkBridge        Category = 0x03
	CategoryIrrigation           Category = 0x04
	CategoryClimate              Category = 0x05
	CategoryPoolAndSpa           Category = 0x06
	CategorySensorsAndActuators  Category = 0x07
	CategoryHomeEntertainment    Category = 0x08
	CategoryEnergyManagement     Category = 0x09
	CategoryAppliance            Category = 0x0A
	CategoryPlumbing             Category = 0x0B
	CategoryCommunication        Category = 0x0C
	CategoryComputer             Category = 0x0D
	CategoryWindowCovering       Category = 0x0E
	CategoryAccess               Category = 0x0F
	CategorySecurityHealthSafety Category = 0x10
	CategorySurveillance         Category = 0x11
	CategoryAutomotive           Category = 0x12
	CategoryPetCare              Category = 0x13
	CategoryToys                 Category = 0x14
	CategoryTimekeeping          Category = 0x15
	CategoryHoliday              Category = 0x16
	CategoryReserved             Category = 0x17
	CategoryUnassigned           Category = 0xFF
)

func (Category) String

func (c Category) String() string

type CommDirection

type CommDirection int

func (CommDirection) String

func (cd CommDirection) String() string

type CommLogger

type CommLogger func(CommDirection, []byte)

type CommandFlag

type CommandFlag byte

type CommandResponse

type CommandResponse interface {
	From() Address
	To() Address
	Flags() CommandResponseFlags
	Cmd1() byte
	Cmd2() byte
	Data() []byte
}

type CommandResponseFlags

type CommandResponseFlags byte

func (CommandResponseFlags) Acknowledgement

func (flags CommandResponseFlags) Acknowledgement() bool
func (flags CommandResponseFlags) AllLink() bool

func (CommandResponseFlags) BroadcastNAK

func (flags CommandResponseFlags) BroadcastNAK() bool

func (CommandResponseFlags) Extended

func (flags CommandResponseFlags) Extended() bool

func (CommandResponseFlags) HopsLeft

func (flags CommandResponseFlags) HopsLeft() int

func (CommandResponseFlags) MaxHops

func (flags CommandResponseFlags) MaxHops() int

func (CommandResponseFlags) String

func (flags CommandResponseFlags) String() string

type DatabaseRecord

type DatabaseRecord struct {
	MemAddr uint16
	Record  *AllLinkRecord
}

func (*DatabaseRecord) ID

func (cr *DatabaseRecord) ID() byte

func (*DatabaseRecord) Length

func (cr *DatabaseRecord) Length() int

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device represents an Insteon device.

func NewDevice

func NewDevice(hub Hub, addr Address) (*Device, error)

NewDevice creates a new device by raw address.

func (d *Device) AddAllLink(ctx context.Context, addr Address, group byte, data [3]byte, controller bool) error

func (*Device) Address

func (d *Device) Address() Address
func (d *Device) DeleteAllLink(ctx context.Context, addr Address, group byte, controller bool) error

func (*Device) GetDatabase

func (d *Device) GetDatabase(ctx context.Context) (map[uint16]*AllLinkRecord, error)

func (*Device) GetName

func (d *Device) GetName(ctx context.Context) (string, error)

func (*Device) GetOperatingFlags

func (d *Device) GetOperatingFlags(ctx context.Context) (DeviceOpFlags, error)

func (*Device) GetProductData

func (d *Device) GetProductData(ctx context.Context) (*Product, error)

func (*Device) GetStatus

func (d *Device) GetStatus(ctx context.Context) (*DeviceStatus, error)

GetStatus gets the current power status of the device.

func (*Device) GetStatusChannel

func (d *Device) GetStatusChannel(ctx context.Context, channel byte) (*DeviceStatus, error)

GetStatusChannel gets the current power status of the device.

func (*Device) Ping

func (d *Device) Ping(ctx context.Context) error

func (*Device) SetFanLevel

func (d *Device) SetFanLevel(ctx context.Context, level byte) error

func (*Device) SetName

func (d *Device) SetName(ctx context.Context, name string) error
func (d *Device) StartAllLink(ctx context.Context, group byte) error

func (*Device) TurnOff

func (d *Device) TurnOff(ctx context.Context) error

TurnOff turns off a device.

func (*Device) TurnOffRamp

func (d *Device) TurnOffRamp(ctx context.Context, ramp bool) error

TurnOffRamp turns off a device with optional ramp.

func (*Device) TurnOn

func (d *Device) TurnOn(ctx context.Context) error

TurnOn turns on a device.

func (*Device) TurnOnLevel

func (d *Device) TurnOnLevel(ctx context.Context, ramp bool, level byte) error

TurnOnLevel turns on a dimmable device set to a specific level.

func (*Device) TurnOnRamp

func (d *Device) TurnOnRamp(ctx context.Context, ramp bool) error

TurnOnRamp turns on a device with optional ramp. Ramp only works if the device is dimmable.

func (d *Device) UpdateAllLink(ctx context.Context, addr Address, group byte, data [3]byte, controller bool) error

type DeviceIdentification

type DeviceIdentification struct {
	Category    byte
	SubCategory byte
	Firmware    byte
}

type DeviceOpFlags

type DeviceOpFlags byte

func (DeviceOpFlags) LED

func (f DeviceOpFlags) LED() bool

func (DeviceOpFlags) LEDTransmit

func (f DeviceOpFlags) LEDTransmit() bool

func (DeviceOpFlags) LoadSense

func (f DeviceOpFlags) LoadSense() bool

func (DeviceOpFlags) ProgramLock

func (f DeviceOpFlags) ProgramLock() bool

func (DeviceOpFlags) ResumeDim

func (f DeviceOpFlags) ResumeDim() bool

func (DeviceOpFlags) String

func (f DeviceOpFlags) String() string

type DeviceStatus

type DeviceStatus struct {
	// DeviceAddr is the address of the device.
	DeviceAddr Address
	// ModemAddr is the address of the hub.
	ModemAddr Address
	// Hop count to the device.
	HopCount byte
	// Delta of the device.
	Delta byte
	// Current power level of the device.
	Level byte
}

DeviceStatus represents the status of a device.

type Event

type Event interface {
	ID() byte
	Length() int
	// contains filtered or unexported methods
}

type EventListener

type EventListener func(Event, error)

type ExtCommandResponse

type ExtCommandResponse struct {
	StdCommandResponse
	// contains filtered or unexported fields
}

func (*ExtCommandResponse) Data

func (cr *ExtCommandResponse) Data() []byte

func (*ExtCommandResponse) ID

func (cr *ExtCommandResponse) ID() byte

func (*ExtCommandResponse) Length

func (cr *ExtCommandResponse) Length() int

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group represents a device grouop.

func NewGroup

func NewGroup(hub Hub, groupID byte) *Group

NewGroup creates a new group.

func (*Group) TurnOff

func (g *Group) TurnOff(ctx context.Context) error

TurnOff turns off the group.

func (*Group) TurnOn

func (g *Group) TurnOn(ctx context.Context) error

TurnOn turns on the group.

type Hub

type Hub interface {
	// SendMessage sends a standard length message to a remote device connected to the same network as this Hub.
	SendMessage(ctx context.Context, addr Address, imCmd1 byte, imCmd2 byte) (CommandResponse, error)
	// SendExtendedMessage sends an extended length message to a remote device connected to the same network as this
	// Hub.
	SendExtendedMessage(ctx context.Context, addr Address, imCmd1, imCmd2 byte, userData [14]byte) (CommandResponse, error)
	// Expect indicates that you're interested in waiting for a particular type of event from the Hub. The first event
	// with a matching ID will be returned.
	Expect(ctx context.Context, evt Event) (Event, error)
	// SendX10 sends an X10 message to the network this Hub is connected to.
	SendX10(context.Context, X10Raw, X10Flags) error
	// SendGroupCommand sends a group command to the network this Hub is connected to.
	SendGroupCommand(ctx context.Context, hostCmd byte, group byte) error
	// AddEventListener registers a listener interested in events coming from this Hub.
	AddEventListener(EventListener)
	// RemoveEventListener removes a previously registered EventListener.
	RemoveEventListener(EventListener)
	// SetCommLogger can be used to intercept the underlying serial communications between the host and this Hub.
	SetCommLogger(CommLogger)

	// GetInfo gets information about the Hub we're currently communicating with such as the Address, Category,
	// SubCategory, and firmware version.
	GetInfo(context.Context) (*ModemInfo, error)
	// SetDeviceCategory changes the Category, SubCategory, and Firmware Version of this Hub.
	SetDeviceCategory(context.Context, Category, SubCategory, byte) error
	// Sleep tells the Hub to go into low power mode.
	Sleep(context.Context) error
	// Reset clears the All-Link database, Modem Configuration, and Hub Information.
	Reset(context.Context) error
	// GetModemConfig gets the current modem configuration for the Hub we're communicating with.
	GetModemConfig(context.Context) (ModemConfiguration, error)
	// SetModemConfig sets the modem configuration for the current Hub.
	SetModemConfig(context.Context, ModemConfiguration) error
	// StartAllLink puts the modem into All-Link mode without requiring the user to press the button on the Hub.
	StartAllLink(context.Context, LinkCode, byte) (*AllLinkCompleted, error)
	// CancelAllLink removes the modem from All-Link mode.
	CancelAllLink(context.Context) error
	// ModifyAllLinkEntry modifies a single entry in the Hub's All-Link database.
	ModifyAllLinkEntry(context.Context, ManageAllLinkCommand, AllLinkRecordFlags, byte, Address, [3]byte) error
	// GetAllLinkDatabase retrieves all entries from the Hub's All-Link database.
	GetAllLinkDatabase(context.Context) ([]*AllLinkRecord, error)
	// GetLastSender gets the All-Link record of the last Insteon device to communicate with the Hub.
	GetLastSender(context.Context) (*AllLinkRecord, error)
	// Beep makes the Hub audibly beep.
	Beep(context.Context) error
	// ReadDB performs a raw read of the Hub's All-Link database.
	ReadDB(context.Context, uint16) (*DatabaseRecord, error)
	// WriteDB performs a raw write of the Hub's All-Link database.
	WriteDB(context.Context, uint16, *AllLinkRecord) error
	// SetLED sets the status of the Hub's LED.
	SetLED(context.Context, bool) error
}

Hub is an interface that represents functionality that can be performed by any of the Insteon Hub's. A generic implementation is provided by HubStreaming. The underlying serial communication protocol is described in these documents: https://cache.insteon.com/pdf/INSTEON_Modem_Developer%27s_Guide_20071012a.pdf http://cache.insteon.com/developer/2242-222dev-062013-en.pdf

func NewHub2242

func NewHub2242(address string) (Hub, error)

func NewHub2245

func NewHub2245(address string, userName string, password string) (Hub, error)

NewHub2245 creates a new reference to an Insteon Hub2. This hub is a little different from the Hub1 and the Serial PLM in that it has an HTTP interface. The interface is a little unfortunate though since you lose bi-directional real time communication, so you end up having to poll for events which makes interfacing to this modem a bit slower.

func NewHubPLM

func NewHubPLM(dev string) (Hub, error)

type Hub2242

type Hub2242 struct {
	*HubStreaming
	// contains filtered or unexported fields
}

type Hub2245

type Hub2245 struct {
	*HubStreaming
	// contains filtered or unexported fields
}

Hub2245 is a reference to an Insteon Hub.

func (*Hub2245) Close

func (hub *Hub2245) Close() error

func (*Hub2245) Read

func (hub *Hub2245) Read(p []byte) (n int, err error)

func (*Hub2245) Write

func (hub *Hub2245) Write(p []byte) (n int, err error)

type HubPLM

type HubPLM struct {
	*HubStreaming
	// contains filtered or unexported fields
}

type HubStreaming

type HubStreaming struct {
	// contains filtered or unexported fields
}

HubStreaming is a generic hub implementation that assumes we have a bi-directional data stream to the PLM modem.

func NewHubStreaming

func NewHubStreaming(stream io.ReadWriteCloser) (*HubStreaming, error)

NewHubStreaming creates a new streaming hub implementation around the passed in stream implementation.

func (*HubStreaming) AddEventListener

func (hub *HubStreaming) AddEventListener(listener EventListener)

func (*HubStreaming) Beep

func (hub *HubStreaming) Beep(ctx context.Context) error
func (hub *HubStreaming) CancelAllLink(ctx context.Context) error

func (*HubStreaming) Expect

func (hub *HubStreaming) Expect(ctx context.Context, evt Event) (Event, error)

func (*HubStreaming) GetAllLinkDatabase

func (hub *HubStreaming) GetAllLinkDatabase(ctx context.Context) ([]*AllLinkRecord, error)

func (*HubStreaming) GetInfo

func (hub *HubStreaming) GetInfo(ctx context.Context) (*ModemInfo, error)

func (*HubStreaming) GetLastSender

func (hub *HubStreaming) GetLastSender(ctx context.Context) (*AllLinkRecord, error)

func (*HubStreaming) GetModemConfig

func (hub *HubStreaming) GetModemConfig(ctx context.Context) (ModemConfiguration, error)

func (*HubStreaming) ModifyAllLinkEntry

func (hub *HubStreaming) ModifyAllLinkEntry(ctx context.Context, alCmd ManageAllLinkCommand, flags AllLinkRecordFlags,
	group byte, addr Address, data [3]byte) error

func (*HubStreaming) ReadDB

func (hub *HubStreaming) ReadDB(ctx context.Context, addr uint16) (*DatabaseRecord, error)

func (*HubStreaming) RemoveEventListener

func (hub *HubStreaming) RemoveEventListener(listener EventListener)

func (*HubStreaming) Reset

func (hub *HubStreaming) Reset(ctx context.Context) error

func (*HubStreaming) SendExtendedMessage

func (hub *HubStreaming) SendExtendedMessage(ctx context.Context, addr Address, imCmd1, imCmd2 byte, userData [14]byte) (CommandResponse, error)

SendExtendedMessage sends an extended length message to a remotes device on the Insteon network.

func (*HubStreaming) SendGroupCommand

func (hub *HubStreaming) SendGroupCommand(ctx context.Context, cmd1 byte, group byte) error

func (*HubStreaming) SendMessage

func (hub *HubStreaming) SendMessage(ctx context.Context, addr Address, imCmd1 byte, imCmd2 byte) (CommandResponse, error)

SendMessage sends a standard length message to a remote device on the Insteon network.

func (*HubStreaming) SendX10

func (hub *HubStreaming) SendX10(ctx context.Context, raw X10Raw, flags X10Flags) error

func (*HubStreaming) SetCommLogger

func (hub *HubStreaming) SetCommLogger(logger CommLogger)

func (*HubStreaming) SetDeviceCategory

func (hub *HubStreaming) SetDeviceCategory(ctx context.Context, cat Category, sub SubCategory, fw byte) error

func (*HubStreaming) SetLED

func (hub *HubStreaming) SetLED(ctx context.Context, on bool) error

func (*HubStreaming) SetModemConfig

func (hub *HubStreaming) SetModemConfig(ctx context.Context, cfg ModemConfiguration) error

func (*HubStreaming) Sleep

func (hub *HubStreaming) Sleep(ctx context.Context) error
func (hub *HubStreaming) StartAllLink(ctx context.Context, code LinkCode, group byte) (*AllLinkCompleted, error)

func (*HubStreaming) WriteDB

func (hub *HubStreaming) WriteDB(ctx context.Context, addr uint16, rec *AllLinkRecord) error

type LinkCode

type LinkCode byte

type ManageAllLinkCommand

type ManageAllLinkCommand byte
const (
	ManageAllLinkFindFirst     ManageAllLinkCommand = 0x00
	ManageAllLinkFindNext      ManageAllLinkCommand = 0x01
	ManageAllLinkUpdate        ManageAllLinkCommand = 0x20
	ManageAllLinkAddController ManageAllLinkCommand = 0x40
	ManageAllLinkAddResponder  ManageAllLinkCommand = 0x41
	ManageAllLinkDelete        ManageAllLinkCommand = 0x80
)

type ModemConfiguration

type ModemConfiguration byte

ModemConfiguration is a bitfield describing the current configuration of a PLM.

const (
	// ModemConfigurationAutoLink enables automatic linking when the user pushes and holds the SET Button.
	ModemConfigurationAutoLink ModemConfiguration = 0x80
	// ModemConfigurationMonitor puts the modem into Monitor Mode. Monitor mode allows the modem to receive communication
	// from any device in the Modem's All-Link database regardless of whether or not the message is addressed to the
	// modem.
	ModemConfigurationMonitor ModemConfiguration = 0x40
	// ModemConfigurationAutoLED enables automatic LED operation. This must be off to use Hub.SetLED().
	ModemConfigurationAutoLED ModemConfiguration = 0x20
	// ModemConfigurationDeadMan enables dead-man detection for communication between the modem and ourselves. Dead-man
	// detection will automatically reset communication if commands aren't sent in 240ms.
	ModemConfigurationDeadMan ModemConfiguration = 0x10
)

func (ModemConfiguration) AutoLED

func (mc ModemConfiguration) AutoLED() bool

AutoLED indicates of the ModemConfigurationAutoLED flag is set on this ModemConfiguration.

func (mc ModemConfiguration) AutoLink() bool

AutoLink indicates of the ModemConfigurationAutoLink flag is set on this ModemConfiguration.

func (ModemConfiguration) DeadMan

func (mc ModemConfiguration) DeadMan() bool

DeadMan indicates of the ModemConfigurationDeadMan flag is set on this ModemConfiguration.

func (ModemConfiguration) Monitor

func (mc ModemConfiguration) Monitor() bool

Monitor indicates of the ModemConfigurationMonitor flag is set on this ModemConfiguration.

func (ModemConfiguration) String

func (mc ModemConfiguration) String() string

String describes the state of the modem configuration in a human readable format.

type ModemInfo

type ModemInfo struct {
	Address         Address
	Category        Category
	SubCategory     SubCategory
	FirmwareVersion byte
}

ModemInfo describes an Insteon Power Line Modem, typically the Hub you're connected to.

type Product

type Product struct {
	Category    Category
	SubCategory SubCategory
	ProductKey  uint
	Description string
}

type StdCommandResponse

type StdCommandResponse struct {
	// contains filtered or unexported fields
}

func (*StdCommandResponse) Cmd1

func (cr *StdCommandResponse) Cmd1() byte

func (*StdCommandResponse) Cmd2

func (cr *StdCommandResponse) Cmd2() byte

func (*StdCommandResponse) Data

func (cr *StdCommandResponse) Data() []byte

func (*StdCommandResponse) Flags

func (*StdCommandResponse) From

func (cr *StdCommandResponse) From() Address

func (*StdCommandResponse) ID

func (cr *StdCommandResponse) ID() byte

func (*StdCommandResponse) Length

func (cr *StdCommandResponse) Length() int

func (*StdCommandResponse) To

func (cr *StdCommandResponse) To() Address

type SubCategory

type SubCategory byte

type UserReset

type UserReset struct{}

func (*UserReset) ID

func (cr *UserReset) ID() byte

func (*UserReset) Length

func (cr *UserReset) Length() int

type X10Command

type X10Command byte
const (
	X10CommandAllLightsOff X10Command = 0x0
	X10CommandStatusOff    X10Command = 0x1
	X10CommandOn           X10Command = 0x2
	X10CommandPresetDim1   X10Command = 0x3
	X10CommandAllLightsOn  X10Command = 0x4
	X10CommandHailAck      X10Command = 0x5
	X10CommandBright       X10Command = 0x6
	X10CommandStatusOn     X10Command = 0x7
	X10CommandExtendedCode X10Command = 0x8
	X10CommandStatusReq    X10Command = 0x9
	X10CommandOff          X10Command = 0xA
	X10CommandPresetDim2   X10Command = 0xB
	X10CommandAllUnitsOff  X10Command = 0xC
	X10CommandHailReq      X10Command = 0xD
	X10CommandDim          X10Command = 0xE
	X10CommandExtAnalog    X10Command = 0xF
)

type X10Flags

type X10Flags byte

func (X10Flags) Command

func (x X10Flags) Command() bool

func (X10Flags) UnitCode

func (x X10Flags) UnitCode() bool

type X10HouseCode

type X10HouseCode byte
const (
	X10HouseCodeA X10HouseCode = 0x6
	X10HouseCodeB X10HouseCode = 0xE
	X10HouseCodeC X10HouseCode = 0x2
	X10HouseCodeD X10HouseCode = 0xA
	X10HouseCodeE X10HouseCode = 0x1
	X10HouseCodeF X10HouseCode = 0x9
	X10HouseCodeG X10HouseCode = 0x5
	X10HouseCodeH X10HouseCode = 0xD
	X10HouseCodeI X10HouseCode = 0x7
	X10HouseCodeJ X10HouseCode = 0xF
	X10HouseCodeK X10HouseCode = 0x3
	X10HouseCodeL X10HouseCode = 0xB
	X10HouseCodeM X10HouseCode = 0x0
	X10HouseCodeN X10HouseCode = 0x8
	X10HouseCodeO X10HouseCode = 0x4
	X10HouseCodeP X10HouseCode = 0xC
)

type X10Raw

type X10Raw byte

func (X10Raw) Command

func (x X10Raw) Command() X10Command

func (X10Raw) HouseCode

func (x X10Raw) HouseCode() X10HouseCode

func (X10Raw) UnitCode

func (x X10Raw) UnitCode() byte

type X10Response

type X10Response struct {
	// contains filtered or unexported fields
}

func (*X10Response) ID

func (cr *X10Response) ID() byte

func (*X10Response) Length

func (cr *X10Response) Length() int

Jump to

Keyboard shortcuts

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