Documentation ¶
Index ¶
- Constants
- Variables
- func StartStopWrap(w io.ReadWriteCloser) io.ReadWriteCloser
- type BatteryState
- type Datapoint
- func (dp *Datapoint) Channel() int
- func (d *Datapoint) CurrentTemperature(ctx context.Context, value float32) ([]byte, error)
- func (d *Datapoint) DesiredTemperature(ctx context.Context, value float32) ([]byte, error)
- func (dp *Datapoint) Device() *Device
- func (d *Datapoint) Dim(ctx context.Context, value int) ([]byte, error)
- func (d *Datapoint) DimWithSpeed(ctx context.Context, value, speed int) ([]byte, error)
- func (dp *Datapoint) Id() string
- func (dp *Datapoint) Mode() int
- func (dp *Datapoint) Name() string
- func (dp *Datapoint) Number() int
- func (d *Datapoint) Shutter(ctx context.Context, cmd ShutterCommand) ([]byte, error)
- func (d *Datapoint) Switch(ctx context.Context, on bool) ([]byte, error)
- func (dp *Datapoint) Type() channelType
- type Device
- func (d Device) IsBatteryOperated() bool
- func (d Device) IsDimmingActuator() bool
- func (d Device) IsHeatingActuator() bool
- func (d Device) IsShutter() bool
- func (d Device) IsSwitchingActuator() bool
- func (d Device) Name() string
- func (d Device) ReportsPower() bool
- func (d Device) SerialNumber() int
- func (d Device) Type() DeviceType
- type DeviceType
- type ErrGeneral
- type Event
- type Handler
- type Interface
- func (i *Interface) Datapoint(number int) *Datapoint
- func (i *Interface) Device(serialNumber int) *Device
- func (i *Interface) ForEachDatapoint(dpfunc func(*Datapoint) error) error
- func (i *Interface) ForEachDevice(devfunc func(*Device) error) error
- func (i *Interface) GetCounterRx() (uint32, error)
- func (i *Interface) GetCounterTx() (uint32, error)
- func (i *Interface) Init(handler Handler, verbose bool)
- func (i *Interface) ReadFile(filename string) error
- func (i *Interface) Release() (rf, fw float32, err error)
- func (i *Interface) RequestDPL(ctx context.Context) error
- func (i *Interface) Revision() (hw, rf, fw int, err error)
- func (i *Interface) Run(ctx context.Context, conn io.ReadWriter) error
- func (i *Interface) Serial() (uint32, error)
- func (i *Interface) SetOKMRF() error
- func (i *Interface) SetRfSeqNo() error
- type Queue
- type ShutterCommand
- type ShutterStatus
- type SignalStrength
- type StartStopWrapper
Constants ¶
View Source
const ( MCI_PT_TX = 0xB1 MCI_PT_CONFIG = 0xB2 MCI_PT_RX = 0xC1 MCI_PT_STATUS = 0xC3 MCI_PT_EXTENDED = 0xD1 )
View Source
const ( MCI_TE_UCHAR = 0x02 MCI_TE_SWITCH = 0x0A MCI_TE_DIM = 0x0D // Dimmer, Analogue MCI_TE_JALO = 0x0E // Jalousie MCI_TE_PUSHBUTTON = 0x50 // All types MCI_TE_REQUEST = 0x0B // All mains powered MCI_TE_INT16_1POINT = 0x11 MCI_TE_FLOAT = 0x1A // Room Manager, Analogue input MCI_TE_TIME = 0x2A // Room Manager, HRV MCI_TE_DATE = 0x2B // Room Manager, HRV MCI_TE_RC_DATA = 0x2C MCI_TE_UNIT32 = 0x30 // Room Manager MCI_TE_UINT32_1POINT = 0x31 MCI_TE_UINT32_2POINT = 0x32 MCI_TE_UINT32_3POINT = 0x33 MCI_TE_UINT16 = 0x40 MCI_TE_UINT16_1POINT = 0x41 MCI_TE_UINT16_2POINT = 0x42 MCI_TE_UINT16_3POINT = 0x43 MCI_TE_DIMPLEX_CONFIG = 0x44 MCI_TE_DIMPLEX_TEMP = 0x45 MCI_TE_HRV_IN = 0x46 MCI_TE_REQ_STATUS_NEW = 0x72 MCI_TE_BASICMODE = 0x80 MCI_TE_DIRECT = 0xA0 )
View Source
const ( // TX_EVENT_SWITCH MCI_TED_OFF = 0x00 MCI_TED_ON = 0x01 // TX_EVENT_DIM MCI_TED_STOP = 0x00 MCI_TED_DARKER = 0x04 MCI_TED_BRIGHTER = 0x0F MCI_TED_PERCENT = 0x40 // TX_EVENT_JALO MCI_TED_CLOSE = 0x00 MCI_TED_OPEN = 0x01 MCI_TED_JSTOP = 0x02 MCI_TED_STEP_CLOSE = 0x10 MCI_TED_STEP_OPEN = 0x11 // TX_EVENT_PUSHBUTTON MCI_TED_UP = 0x50 MCI_TED_DOWN = 0x51 MCI_TED_UP_PRESSED = 0x54 MCI_TED_UP_RELEASED = 0x55 MCI_TED_DOWN_PRESSED = 0x56 MCI_TED_DOWN_RELEASED = 0x57 // TX_EVENT_REQUEST MCI_TED_DUMMY = 0x00 // TX_EVENT_BASIC_MODE MCI_TED_LEARNMODE_ON = 0x00 MCI_TED_LEARNMODE_OFF = 0x01 MCI_TED_ASSIGN_ACTUATOR = 0x10 MCI_TED_REMOVE_ACTUATOR = 0x20 MCI_TED_REMOVE_SENSOR = 0x30 MCI_TED_DIRECT_ON = 0xA0 MCI_TED_DIRECT_OFF = 0xA1 MCI_TED_DIRECT_SET_LOCK = 0xA2 MCI_TED_DIRECT_RELEASE_LOCK = 0xA3 MCI_TED_DIRECT_DIM = 0xA4 )
View Source
const ( RX_EVENT_ON = 0x50 RX_EVENT_OFF = 0x51 RX_EVENT_SWITCH_ON = 0x52 RX_EVENT_SWITCH_OFF = 0x53 RX_EVENT_UP_PRESSED = 0x54 RX_EVENT_UP_RELEASED = 0x55 RX_EVENT_DOWN_PRESSED = 0x56 RX_EVENT_DOWN_RELEASED = 0x57 RX_EVENT_FORCED = 0x5A RX_EVENT_SINGLE_ON = 0x5B RX_EVENT_VALUE = 0x62 RX_EVENT_TOO_COLD = 0x63 RX_EVENT_TOO_WARM = 0x64 RX_EVENT_STATUS = 0x70 RX_EVENT_STATUS_EXT = 0x73 RX_EVENT_BASIC_MODE = 0x80 )
View Source
const ( RX_DATA_TYPE_NO_DATA = 0x00 RX_DATA_TYPE_PERCENT = 0x01 RX_DATA_TYPE_UINT8 = 0x02 RX_DATA_TYPE_INT16_1POINT = 0x03 RX_DATA_TYPE_FLOAT = 0x04 RX_DATA_TYPE_UINT16 = 0x0D RX_DATA_TYPE_UINT16_1POINT = 0x21 RX_DATA_TYPE_UINT16_2POINT = 0x22 RX_DATA_TYPE_UINT16_3POINT = 0x23 RX_DATA_TYPE_UINT32 = 0x0E RX_DATA_TYPE_UINT32_1POINT = 0x0F RX_DATA_TYPE_UINT32_2POINT = 0x10 RX_DATA_TYPE_UINT32_3POINT = 0x11 RX_DATA_TYPE_RC_DATA = 0x17 RX_DATA_TYPE_RM_TIME = 0x1E RX_DATA_TYPE_RM_DATE = 0x1F RX_DATA_TYPE_ROSETTA = 0x35 RX_DATA_TYPE_HRV_OUT = 0x37 RX_DATA_TYPE_SERIAL_NUMBER = 0x39 RX_DATA_TYPE_RCT_OUT = 0x3F RX_DATA_TYPE_RCT_REQ = 0x42 )
View Source
const ( RX_IS_OFF = 0x00 RX_IS_ON = 0x01 RX_IS_OFF_NG = 0x02 RX_IS_ON_NG = 0x03 RX_IS_STOP = 0x00 RX_IS_OPEN = 0x01 RX_IS_CLOSE = 0x02 )
View Source
const ( CONF_CONNEX = 0x02 CONF_RS232_BAUD = 0x03 CONF_SEND_OK_MRF = 0x04 CONF_RS232_FLOW = 0x05 CONF_RS232_CRC = 0x06 CONF_TIMEACCOUNT = 0x0A CONF_COUNTER_RX = 0x0B CONF_COUNTER_TX = 0x0C CONF_SERIAL = 0x0E CONF_LED = 0x0F CONF_LED_DIM = 0x1A CONF_RELEASE = 0x1B CONF_SEND_CLASS = 0x1D CONF_SEND_RFSEQNO = 0x1E CONF_BACK_TO_FACTORY = 0x1F )
View Source
const ( // CONF_CONNEX CF_DATA_AUTO = 0x01 CF_DATA_USB = 0x02 CF_DATA_RS232 = 0x03 CF_DATA_STATUS = 0x00 // CONF_RS232_BAUD CF_DATA_BD1200 = 0x01 CF_DATA_BD2400 = 0x02 CF_DATA_BD4800 = 0x03 CF_DATA_BD9600 = 0x04 CF_DATA_BD14400 = 0x05 CF_DATA_BD19200 = 0x06 CF_DATA_BD38400 = 0x07 CF_DATA_BD56700 = 0x08 // CONF_RS232_CRC, CONF_SEND_RFSEQNO, etc. CF_DATA_CLEAR = 0x0F CF_DATA_SET = 0x01 // CONF_COUNTER_RX, TX, SERIAL CF_DATA_GET = 0x00 // CONF_LED CF_DATA_LED_STANDARD = 0x01 CF_DATA_REVERSE_GREEN = 0x02 CF_DATA_LED_OFF = 0x03 // CONF_RELEASE CF_DATA_GET_REVISION = 0x10 // CONF_BACK_TO_FACTORY CF_DATA_BTF_GW = 0x0F CF_DATA_BTF_MRF = 0xF0 CF_DATA_BTF_ALL = 0xFF )
View Source
const ( MGW_STT_CONNEX = 0x02 MGW_STT_RS232_BAUD = 0x03 MGW_STT_RS232_FLOW = 0x05 MGW_STT_RS232_CRC = 0x06 MCI_STT_ERROR = 0x09 MCI_STT_TIMEACCOUNT = 0x0A MCI_STT_COUNTER_RX = 0x0B MCI_STT_COUNTER_TX = 0x0C MGW_STT_SEND_OK_MRF = 0x0D MGW_STT_SERIAL = 0x0E MGW_STT_LED = 0x0F MGW_STT_LED_DIM = 0x1A MGW_STT_RELEASE = 0x1B MGW_STT_OK = 0x1C MGW_STT_SEND_CLASS = 0x1D MGW_STT_SEND_RFSEQNO = 0x1E )
View Source
const ( // MCI_STT_ERROR MCI_STS_GENERAL = 0x00 MCI_STS_UNKNOWN = 0x01 MCI_STS_DP_OOR = 0x02 MCI_STS_BUSY_MRF = 0x03 MCI_STS_BUSY_MRF_RX = 0x04 MCI_STS_TX_MSG_LOST = 0x05 MCI_STS_NO_ACK = 0x06 // MCI_STT_TIMEACCOUNT STATUS_DATA = 0x00 STATUS_IS_0 = 0x01 STATUS_LESS_10 = 0x02 STATUS_MORE_15 = 0x03 // MGW_STT_RELEASE STATUS_REVISION = 0x10 // MGW_STT_OK STATUS_OK_MRF = 0x04 STATUS_OK_CONFIG = 0x05 STATUS_OK_BTFACT = 0xCE )
View Source
const ( ERR_T_SWITCH = 0x80 ERR_T_PERCENT = 0x81 ERR_T_DIM = 0x82 ERR_T_JALO = 0x83 ERR_T_JALO_STEP = 0x84 ERR_T_REQ_DASS = 0x85 ERR_T_PUSHBUTTON = 0x88 ERR_T_EVENT = 0x89 ERR_T_TIMEACCOUNT = 0x8C ERR_T_SEND_OK_MRF = 0x8D ERR_T_RELEASE = 0x91 ERR_T_BACK_TO_FACTORY = 0x92 ERR_T_COUNTER_RX = 0x93 ERR_T_COUNTER_TX = 0x94 ERR_T_TYPE = 0x95 ERR_T_PACKET_TYPE = 0x96 ERR_T_RS232_CRC = 0x98 ERR_T_RFREVISION = 0x9A ERR_T_SEND_CLASS = 0x9B ERR_T_SEND_RFSEQNO = 0x9C ERR_T_EXPECTED_STATUS = 0xA1 ERR_T_BUFFER_FULL = 0xA2 ERR_T_RX_IN_PROGRESS = 0xA3 ERR_T_STOPBYTE = 0xA4 ERR_T_PKTLENGTH = 0xA5 ERR_T_CRC = 0xA6 ERR_T_RS232_TIMEOUT = 0xA7 ERR_T_BM_NO_TARGET = 0xA8 ERR_T_DP_NOT_ASSIGNED = 0xA9 ERR_T_VALUE = 0xAA )
View Source
const ( STATUS_DATA_OKMRF_NOINFO = 0x00 STATUS_DATA_OKMRF_ACK_DIRECT = 0x10 STATUS_DATA_OKMRF_ACK_ROUTED = 0x20 STATUS_DATA_OKMRF_ACK = 0x30 STATUS_DATA_OKMRF_ACK_BM = 0x40 STATUS_DATA_OKMRF_DPREMOVED = 0x80 )
View Source
const ( MCI_ET_RD = 0x10 MCI_ET_REPLY = 0x11 MCI_ET_REQU_DPL = 0x20 MCI_ET_SEND_DPL = 0x21 MCI_ET_DPL_CHANGED = 0x22 MCI_ET_REQU_STL = 0x60 MCI_ET_SEND_STL = 0x61 MCI_ET_STL_CHANGED = 0x62 )
View Source
const ( MCI_TED_DPLMODE_BACKUP = 0x01 MCI_TED_DPLMODE_OFFICE = 0x02 MCI_TED_DPLMODE_CMF_EXT = 0x03 MCI_TED_DPLMODE_ECO_EXT = 0x04 MCI_TED_DPLMODE_OFF = 0x05 )
View Source
const ( MCI_SER_START = 0x5A MCI_SER_STOP = 0xA5 )
View Source
const ( UNKNOWN channelType = iota STATUS_BOOL STATUS_PERCENT STATUS_SHUTTER PUSHBUTTON SWITCH ONOFF TEMPERATURE_SWITCH TEMPERATURE_WHEEL_SWITCH VALUE_SWITCH HUMIDITY_SWITCH MOTION ENERGY POWER CURRENT VOLTAGE PULSES DIMPLEX )
View Source
const ( CDAU_0104 = 0 CDAU_0104_I = 1 // 2 x binary input CDAU_0104_E = 2 // Energy function CDAE_0104 = 4 CDAE_0104_I = 5 // 2 x binary input CDAE_0104_E = 6 // Energy function CDAE_0105 = 8 CDAE_0105_I = 9 // 2 x binary input CDAE_0105_E = 10 // Energy function CDAP_01X5_1E = 14 // Energy function )
View Source
const ( CHAU_0101_10E = 0 CHAU_0101_16E = 1 CHAU_0101_1ES = 2 CHAP_01x5_12E = 3 CHAP_01x5_1ES = 4 )
View Source
const ( CSAU_0101_10 = 0 CSAU_0101_10I = 1 // Binary input CSAU_0101_10IE = 3 // Binary input, Energy function CSAU_0101_16 = 4 CSAU_0101_16I = 5 // Binary input CSAU_0101_16IE = 7 // Binary input, Energy function CSAP_01XX_12E = 14 // Energy function )
View Source
const ( CSAX_OFF = 0x1 CSAX_ON = 0x2 CSAX_BLINKING = 0x3 CSAX_ON_LOCKED = 0x4 CSAX_OFF_LOCKED = 0x5 CSAX_OFF_OVERTEMPERATURE = 0x7 CSAX_OFF_OVERLOAD = 0x8 )
View Source
const DPL_TYPE_EXT2 = 2
Variables ¶
View Source
var ( ErrTerminal = errors.New("terminal error") ErrUnknown = errors.New("message unknown") ErrDpOutOfRange = errors.New("datapoint out of range") ErrBusyMRF = errors.New("RF busy, TX msg lost") ErrBusyMRFRX = errors.New("RF busy, RX in progress") ErrTxMsgLost = errors.New("TX lost, repeat it, buffer full") ErrNoAck = errors.New("timeout, no ACK received") ErrUnrecognisedError = errors.New("unknown error") ErrUnknownDPLFormat = errors.New("unsupported DPL format, broken file or you didn't upload the DPL to the stick?") )
Functions ¶
func StartStopWrap ¶
func StartStopWrap(w io.ReadWriteCloser) io.ReadWriteCloser
Types ¶
type BatteryState ¶
type BatteryState byte
func (BatteryState) String ¶
func (b BatteryState) String() string
type Datapoint ¶
type Datapoint struct {
// contains filtered or unexported fields
}
func (*Datapoint) CurrentTemperature ¶
func (*Datapoint) DesiredTemperature ¶
func (*Datapoint) DimWithSpeed ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents an xComfort device
func (Device) IsBatteryOperated ¶
func (Device) IsDimmingActuator ¶
func (Device) IsHeatingActuator ¶
func (Device) IsSwitchingActuator ¶
func (Device) ReportsPower ¶
func (Device) SerialNumber ¶
func (Device) Type ¶
func (d Device) Type() DeviceType
type DeviceType ¶
type DeviceType int
const ( DT_CTAA_01 DeviceType = 1 DT_CTAA_02 DeviceType = 2 DT_CTAA_04 DeviceType = 3 DT_CRCA_000x DeviceType = 5 DT_CSAx_01 DeviceType = 16 DT_CDAx_01 DeviceType = 17 DT_CJAU_0101 DeviceType = 18 DT_CBEU_0201 DeviceType = 19 DT_CBEU_0202 DeviceType = 20 DT_CHSZ_1201 DeviceType = 21 DT_CHMU_00 DeviceType = 22 DT_CTEU_02 DeviceType = 23 DT_CAEE_02 DeviceType = 24 DT_CAAE_01 DeviceType = 25 DT_CRMA_00 DeviceType = 26 DT_CJAU_0102 DeviceType = 27 DT_CKOZ_00 DeviceType = 28 DT_CBMA_02 DeviceType = 29 DT_CHSZ_02 DeviceType = 48 DT_CHSZ_1203 DeviceType = 49 DT_CHSZ_1204 DeviceType = 50 DT_CRCA_00 DeviceType = 51 DT_CROU_00 DeviceType = 52 DT_CIZE_02 DeviceType = 53 DT_CEMx_01 DeviceType = 54 DT_CHAZ_01 DeviceType = 55 DT_CHSZ_01 DeviceType = 56 DT_CKOZ_0208 DeviceType = 57 DT_CKOZ_0009 DeviceType = 62 DT_CHVZ_01 DeviceType = 65 DT_CRMA_00_FW DeviceType = 67 ROSETTA_SENSOR DeviceType = 68 DT_CHAZ_0112 DeviceType = 71 DT_CSAU_0101 DeviceType = 74 DT_CROU_0101 DeviceType = 75 DT_CDWA_013x DeviceType = 76 DT_CDAx_01NG DeviceType = 77 DT_CRCA_00xx DeviceType = 78 DT_CHAX_010x DeviceType = 81 DT_CJAU_0104 DeviceType = 86 )
func (DeviceType) String ¶
func (d DeviceType) String() string
type ErrGeneral ¶
type ErrGeneral struct {
// contains filtered or unexported fields
}
func (ErrGeneral) Error ¶
func (e ErrGeneral) Error() string
type Event ¶
type Event string
const ( EventOn Event = "on" EventOff Event = "off" EventSwitchOn Event = "switchOn" EventSwitchOff Event = "switchOff" EventUpPressed Event = "upPressed" EventUpReleased Event = "upReleased" EventDownPressed Event = "downPressed" EventDownReleased Event = "downReleased" EventForced Event = "forced" EventSingleOn Event = "singleOn" EventValue Event = "value" EventTooCold Event = "tooCold" EventTooWarm Event = "tooWarm" )
type Handler ¶
type Handler interface { // Datapoint updated value StatusValue(datapoint *Datapoint, value int) // Datapoint updated state StatusBool(datapoint *Datapoint, on bool) // Datapoint updated shutter state StatusShutter(datapoint *Datapoint, status ShutterStatus) // Datapoint sent event Event(datapoint *Datapoint, event Event) // RC data wheel position Wheel(datapoint *Datapoint, value interface{}) // Datapoint sent event with value ValueEvent(datapoint *Datapoint, event Event, value interface{}) // Datapoint sent value Value(datapoint *Datapoint, value interface{}) // Battery state updated Battery(device *Device, percentage int) // Power updated Power(device *Device, value interface{}) // Internal temperature updated InternalTemperature(device *Device, centigrade int) // Rssi updated Rssi(device *Device, rssi int) // Datapoint list changed DPLChanged() }
Handler interface for receiving callbacks
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
Interface
func (*Interface) ForEachDatapoint ¶
ForEachDatapoint takes a function as input and will apply that function to each datapoint that is registered.
func (*Interface) ForEachDevice ¶
ForEachDevice takes a function as input and will apply that function to each device that is registered.
func (*Interface) GetCounterRx ¶
func (*Interface) GetCounterTx ¶
func (*Interface) Init ¶
Init loads datapoints from the specified file and takes a handler which will get callbacks when events are received.
func (*Interface) Run ¶
Run starts the event loop, dispatching TX and CONFIG commands, and returning the results to the requesters.
func (*Interface) SetRfSeqNo ¶
type ShutterCommand ¶
type ShutterCommand byte
const ( ShutterClose ShutterCommand = MCI_TED_CLOSE ShutterOpen ShutterCommand = MCI_TED_OPEN ShutterStop ShutterCommand = MCI_TED_JSTOP ShutterStepClose ShutterCommand = MCI_TED_STEP_CLOSE ShutterStepOpen ShutterCommand = MCI_TED_STEP_OPEN )
type ShutterStatus ¶
type ShutterStatus string
const ( ShutterStopped ShutterStatus = "stopped" ShutterOpening ShutterStatus = "opening" ShutterClosing ShutterStatus = "closing" )
type SignalStrength ¶
type SignalStrength byte
func (SignalStrength) String ¶
func (s SignalStrength) String() string
type StartStopWrapper ¶
type StartStopWrapper struct {
// contains filtered or unexported fields
}
func (StartStopWrapper) Close ¶
func (s StartStopWrapper) Close() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.