Homematic: add initialise methods (#6813)
This commit is contained in:
parent
a82d6e5417
commit
2763495d67
1 changed files with 10 additions and 0 deletions
|
|
@ -51,6 +51,10 @@ func NewConnection(uri, device, meterchannel, switchchannel, user, password stri
|
|||
conn.Client.Transport = transport.BasicAuth(user, password, conn.Client.Transport)
|
||||
}
|
||||
|
||||
if err := conn.Init(); err != nil {
|
||||
return conn, err
|
||||
}
|
||||
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +101,12 @@ func (c *Connection) XmlCmd(method, channel string, values ...Param) (MethodResp
|
|||
return hmr, err
|
||||
}
|
||||
|
||||
// Initialze CCU methods via system.listMethods call
|
||||
func (c *Connection) Init() error {
|
||||
_, err := c.XmlCmd("system.listMethods", c.SwitchChannel)
|
||||
return err
|
||||
}
|
||||
|
||||
// Enabled reads the homematic HMIP-PSM switchchannel state true=on/false=off
|
||||
func (c *Connection) Enabled() (bool, error) {
|
||||
res, err := c.XmlCmd("getValue", c.SwitchChannel, Param{CCUString: "STATE"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue