Documentation ¶
Index ¶
- Constants
- func SplitAddress(address string) (deviceAddress string, channelAddress string)
- type DeviceDescription
- type DeviceLayer
- type DeviceLayerClient
- func (c *DeviceLayerClient) Deinit(receiverAddress string) error
- func (c *DeviceLayerClient) DeleteDevice(deviceAddress string, flags int) error
- func (c *DeviceLayerClient) GetDeviceDescription(deviceAddress string) (*DeviceDescription, error)
- func (c *DeviceLayerClient) GetParamset(deviceAddress string, paramsetType string) (map[string]interface{}, error)
- func (c *DeviceLayerClient) GetParamsetDescription(deviceAddress string, paramsetType string) (ParamsetDescription, error)
- func (c *DeviceLayerClient) GetValue(deviceAddress string, valueName string) (interface{}, error)
- func (c *DeviceLayerClient) Init(receiverAddress, id string) error
- func (c *DeviceLayerClient) ListDevices() ([]*DeviceDescription, error)
- func (c *DeviceLayerClient) Ping(callerID string) (bool, error)
- func (c *DeviceLayerClient) PutParamset(deviceAddress string, paramsetType string, paramset map[string]interface{}) error
- func (c *DeviceLayerClient) SetValue(deviceAddress string, valueName string, value interface{}) error
- type Dispatcher
- type Interconnector
- func (i *Interconnector) Client(regID string) (*RegisteredClient, error)
- func (i *Interconnector) DeleteDevices(interfaceID string, addresses []string) error
- func (i *Interconnector) Event(interfaceID, address, valueKey string, value interface{}) error
- func (i *Interconnector) NewDevices(interfaceID string, devDescriptions []*DeviceDescription) error
- func (i *Interconnector) ReaddedDevice(interfaceID string, deletedAddresses []string) error
- func (i *Interconnector) ReplaceDevice(interfaceID, oldDeviceAddress, newDeviceAddress string) error
- func (i *Interconnector) Start()
- func (i *Interconnector) Stop()
- func (i *Interconnector) UpdateDevice(interfaceID, address string, hint int) error
- type LogicLayer
- type LogicLayerClient
- func (c *LogicLayerClient) DeleteDevices(interfaceID string, addresses []string) error
- func (c *LogicLayerClient) Event(interfaceID, address, valueKey string, value interface{}) error
- func (c *LogicLayerClient) ListDevices(interfaceID string) ([]*DeviceDescription, error)
- func (c *LogicLayerClient) NewDevices(interfaceID string, devDescriptions []*DeviceDescription) error
- type ParameterDescription
- type ParamsetDescription
- type RegisteredClient
- type SpecialValue
- type Type
- type Types
Constants ¶
const ( DeviceFlagVisible = 1 << iota DeviceFlagInternal DeviceFlagNotDeletable )
const ( DeviceDirectionNone = iota DeviceDirectionSender DeviceDirectionReceiver )
const ( DeviceRXModeAlways = 1 << iota DeviceRXModeBurst DeviceRXModeConfig DeviceRXModeWakeUp DeviceRXModeLazyConfig )
const ( ParameterTypeFloat = "FLOAT" ParameterTypeInteger = "INTEGER" ParameterTypeBool = "BOOL" ParameterTypeEnum = "ENUM" ParameterTypeString = "STRING" ParameterTypeAction = "ACTION" )
const ( ParameterOperationRead = 1 << iota ParameterOperationWrite ParameterOperationEvent )
const ( ParameterFlagVisible = 1 << iota ParameterFlagInternal ParameterFlagTransform ParameterFlagService ParameterFlagSticky )
Variables ¶
This section is empty.
Functions ¶
func SplitAddress ¶ added in v0.3.0
SplitAddress splits a full address into device and channel part.
Types ¶
type DeviceDescription ¶
type DeviceDescription struct { Type string Address string RFAddress int Children []string Parent string ParentType string Index int AESActive int Paramsets []string Firmware string AvailableFirmware string Version int // Flags is a bit mask for the presentation in the UI. // 0x01: visible for user // 0x02: internal (not visible) // 0x08: object not deleteable Flags int LinkSourceRoles string LinkTargetRoles string // Direction of a direct channel connection. // 0: none (direct connection not supported) // 1: sender // 2: receiver Direction int Group string Team string TeamTag string TeamChannels []string Interface string Roaming int // RXMode is a bit mask of the receive modes. // 0x01: always // 0x02: burst (wake on radio) // 0x04: config (reachable after pressing config button) // 0x08: wakeup (after communication with the CCU) // 0x10: lazy config (config mode after normal use, e.g. key press) RXMode int }
DeviceDescription describes a HomeMatic device.
func (*DeviceDescription) ReadFrom ¶
func (d *DeviceDescription) ReadFrom(e *xmlrpc.Query)
ReadFrom reads the field values from an xmlrpc.Query.
func (*DeviceDescription) ToValue ¶ added in v0.3.0
func (d *DeviceDescription) ToValue() *xmlrpc.Value
ToValue returns an xmlrpc.Value for this device description.
type DeviceLayer ¶ added in v0.3.0
type DeviceLayer interface { // Init registers a new logic layer. The receiverAddress should have the // format protocol://hostname[:port][/Path]. If the second parameter is // omitted, the call is redirected to Deinit. Init(receiverAddress, interfaceID string) error // Deinit unregisters a logic layer. Init redirects the call to this // function, if the second parameter is ommited. This method is not exposed // over XML-RPC. Deinit(receiverAddress string) error // This method returns all devices known to the interface process in the // form of device descriptions. ListDevices() ([]*DeviceDescription, error) // This method deletes a device from the interface process. // // Flags: // 0x01=DELETE_FLAG_RESET // 0x02=DELETE_FLAG_FORCE // 0x04=DELETE_FLAG_DEFER DeleteDevice(deviceAddress string, flags int) error // This method returns the device description of the device passed as // deviceAddress. GetDeviceDescription(deviceAddress string) (*DeviceDescription, error) // This method is used to determine the description of a parameter set. The // parameter deviceAddress is the address of a logical device (e.g. returned // by ListDevices). The parameter paramsetType is "MASTER", "VALUES" or // "LINK". GetParamsetDescription(deviceAddress, paramsetType string) (ParamsetDescription, error) // This method reads a complete parameter set for a logical device. The // parameter deviceAddress is the address of a logical device. The parameter // paramsetKey is "MASTER" or "VALUES". GetParamset(deviceAddress string, paramsetKey string) (map[string]interface{}, error) // This method is used to write a complete parameter set for a logical // device. The parameter address is the address of a logical device. The // parameter paramsetKey is "MASTER" or "VALUES". Members not present in // values are simply not written and keep their old value. PutParamset(deviceAddress string, paramsetType string, paramset map[string]interface{}) error // This method is used to write a single value from the "VALUES" parameter // set. The parameter deviceAddress is the address of a logical device. The // parameter valueName is the name of the value to be written. The possible // values for valueName are taken from the ParamsetDescription of the // corresponding parameter set "VALUES". The value parameter is the value to // be written. SetValue(deviceAddress string, valueName string, value interface{}) error // This method reads a single value from the "VALUES" parameter set. The // parameter deviceAddress is the address of a logical device. The parameter // valueName is the name of the value to be read. The possible values for // valueName are derived from the ParamsetDescription of the corresponding // parameter set "VALUES". GetValue(deviceAddress string, valueName string) (interface{}, error) // When calling this function an event (called PONG in the following) is // generated and sent to all registered logic layers. Since the PONG event // is sent to all registered all registered logic layers (as with all other // events), one logic layer must expect to receive a logic layer must expect // to receive a PONG event without having previously called ping beforehand. // // The parameter callerId must be passed by the caller and is used as the // value of the PONG event. The content of the string is irrelevant. If no // exception occurs during processing, the method returns true is returned. // // The PONG event is delivered via the event method of the logic layer. The // address is CENTRAL", the key is "PONG" and the value is the callerId // passed in the ping call. passed in the ping call. Ping(callerID string) (bool, error) }
A DeviceLayer is the API of a device interface process.
type DeviceLayerClient ¶ added in v0.3.0
DeviceLayerClient provides access to the HomeMatic XML-RPC API of the device layer.
func (*DeviceLayerClient) Deinit ¶ added in v0.3.0
func (c *DeviceLayerClient) Deinit(receiverAddress string) error
Deinit deregisters an interface. The receiverAddress should match with Init.
func (*DeviceLayerClient) DeleteDevice ¶ added in v0.3.0
func (c *DeviceLayerClient) DeleteDevice(deviceAddress string, flags int) error
DeleteDevice deletes a device.
func (*DeviceLayerClient) GetDeviceDescription ¶ added in v0.3.0
func (c *DeviceLayerClient) GetDeviceDescription(deviceAddress string) (*DeviceDescription, error)
GetDeviceDescription retrieves the device description for the specified device.
func (*DeviceLayerClient) GetParamset ¶ added in v0.3.0
func (c *DeviceLayerClient) GetParamset(deviceAddress string, paramsetType string) (map[string]interface{}, error)
GetParamset retrieves the specified parameter set.
func (*DeviceLayerClient) GetParamsetDescription ¶ added in v0.3.0
func (c *DeviceLayerClient) GetParamsetDescription(deviceAddress string, paramsetType string) (ParamsetDescription, error)
GetParamsetDescription retrieves the paramset description from a device.
func (*DeviceLayerClient) GetValue ¶ added in v0.3.0
func (c *DeviceLayerClient) GetValue(deviceAddress string, valueName string) (interface{}, error)
GetValue gets a single value from the parameter set VALUES.
func (*DeviceLayerClient) Init ¶ added in v0.3.0
func (c *DeviceLayerClient) Init(receiverAddress, id string) error
Init registers a new interface. The receiverAddress should have the format http://hostname[:port][/Path]. If the path is not specified, the CCU will use /RPC2.
func (*DeviceLayerClient) ListDevices ¶ added in v0.3.0
func (c *DeviceLayerClient) ListDevices() ([]*DeviceDescription, error)
ListDevices retrieves the device descriptions from all devices.
func (*DeviceLayerClient) Ping ¶ added in v0.3.0
func (c *DeviceLayerClient) Ping(callerID string) (bool, error)
Ping triggers a pong event. Returns true on success.
func (*DeviceLayerClient) PutParamset ¶ added in v0.3.0
func (c *DeviceLayerClient) PutParamset(deviceAddress string, paramsetType string, paramset map[string]interface{}) error
PutParamset writes the parameter set.
type Dispatcher ¶ added in v0.2.2
type Dispatcher struct {
xmlrpc.BasicDispatcher
}
Dispatcher is an extended xmlrpc.Dispatcher for HM.
func NewDispatcher ¶ added in v0.1.2
func NewDispatcher() *Dispatcher
NewDispatcher creates a new Dispatcher with HM specific RPC functions.
func (*Dispatcher) AddDeviceLayer ¶ added in v0.3.0
func (d *Dispatcher) AddDeviceLayer(dl DeviceLayer)
AddDeviceLayer adds handlers for a device layer.
func (*Dispatcher) AddLogicLayer ¶ added in v0.2.2
func (d *Dispatcher) AddLogicLayer(ll LogicLayer)
AddLogicLayer adds handlers for a logic layer. After calling init on BidCos-RF normally following callbacks happen: system.listMethods, listDevices, newDevices and system.multicall with event's. Attention: listDevices is not forwarded to the receiver and returns always an empty device list to the interface process.
type Interconnector ¶
type Interconnector struct { CCUAddr string Types Types IDPrefix string ServeErr chan<- error // for callbacks from CCU interface processes HostAddr string ServerURL string XMLRPCPort int BINRPCPort int // the Logiclayer receives the callbacks LogicLayer LogicLayer // contains filtered or unexported fields }
Interconnector gives access to the CCU data model and current data point values.
func (*Interconnector) Client ¶
func (i *Interconnector) Client(regID string) (*RegisteredClient, error)
Client returns the specified interface client.
func (*Interconnector) DeleteDevices ¶
func (i *Interconnector) DeleteDevices(interfaceID string, addresses []string) error
DeleteDevices implements interface hmccu.Receiver.
func (*Interconnector) Event ¶
func (i *Interconnector) Event(interfaceID, address, valueKey string, value interface{}) error
Event implements interface hmccu.Receiver.
func (*Interconnector) NewDevices ¶
func (i *Interconnector) NewDevices(interfaceID string, devDescriptions []*DeviceDescription) error
NewDevices implements interface hmccu.Receiver.
func (*Interconnector) ReaddedDevice ¶
func (i *Interconnector) ReaddedDevice(interfaceID string, deletedAddresses []string) error
ReaddedDevice implements interface hmccu.Receiver.
func (*Interconnector) ReplaceDevice ¶
func (i *Interconnector) ReplaceDevice(interfaceID, oldDeviceAddress, newDeviceAddress string) error
ReplaceDevice implements interface hmccu.Receiver.
func (*Interconnector) Start ¶
func (i *Interconnector) Start()
Start connects to the CCU and starts querying model and values. An additional handler for XMLRPC ist registered at the DefaultServeMux.
func (*Interconnector) Stop ¶
func (i *Interconnector) Stop()
Stop disconnects from the CCU and releases ressources.
func (*Interconnector) UpdateDevice ¶
func (i *Interconnector) UpdateDevice(interfaceID, address string, hint int) error
UpdateDevice implements interface hmccu.Receiver.
type LogicLayer ¶ added in v0.2.2
type LogicLayer interface { // A value has changed. Event(interfaceID, address, valueKey string, value interface{}) error // Devices are added. NewDevices(interfaceID string, devDescriptions []*DeviceDescription) error // Devices are deleted. DeleteDevices(interfaceID string, addresses []string) error // A device or channels has changed. hint=0: any changes; hint=1: number of // links changed UpdateDevice(interfaceID, address string, hint int) error // A device was replaced. ReplaceDevice(interfaceID, oldDeviceAddress, newDeviceAddress string) error // ReaddedDevice is called, when an already connected device is paired again // with the CCU. Deleted logical devices are listed in deletedAddresses. ReaddedDevice(interfaceID string, deletedAddresses []string) error }
A LogicLayer handles notifications from a device interface processes (of the CCU).
type LogicLayerClient ¶ added in v0.3.0
LogicLayerClient provides access to the HomeMatic XML-RPC API of the logic layer.
func (*LogicLayerClient) DeleteDevices ¶ added in v0.3.0
func (c *LogicLayerClient) DeleteDevices(interfaceID string, addresses []string) error
DeleteDevices delete devicess from the logic layer.
func (*LogicLayerClient) Event ¶ added in v0.3.0
func (c *LogicLayerClient) Event(interfaceID, address, valueKey string, value interface{}) error
Event sends an event.
func (*LogicLayerClient) ListDevices ¶ added in v0.3.0
func (c *LogicLayerClient) ListDevices(interfaceID string) ([]*DeviceDescription, error)
ListDevices retrieves the device descriptions from all devices.
func (*LogicLayerClient) NewDevices ¶ added in v0.3.0
func (c *LogicLayerClient) NewDevices(interfaceID string, devDescriptions []*DeviceDescription) error
NewDevices adds devices to the logic layer.
type ParameterDescription ¶
type ParameterDescription struct { // FLOAT, INTEGER, BOOL, ENUM, STRING, ACTION Type string // Bit field: 0x01=Read, 0x02=Write, 0x04=Event Operations int // Bit field: 0x01=Visible, 0x02=Internal, 0x04=Transform, 0x08=Service, 0x10=Sticky Flags int Default interface{} Max interface{} Min interface{} Unit string TabOrder int Control string ID string // Only for type FLOAT or INTEGER Special []SpecialValue // Only for type ENUM ValueList []string }
ParameterDescription describes a single parameter.
func (*ParameterDescription) ReadFrom ¶
func (p *ParameterDescription) ReadFrom(e *xmlrpc.Query)
ReadFrom reads the field values from an xmlrpc.Query.
type ParamsetDescription ¶
type ParamsetDescription map[string]*ParameterDescription
ParamsetDescription describes a parameter set (e.g. VALUES) of a device.
func (ParamsetDescription) ReadFrom ¶ added in v0.3.0
func (ps ParamsetDescription) ReadFrom(q *xmlrpc.Query)
ReadFrom reads the field values from an xmlrpc.Query.
type RegisteredClient ¶
type RegisteredClient struct { *DeviceLayerClient RegistrationURL string RegistrationID string ReGaHssID string // contains filtered or unexported fields }
RegisteredClient provides access to a CCU interface process. The registration state is monitored and reestablished on time out.
func (*RegisteredClient) CallbackReceived ¶
func (i *RegisteredClient) CallbackReceived()
CallbackReceived must be called, when a callback from the CCU is received. The call is always non-blocking. Startup must be called first.
func (*RegisteredClient) Setup ¶
func (i *RegisteredClient) Setup()
Setup initializes the RegisteredClient.
func (*RegisteredClient) Start ¶
func (i *RegisteredClient) Start()
Start registers at the CCU interface process and starts monitoring.
func (*RegisteredClient) Stop ¶
func (i *RegisteredClient) Stop()
Stop stops the registration and monitoring.
type SpecialValue ¶ added in v0.2.3
type SpecialValue struct { ID string Value interface{} }
SpecialValue defines a special value für an INTEGER or FLOAT. Value must be of type int or float64.
type Type ¶
type Type int
Type is the type of a CCU interface (BidCos-RF, HmIP-RF, ...).
const ( // CCU1 or CCU2/3 with HMW-LGW BidCosWired Type = iota // CCU1/2/3, RaspberryMatic with RF module or HM-LGW BidCosRF // CCU1 System // CCU2/3, RaspberryMatic with RF module HmIPRF // CCU2/3, RaspberryMatic with RF module VirtualDevices // CUxD add on CUxD // Haus-Bus.de add on HausBusDe )
Predefined CCU interface types.
func (Type) MarshalText ¶
MarshalText implements TextUnmarshaler (for e.g. JSON encoding). For the method to be found by the JSON encoder, use a value receiver.
func (*Type) UnmarshalText ¶
UnmarshalText implements TextMarshaler (for e.g. JSON decoding).