Documentation
¶
Overview ¶
package aha allows to interact with the AVM Home Automation HTTP Interface (AHA), to control the connected smart devices.
Index ¶
- Constants
- func TrustOnFirstUse(c *Client) error
- type Client
- func (c *Client) GetDeviceListInfos() (info *DeviceListInfos, err error)
- func (c *Client) SetThermostatBoost(identifier string, d time.Duration) error
- func (c *Client) SetThermostatTargetTemp(identifier string, t ThermostatTemp) error
- func (c *Client) SetThermostatWindowOpen(identifier string, d time.Duration) error
- type Device
- type DeviceFunction
- type DeviceListInfos
- type Float32Tenth
- type Option
- type TemperatureSensor
- type Thermostat
- type ThermostatTemp
- type UnixSecond
Constants ¶
View Source
const ( ThermostatTempUndefined = ThermostatTemp(-1) ThermostatTempOff = ThermostatTemp(0) ThermostatTempOn = ThermostatTemp(37) )
Variables ¶
This section is empty.
Functions ¶
func TrustOnFirstUse ¶
TrustOnFirstUse retrieves the certificate and marks it as trusted for subsequent calls.
Types ¶
type Client ¶
type Client struct {
URL url.URL
Transport *http.Transport
// if Username is empty, it will be auto-discovered
Username string
LoginVersion uint // only 1 (md5) and 2 (pkdf) are supported, defaults to 2 if unset
// contains filtered or unexported fields
}
func (*Client) GetDeviceListInfos ¶
func (c *Client) GetDeviceListInfos() (info *DeviceListInfos, err error)
GetDeviceListInfos returns the connected smart devices.
func (*Client) SetThermostatBoost ¶ added in v0.1.3
SetThermostatBoost
func (*Client) SetThermostatTargetTemp ¶ added in v0.1.2
func (c *Client) SetThermostatTargetTemp(identifier string, t ThermostatTemp) error
SetThermostatTargetTemp
type Device ¶
type Device struct {
Identifier string `xml:"identifier,attr"`
ID string `xml:"id,attr"`
Function DeviceFunction `xml:"functionbitmask,attr"`
FirmwareVersion string `xml:"fwversion,attr"`
Manufacturer string `xml:"manufacturer,attr"`
Productname string `xml:"productname,attr"`
Present bool `xml:"present"`
Txbusy bool `xml:"txbusy"`
Name string `xml:"name"`
BatteryLow bool `xml:"batterylow"`
BatteryLevel int `xml:"battery"`
TemperatureSensor *TemperatureSensor `xml:"temperature"`
Thermostat *Thermostat `xml:"hkr"`
}
type DeviceFunction ¶
type DeviceFunction uint64
const ( DeviceHANFUN DeviceFunction = 1 << iota DeviceLight DeviceAlarm DeviceButton DeviceThermostat DeviceEnergieSensor DeviceTemperatureSensor DeviceSwitch )
type DeviceListInfos ¶
type Float32Tenth ¶
type Float32Tenth float32
func (Float32Tenth) String ¶
func (f Float32Tenth) String() string
func (*Float32Tenth) UnmarshalXML ¶
func (f *Float32Tenth) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Option ¶
func LoginVersion ¶ added in v0.4.1
LoginVersion asks the fritzbox for a given challenge login. 1 and 2 are supported, 0 defaults to 2 currently.
func TrustCertificate ¶
TrustCertificate adds a PEM certificate to be trusted. Be aware that self-signed certificates may be re-created on reboot. You might prefer to use TrustOnFirstUse.
func WithUsername ¶
WithUsername disables the auto-discovery of the username.
type TemperatureSensor ¶ added in v0.1.1
type TemperatureSensor struct {
Celsius Float32Tenth `xml:"celsius"` // adjusted temperature
Offset Float32Tenth `xml:"offset"` // operated adjustment
}
type Thermostat ¶ added in v0.1.1
type Thermostat struct {
// you should use the TemperatureSensor instead of ActualTemp
ActualTemp ThermostatTemp `xml:"tist"`
TargetTemp ThermostatTemp `xml:"tsoll"`
LowTemp ThermostatTemp `xml:"absenk"`
ComfortTemp ThermostatTemp `xml:"komfort"`
APILocked bool `xml:"lock"`
DeviceLocked bool `xml:"devicelock"`
ErrorCode int `xml:"errorcode"`
WindowOpened bool `xml:"windowopenactiv"`
WindowOpenedUntil UnixSecond `xml:"windowopenactiveendtime"`
BoostActive bool `xml:"boostactive"`
BoostActiveUntil UnixSecond `xml:"boostactiveendtime"`
BatteryLow bool `xml:"batterylow"`
BatteryLevel int `xml:"battery"`
NextChange struct {
At UnixSecond `xml:"endperiod"`
WishTemp ThermostatTemp `xml:"tchange"`
} `xml:"nextchange"`
SummerActive bool `xml:"summeractive"`
HolidayActive bool `xml:"holidayactive"`
}
type ThermostatTemp ¶
type ThermostatTemp float32
func (ThermostatTemp) String ¶
func (t ThermostatTemp) String() string
func (*ThermostatTemp) UnmarshalXML ¶
func (t *ThermostatTemp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type UnixSecond ¶
func (*UnixSecond) UnmarshalXML ¶
func (u *UnixSecond) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Click to show internal directories.
Click to hide internal directories.