freepslib

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 18 Imported by: 2

README

freepslib

Go-library to interact with your fritzbox.

Mostly an implementation of https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AHA-HTTP-Interface.pdf

Reference

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = FBconfig{Address: "fritz.box", User: "freeps", Password: "password"}

Functions

This section is empty.

Types

type AvmButton added in v1.3.0

type AvmButton struct {
	Name                 *string `xml:"name"`
	LastPressedTimestamp int     `xml:"lastpressedtimestamp"`
}

type AvmDataObject

type AvmDataObject struct {
	Active  []*AvmDeviceInfo
	Passive []*AvmDeviceInfo
	// contains filtered or unexported fields
}

type AvmDataResponse

type AvmDataResponse struct {
	Data *AvmDataObject
}

type AvmDevice

type AvmDevice struct {
	Name         string                 `xml:"name" json:",omitempty"`
	AIN          string                 `xml:"identifier,attr"`
	ProductName  string                 `xml:"productname,attr" json:",omitempty"`
	Present      bool                   `xml:"present" json:",omitempty"`
	Switch       *AvmDeviceSwitch       `xml:"switch" json:",omitempty"`
	Temperature  *AvmDeviceTemperature  `xml:"temperature" json:",omitempty"`
	Powermeter   *AvmDevicePowermeter   `xml:"powermeter" json:",omitempty"`
	SimpleOnOff  *AvmDeviceSimpleonoff  `xml:"simpleonoff" json:",omitempty"`
	LevelControl *AvmDeviceLevelcontrol `xml:"levelcontrol" json:",omitempty"`
	ColorControl *AvmDeviceColorcontrol `xml:"colorcontrol" json:",omitempty"`
	HKR          *AvmDeviceHkr          `xml:"hkr" json:",omitempty"`
	Alert        *AvmDeviceAlert        `xml:"alert" json:",omitempty"`
	Button       *AvmButton             `xml:"button" json:",omitempty"`
}

type AvmDeviceAlert added in v1.3.0

type AvmDeviceAlert struct {
	State                 int `xml:"state"`
	LastAlertChgTimestamp int `xml:"lastalertchgtimestamp"`
}

type AvmDeviceColorcontrol

type AvmDeviceColorcontrol struct {
	Hue         int `xml:"hue"`
	Saturation  int `xml:"saturation"`
	Temperature int `xml:"temperature"`
}

type AvmDeviceHkr

type AvmDeviceHkr struct {
	Tist                    int            `xml:"tist"`
	Tsoll                   int            `xml:"tsoll"`
	Komfort                 int            `xml:"komfort"`
	Absenk                  int            `xml:"absenk"`
	Batterylow              bool           `xml:"batterylow"`
	Battery                 int            `xml:"battery"`
	Windowopenactive        bool           `xml:"windowopenactiv"` // cannot ignore the typo here
	Windowopenactiveendtime int            `xml:"windowopenactiveendtime"`
	Boostactive             bool           `xml:"boostactive"`
	Boostactiveendtime      int            `xml:"boostactiveendtime"`
	Holidayactive           bool           `xml:"holidayactive"`
	Summeractive            bool           `xml:"summeractive"`
	Lock                    bool           `xml:"lock"`
	Devicelock              bool           `xml:"devicelock"`
	NextChange              *AvmNextChange `xml:"nextchange"`
}

type AvmDeviceInfo

type AvmDeviceInfo struct {
	Mac  string
	UID  string
	Name string
	Type string
}

type AvmDeviceLevelcontrol

type AvmDeviceLevelcontrol struct {
	Level           float32 `xml:"level"`
	LevelPercentage float32 `xml:"levelpercentage"`
}

type AvmDeviceList

type AvmDeviceList struct {
	Device []AvmDevice `xml:"device"`
}

type AvmDevicePowermeter

type AvmDevicePowermeter struct {
	Power   int `xml:"power"`
	Energy  int `xml:"energy"`
	Voltage int `xml:"voltage"`
}

type AvmDeviceSimpleonoff

type AvmDeviceSimpleonoff struct {
	State bool `xml:"state"`
}

type AvmDeviceSwitch

type AvmDeviceSwitch struct {
	State      bool   `xml:"state"`
	Lock       bool   `xml:"lock"`
	Devicelock bool   `xml:"devicelock"`
	Mode       string `xml:"mode"`
}

type AvmDeviceTemperature

type AvmDeviceTemperature struct {
	Celsius int `xml:"celsius"`
	Offset  int `xml:"offset"`
}

type AvmNextChange added in v1.0.2

type AvmNextChange struct {
	Endperiod int `xml:"endperiod"`
	TChange   int `xml:"tchange"`
}

type AvmSessionInfo

type AvmSessionInfo struct {
	SID       string
	Challenge string
}

type AvmTemplate

type AvmTemplate struct {
	Name       string         `xml:"name"`
	Identifier string         `xml:"identifier,attr"`
	ID         string         `xml:"id,attr"`
	Devices    *AvmDeviceList `xml:"devices"`
}

type AvmTemplateList

type AvmTemplateList struct {
	Template []AvmTemplate `xml:"template"`
}

type FBconfig

type FBconfig struct {
	Address    string
	User       string
	Password   string
	Verbose    bool
	FB_address string `json:",omitempty"` // deprecated, use Address instead
	FB_user    string `json:",omitempty"` // deprecated, use User instead
	FB_pass    string `json:",omitempty"` // deprecated, use Password instead
}

type Freeps

type Freeps struct {
	SID string
	// contains filtered or unexported fields
}

func NewFreepsLib

func NewFreepsLib(conf *FBconfig) (*Freeps, error)

func NewFreepsLibWithLogger added in v1.1.0

func NewFreepsLibWithLogger(conf *FBconfig, logger logrus.FieldLogger) (*Freeps, error)

func (*Freeps) CallUpnpActionWithArgument added in v1.2.0

func (f *Freeps) CallUpnpActionWithArgument(serviceName string, actionName string, argName string, argValue interface{}) (map[string]interface{}, error)

func (*Freeps) GetData

func (f *Freeps) GetData() (*AvmDataResponse, error)

func (*Freeps) GetDeviceList

func (f *Freeps) GetDeviceList() (*AvmDeviceList, error)

func (*Freeps) GetDeviceUID

func (f *Freeps) GetDeviceUID(mac string) (string, error)

func (*Freeps) GetMetrics

func (f *Freeps) GetMetrics() (FritzBoxMetrics, error)

func (*Freeps) GetSuggestedSwitchCmds

func (f *Freeps) GetSuggestedSwitchCmds() map[string][]string

GetSuggestedSwitchCmds returns all known switch commands and their expected parameters

func (*Freeps) GetTemplateList

func (f *Freeps) GetTemplateList() (*AvmTemplateList, error)

func (*Freeps) GetUpnpDataMap

func (f *Freeps) GetUpnpDataMap(serviceName string, actionName string) (map[string]interface{}, error)

func (*Freeps) GetUpnpServiceActionArguments added in v1.2.0

func (f *Freeps) GetUpnpServiceActionArguments(serviceName string, actionName string) ([]string, error)

func (*Freeps) GetUpnpServiceActions

func (f *Freeps) GetUpnpServiceActions(serviceName string) ([]string, error)

func (*Freeps) GetUpnpServices

func (f *Freeps) GetUpnpServices() ([]string, error)

func (*Freeps) GetUpnpServicesShort

func (f *Freeps) GetUpnpServicesShort() ([]string, error)

func (*Freeps) HomeAutoSwitch

func (f *Freeps) HomeAutoSwitch(switchcmd string, ain string, payload map[string]string) error

func (*Freeps) HomeAutomation

func (f *Freeps) HomeAutomation(switchcmd string, ain string, payload map[string]string) ([]byte, error)

func (*Freeps) SetLevel

func (f *Freeps) SetLevel(ain string, level int) error

func (*Freeps) WakeUpDevice

func (f *Freeps) WakeUpDevice(uid string) error

type FritzBoxMetrics

type FritzBoxMetrics struct {
	DeviceModelName      string
	DeviceFriendlyName   string
	Uptime               int64
	BytesReceived        int64 `json:"X_AVM_DE_TotalBytesReceived64,string"`
	BytesSent            int64 `json:"X_AVM_DE_TotalBytesSent64,string"`
	TransmissionRateUp   int64 `json:"ByteReceiveRate"`
	TransmissionRateDown int64 `json:"ByteSendRate"`
}

Directories

Path Synopsis
Package fritzbox_upnp Query UPNP variables from Fritz!Box devices.
Package fritzbox_upnp Query UPNP variables from Fritz!Box devices.

Jump to

Keyboard shortcuts

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