homematic

package
v0.0.0-...-f411113 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	*request.Helper
	*Settings
	// contains filtered or unexported fields
}

Connection is the Homematic CCU connection

func NewConnection

func NewConnection(uri, device, meterchannel, switchchannel, user, password string, cache time.Duration) (*Connection, error)

NewConnection creates a new Homematic device connection.

func (*Connection) CurrentPower

func (c *Connection) CurrentPower() (float64, error)

CurrentPower reads the homematic HMIP-PSM meterchannel power in W

func (*Connection) Currents

func (c *Connection) Currents() (float64, float64, float64, error)

Currents reads the homematic HMIP-PSM meterchannel L1 current in A

func (*Connection) Enable

func (c *Connection) Enable(enable bool) error

Enable sets the homematic HMIP-PSM switchchannel state to true=on/false=off

func (*Connection) Enabled

func (c *Connection) Enabled() (bool, error)

Enabled reads the homematic HMIP-PSM switchchannel state true=on/false=off

func (*Connection) GridCurrentPower

func (c *Connection) GridCurrentPower() (float64, error)

GridCurrentPower reads the homematic HM-ES-TX-WM grid meterchannel power in W

func (*Connection) GridTotalEnergy

func (c *Connection) GridTotalEnergy() (float64, error)

GridTotalEnergy reads the homematic HM-ES-TX-WM grid meterchannel energy in kWh

func (*Connection) TotalEnergy

func (c *Connection) TotalEnergy() (float64, error)

TotalEnergy reads the homematic HMIP-PSM meterchannel energy in Wh

func (*Connection) XmlCmd

func (c *Connection) XmlCmd(method, channel string, values ...Param) (MethodResponse, error)

type Member

type Member struct {
	Name  string `xml:"name,omitempty"`
	Value Value  `xml:"value,omitempty"`
}

type MethodCall

type MethodCall struct {
	XMLName    xml.Name `xml:"methodCall"`
	MethodName string   `xml:"methodName"`
	Params     []Param  `xml:"params>param,omitempty"`
}

type MethodResponse

type MethodResponse struct {
	XMLName   xml.Name `xml:"methodResponse"`
	CCUBool   string   `xml:"params>param>value>boolean,omitempty"`
	CCUFloat  float64  `xml:"params>param>value>double,omitempty"`
	CCUInt    int64    `xml:"params>param>value>i4,omitempty"`
	CCUString string   `xml:"params>param>value>string,omitempty"`
	Member    []Member `xml:"params>param>value>struct>member,omitempty"`
	Fault     []Member `xml:"fault>value>struct>member,omitempty"`
}

func (*MethodResponse) BoolValue

func (res *MethodResponse) BoolValue(val string) bool

BoolValue selects a float value of a CCU API response member

func (*MethodResponse) Error

func (res *MethodResponse) Error() error

Error checks on Homematic CCU error codes Refer to page 30 of https://homematic-ip.com/sites/default/files/downloads/HM_XmlRpc_API.pdf

func (*MethodResponse) FloatValue

func (res *MethodResponse) FloatValue(val string) float64

FloatValue selects a float value of a CCU API response member

type Param

type Param struct {
	CCUBool   string  `xml:"value>boolean,omitempty"`
	CCUFloat  float64 `xml:"value>double,omitempty"`
	CCUInt    int64   `xml:"value>i4,omitempty"`
	CCUString string  `xml:"value>string,omitempty"`
}

type Settings

type Settings struct {
	URI, Device, MeterChannel, SwitchChannel, User, Password string
	Cache                                                    time.Duration
}

Homematic CCU settings

type Value

type Value struct {
	XMLName   xml.Name `xml:"value"`
	CCUString string   `xml:",chardata"`
	CCUInt    int64    `xml:"i4,omitempty"`
	CCUBool   bool     `xml:"boolean,omitempty"`
	CCUFloat  float64  `xml:"double,omitempty"`
}

Jump to

Keyboard shortcuts

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