Go wrapper for the AVM Home Automation HTTP Interface.
AHA HTTP Interface (/webservices/homeautoswitch.lua)
- XML-based, available since FRITZ!OS 5.53
- AVM Documentation
- Somewhat difficult to work with, missing some functionality
import (
"github.com/ByteSizedMarius/go-fritzbox-api/v2"
"github.com/ByteSizedMarius/go-fritzbox-api/v2/aha"
)
client := fritzbox.New("username", "password")
client.Connect()
// Get all devices
deviceList, err := aha.GetDeviceList(client)
// Find device with specific capability
for _, device := range deviceList.Devices {
if device.HasCapability(aha.CHKR) {
hkr := aha.GetCapability[*aha.Hkr](device)
// Read temperature
temp, _ := hkr.DECTGetSoll(client)
// Set temperature
hkr.DECTSetSoll(client, 21.5)
}
}| Constant | Type | Description |
|---|---|---|
CHanfun |
*HanFun |
HAN-FUN device |
CButton |
*ButtonDevice |
Button device (e.g., FRITZ!DECT 440) |
CHKR |
*Hkr |
Radiator thermostat (Heizkörperregler) |
CTempSensor |
*Temperature |
Temperature sensor |
Many capability types (lights, sockets, blinds, etc.) are not yet implemented - only devices I actually own are supported for now. PRs are welcome.
See HKR Documentation for comprehensive coverage of:
- Temperature presets (comfort/reduced)
- Operating modes (boost, window open, summer, holiday)
- Timer schedules and locks
- API comparison (AHA vs REST)
DeviceList- List of all AHA devicesDevice- Individual device with capabilitiesCapability- Interface for device features
Methods prefixed with DECT make network requests:
temp, err := hkr.DECTGetSoll(client) // network requestMethods without prefix read cached values from the struct:
temp := hkr.GetSoll() // local read, no networkCall hkr.Reload(client) to refresh cached values after external changes.