TR 64 Protocol Actions

TR 64 is a protocol designed to communicate with devices which provides Internet connectivity like DSL or cable routers, also several Wifi routers do support it. The protocol is based on the UPnP standard, it just adds several service types and actions how to configure and monitor a device.

The DeviceTR64 provides all functionality already to gather information’s and to interact with a TR64 device. Also this module adds some convenience to be able to execute actions on a device which supports TR64. If the device is supported already only setupTR64Device() has to be called otherwise some more magic needs to happen, please see the following sections.

Be aware that you might need to authenticate yourself before you can use some actions, please see here.

Supported devices

Today only one device type will be supported out of the box, also other devices can use this module, just continue to read:

  • AVM - Fritz.boxes are supported when they have the latest software installed and UPnP enabled in the Web interface

    (Heimnetz - Netzwerkeinstellungen / Zugriff für Anwendungen zulassen & Statusinformationen über UPnP)

I appreciate any help to extend the amount of supported devices, please see next section.

Example:

>>> device = DeviceTR64("fritz.box")
>>> device.setupTR64Device("fritz.box")
>>> system = System(device)
>>> print(system.getSystemInfo().manufactureName)
"AVM"

Not out of the box supported devices

Even when your device is not supported out of the box you can use the convenient way to access TR64 actions. Unless you have the URL to the device definitions you have to run a discover process and load the device definitions before you can use the defined methods in this module.

Example:

>>> results = Discover.discover()
# ... choose the result for your device, lets assume it would be the very first one
>>> result = Discover.discoverParticularHost(results[0].locationHost)
# ... save the result, so that you can skip the calls before next time
>>> device = System(result.locationHost, result.locationPort, result.locationProtocol)
>>> device.loadDeviceDefinitions(result.location)
>>> print(device.getSystemInfo().manufactureName)
"<manufacture name>"

If you like to support the effort to improve this library and your device is not supported out of the box, please send me the output of the following script execution:

> simpletr64_deviceinfo <name or IP of the device>

Please, send me the output via E-mail to: sourcecode@ka.ro

System Classes

class simpletr64.actions.System(hostname, port=49000, protocol='http')

Class to get various System information’s of a device which supports urn:dslforum-org:service:DeviceInfo:1 and urn:dslforum-org:service:Time:1.

The class supports devices which supports urn:dslforum-org:service:Time:1 and urn:dslforum-org:service:DeviceInfo:1 namespace. Unless the device is a AVM Fritz product the object needs to load the device definitions with loadDeviceDefinitions() before the usage of any of the methods. For a Fritz product setupTR64Device() can be called also this might not be future compatible. Also a device might not support all of the actions. This class does not implement all of the actions of this namespace, please check the SCPD definitions if you miss some functionality. This library provides some tools to gather the needed information’s.

See also

Baseclass: DeviceTR64

loadDeviceDefinitions(), loadSCPD(), setupTR64Device()

The tools which have been provided with this library shows good use of the full library.

static createFromURL(urlOfXMLDefinition)

Factory method to create a DeviceTR64 from an URL to the XML device definitions.

Parameters:urlOfXMLDefinition (str) –
Returns:the new object
Return type:System
static getServiceType(method)

For a given method name return the service type which supports it.

Parameters:method – the method name to lookup
Returns:the service type or None
Return type:str
getSystemInfo(timeout=1)

Execute GetInfo action to get information’s about the System on the device.

Returns:information’s about the System on the device.
Return type:SystemInfo
getTimeInfo(timeout=1)

Execute GetInfo action to get information’s about the time on the device.

Returns:information’s about the time on the device.
Return type:TimeInfo
reboot(timeout=1)

Reboot the device

softwareUpdateAvailable(timeout=1)

Returns if a software update is available

Returns:if a software update is available
Return type:bool

class simpletr64.actions.SystemInfo(results)

A container class for System information’s.

description

Return a description of the device.

Returns:a description of the device
Return type:str
hwVersion

Return the hardware version of the system.

Returns:the hardware version of the system.
Return type:str
log

Return the last lines in the log file.

Returns:the last lines in the log file.
Return type:str
manufactureName

Return the name of the manufacture of the device.

Returns:the name of the manufacture of the device.
Return type:str
modelName

Return the name of the model of the device.

Returns:the name of the model of the device.
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
serialNumber

Return the serial number of the system.

Returns:the serial number of the system.
Return type:str
softwareVersion

Return the software version of the system.

Returns:the software version of the system.
Return type:str
uptime

Return the uptime of the system.

Returns:the uptime of the system.
Return type:int

class simpletr64.actions.TimeInfo(results)

A container class for time information’s.

currentLocalTime

Return current local time.

Returns:current local time.
Return type:str
daylightSavingEnd

Return when the day light saving time ends.

Returns:when the day light saving time ends.
Return type:str
daylightSavingStart

Return when the day light saving time starts.

Returns:when the day light saving time starts.
Return type:str
isDaylightSaving

Return if it is now day light saving time.

Returns:if it is now day light saving time.
Return type:bool
localTimeZone

Return the local time zone.

Returns:the local time zone.
Return type:str
localTimeZoneName

Return the name of the local time zone.

Returns:the name of the local time zone.
Return type:str
ntpServer1

Return the first configured NTP server.

Returns:the first configured NTP server.
Return type:str
ntpServer2

Return the second configured NTP server.

Returns:the second configured NTP server.
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]

LAN Classes

class simpletr64.actions.Lan(hostname, port=49000, protocol='http')

Class to get various LAN information’s of a device which supports urn:dslforum-org:service:Hosts:1 and urn:dslforum-org:service:LAN*.

The class supports devices which supports urn:dslforum-org:service:LAN* and urn:dslforum-org:service:Hosts:1 namespace. Unless the device is a AVM Fritz product the object needs to load the device definitions with loadDeviceDefinitions() before the usage of any of the methods. For a Fritz product setupTR64Device() can be called also this might not be future compatible. Also a device might not support all of the actions. This class does not implement all of the actions of this namespace, please check the SCPD definitions if you miss some functionality. This library provides some tools to gather the needed information’s.

All LAN actions ask for a interface id, this depends on the device if the counting starts with 0 or 1. Sometimes a device may support more than one LAN interface.

See also

Baseclass: DeviceTR64

loadDeviceDefinitions(), loadSCPD(), setupTR64Device()

The tools which have been provided with this library shows good use of the full library.

static createFromURL(urlOfXMLDefinition)

Factory method to create a DeviceTR64 from an URL to the XML device definitions.

Parameters:urlOfXMLDefinition (str) –
Returns:the new object
Return type:Lan
getAmountOfHostsConnected(lanInterfaceId=1, timeout=1)

Execute NewHostNumberOfEntries action to get the amount of known hosts.

Parameters:
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the amount of known hosts.

Return type:

int

getEthernetInfo(lanInterfaceId=1, timeout=1)

Execute GetInfo action to get information’s about the Ethernet interface.

Parameters:
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

information’s about the Ethernet interface.

Return type:

EthernetInfo

getEthernetStatistic(lanInterfaceId=1, timeout=1)

Execute GetStatistics action to get statistics of the Ethernet interface.

Parameters:
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

statisticss of the Ethernet interface.

Return type:

EthernetStatistic

getHostDetailsByIndex(index, lanInterfaceId=1, timeout=1)

Execute GetGenericHostEntry action to get detailed information’s of a connected host.

Parameters:
  • index – the index of the host
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the detailed information’s of a connected host.

Return type:

HostDetails

getHostDetailsByMACAddress(macAddress, lanInterfaceId=1, timeout=1)

Get host details for a host specified by its MAC address.

Parameters:
  • macAddress (str) – MAC address in the form 38:C9:86:26:7E:38; be aware that the MAC address might be case sensitive, depending on the router
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

return the host details if found otherwise an Exception will be raised

Return type:

HostDetails

static getServiceType(method)

For a given method name return the service type which supports it.

Parameters:method – the method name to lookup
Returns:the service type or None, an interface id needs to be added to this
Return type:str
setEnable(status, lanInterfaceId=1, timeout=1)

Set enable status for a LAN interface, be careful you don’t cut yourself off.

Parameters:
  • status (bool) – enable or disable the interface
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed

class simpletr64.actions.EthernetStatistic(results)

A container class for Ethernet interface statistics.

bytesReceived

Return the amount of bytes which have been received.

Returns:the amount of bytes which have been received.
Return type:int
bytesSent

Return the amount of bytes which have been sent.

Returns:the amount of bytes which have been sent.
Return type:int
packetsReceived

Return the amount of packets which have been received.

Returns:the amount of packets which have been received.
Return type:int
packetsSent

Return the amount of packets which have been sent.

Returns:the amount of packets which have been sent.
Return type:int
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]

class simpletr64.actions.EthernetInfo(results)

A container class for Ethernet interface information’s.

duplexMode

Return if the Ethernet interface is in half or full duplex mode.

Returns:if the Ethernet interface is in half or full duplex mode.
Return type:str
enabled

Return if the interface is enabled.

Returns:if the interface is enabled.
Return type:bool
macAddress

Return the MAC address of the ethernet interface.

Returns:the MAC address of the ethernet interface.
Return type:str
maxBitRate

Return the max bit rate of the interface.

Returns:the max bit rate of the interface.
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
status

Return the status of the interface.

Returns:the status of the interface.
Return type:str

class simpletr64.actions.HostDetails(results, macAddress=None)

A container class for information’s about a LAN connected host.

active

Return if the host is active.

Returns:if the host is active
Return type:bool
hostname

Return the name of the host.

Returns:the name of the host.
Return type:str
interface

Return the interface to which the host is connected.

Returns:the interface to which the host is connected.
Return type:str
ipaddress

Return the IP address of the host.

Returns:the IP address of the host.
Return type:str
leasetime

Return the remaining lease time

Returns:the remaining lease time
Return type:int
macAddress

Return the MAC address of the host.

Returns:the MAC address of the host.
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
source

Return the source where the address of this host was learned.

Returns:the source where the address of this host was learned.
Rtype str:

WAN Classes

class simpletr64.actions.Wan(hostname, port=49000, protocol='http')

Class to get various WAN information’s of a device which supports urn:dslforum-org:service:WAN*.

The class supports devices which supports urn:dslforum-org:service:WAN* namespace. Unless the device is a AVM Fritz product the object needs to load the device definitions with loadDeviceDefinitions() before the usage of any of the methods. For a Fritz product setupTR64Device() can be called also this might not be future compatible. Also a device might not support all of the actions. This class does not implement all of the actions of this namespace, please check the SCPD definitions if you miss some functionality. This library provides some tools to gather the needed information’s.

All WAN actions ask for a interface id, this depends on the device if the counting starts with 0 or 1. Rarely a device supports more than one interface but for consistency reasons you can choose your interface.

See also

Baseclass: DeviceTR64

loadDeviceDefinitions(), loadSCPD(), setupTR64Device()

The tools which have been provided with this library shows good use of the full library.

static createFromURL(urlOfXMLDefinition)

Factory method to create a DeviceTR64 from an URL to the XML device definitions.

Parameters:urlOfXMLDefinition (str) –
Returns:the new object
Return type:Wan
getADSLInfo(wanInterfaceId=1, timeout=1)

Execute GetInfo action to get basic ADSL information’s.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

ADSL informations.

Return type:

ADSLInfo

getByteStatistic(wanInterfaceId=1, timeout=1)

Execute GetTotalBytesSent&GetTotalBytesReceived actions to get WAN statistics.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

a tuple of two values, total bytes sent and total bytes received

Return type:

list[int]

getConnectionInfo(wanInterfaceId=1, timeout=1)

Execute GetInfo action to get WAN connection information’s.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

WAN connection information’s.

Return type:

ConnectionInfo

getEthernetLinkStatus(wanInterfaceId=1, timeout=1)

Execute GetEthernetLinkStatus action to get the status of the ethernet link.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

status of the ethernet link

Return type:

str

getLinkInfo(wanInterfaceId=1, timeout=1)

Execute GetInfo action to get basic WAN link information’s.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

basic WAN link information’s

Return type:

WanLinkInfo

getLinkProperties(wanInterfaceId=1, timeout=1)

Execute GetCommonLinkProperties action to get WAN link properties.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

WAN link properties

Return type:

WanLinkProperties

getPacketStatistic(wanInterfaceId=1, timeout=1)

Execute GetTotalPacketsSent&GetTotalPacketsReceived actions to get WAN statistics.

Parameters:
  • wanInterfaceId (int) – the id of the WAN device
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

a tuple of two values, total packets sent and total packets received

Return type:

list[int]

static getServiceType(method)

For a given method name return the service type which supports it.

Parameters:method – the method name to lookup
Returns:the service type or None, an interface id needs to be added to this
Return type:str
requestConnection(wanInterfaceId=1, timeout=1)

Request the connection to be established

Parameters:
  • wanInterfaceId (int) – the id of the WAN interface
  • timeout (float) – the timeout to wait for the action to be executed
setEnable(status, wanInterfaceId=1, timeout=1)

Set enable status for a WAN interface, be careful you don’t cut yourself off.

Parameters:
  • status (bool) – enable or disable the interface
  • wanInterfaceId (int) – the id of the WAN interface
  • timeout (float) – the timeout to wait for the action to be executed
terminateConnection(wanInterfaceId=1, timeout=1)

Terminate the connection

Parameters:
  • wanInterfaceId (int) – the id of the WAN interface
  • timeout (float) – the timeout to wait for the action to be executed

class simpletr64.actions.WanLinkInfo(results)

A container class for WAN link information’s.

dataPath

Return .... what

Returns:
Return type:str
downStreamCurrentRate

Return the current downstream rate of the WAN link.

Returns:the current downstream rate of the WAN link.
Return type:int
downstreamMaxRate

Return the maximal downstream rate of the WAN link.

Returns:the maximal downstream rate of the WAN link.
Return type:int
enabled

Return if the WAN link is enabled.

Returns:if the WAN link is enabled.
Return type:bool
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
status

Return the WAN link status.

Returns:the WAN link status.
Return type:str
upstreamCurrentRate

Return the current upstream rate of the WAN link.

Returns:the current upstream rate of the WAN link.
Return type:int
upstreamMaxRate

Return the maximal upstream rate of the WAN link.

Returns:the maximal upstream rate of the WAN link.
Return type:int

class simpletr64.actions.ADSLInfo(results)

A container class for ADSL link information’s.

destinationAddress

Return the destination address of the ADSL interface.

Returns:the destination address of the ADSL interface.
Return type:str
enabled

Return if the ADSL interface is enabled.

Returns:if the ADSL interface is enabled.
Return type:bool
linkType

Return the link type for the ADSL interface.

Returns:Return the link type for the ADSL interface.
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
status

Return the status for the ADSL interface.

Returns:the status for the ADSL interface.
Return type:str

class simpletr64.actions.WanLinkProperties(results)

A container class for WAN link properties.

accessType

Return the access type of the WAN link.

Returns:the access type of the WAN link.
Return type:str
downstreamMaxBitRate

Return the maximum bit rate for the downstream on this WAN link.

Returns:the maximum bit rate for the downstream on this WAN link.
Return type:int
linkStatus

Return the WAN link status.

Returns:the WAN link status.
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
upstreamMaxBitRate

Return the maximum bit rate for the upstream on this WAN link.

Returns:the maximum bit rate for the upstream on this WAN link.
Return type:int

class simpletr64.actions.ConnectionInfo(results)

A container class for WAN connection information’s.

connectionType

Return the type of the WAN connection.

Returns:the type of the WAN connection.
Return type:str
dnsEnabled

Return if DNS is enabled for the WAN connection.

Returns:if DNS is enabled for the WAN connection.
Return type:bool
dnsServers

Return the list of DNS servers for the WAN connection.

Returns:the list of DNS servers for the WAN connection.
Return type:str
enabled

Return if WAN connection is enabled.

Returns:if WAN connection is enabled.
Return type:bool
externalIPaddress

Return the external IP address of the WAN connection.

Returns:the external IP address of the WAN connection.
Return type:str
lastConnectionError

Return the last connection error of the WAN connection.

Returns:the last connection error of the WAN connection.
Return type:str
macAddress

Return the MAC address of the WAN device.

Returns:the MAC address of the WAN device.
Return type:str
name

Return the name of the WAN connection.

Returns:the name of the WAN connection.
Return type:str
natEnabled

Return if NAT is enabled for the WAN connection.

Returns:if NAT is enabled for the WAN connection.
Return type:bool
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
status

Return the status of the WAN connection.

Returns:the status of the WAN connection.
Return type:str
type

Return the type of the WAN connection.

Returns:the type of the WAN connection.
Return type:str
uptime

Return the uptime of the WAN connection.

Returns:the uptime of the WAN connection.
Return type:int

Wifi Classes

class simpletr64.actions.Wifi(hostname, port=49000, protocol='http')

Class to get Wifi information’s of a device which supports urn:dslforum-org:service:WLANConfiguration:X.

The class supports devices which supports urn:dslforum-org:service:WLANConfiguration:X namespace. Unless the device is a AVM Fritz product the object needs to load the device definitions with loadDeviceDefinitions() before the usage of any of the methods. For a Fritz product setupTR64Device() can be called also this might not be future compatible. Also a device might not support all of the actions. This class does not implement all of the actions of this namespace, please check the SCPD definitions if you miss some functionality. This library provides some tools to gather the needed information’s.

All Wifi actions ask for a interface id, this depends on the device if the counting starts with 0 or 1. Often a device supports more than one interface as for example to support 2.4 and 5 Ghz.

See also

Baseclass: DeviceTR64

loadDeviceDefinitions(), loadSCPD(), setupTR64Device()

The tools which have been provided with this library shows good use of the full library.

static createFromURL(urlOfXMLDefinition)

Factory method to create a DeviceTR64 from an URL to the XML device definitions.

Parameters:urlOfXMLDefinition (str) –
Returns:the new object
Return type:Wifi
getGenericAssociatedDeviceInfo(index, wifiInterfaceId=1, timeout=1)

Execute GetGenericAssociatedDeviceInfo action to get detailed information about a Wifi client.

Parameters:
  • index (int) – the number of the client
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the detailed information’s about a Wifi client

Return type:

WifiDeviceInfo

getPacketStatistic(wifiInterfaceId=1, timeout=1)

Execute GetPacketStatistics action to get Wifi statistics.

Parameters:
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

a tuple of two values, total packets sent and total packets received

Return type:

list[int]

static getServiceType(method)

For a given method name return the service type which supports it.

Parameters:method – the method name to lookup
Returns:the service type or None, an interface id needs to be added to this
Return type:str
getSpecificAssociatedDeviceInfo(macAddress, wifiInterfaceId=1, timeout=1)

Execute GetSpecificAssociatedDeviceInfo action to get detailed information about a Wifi client.

Parameters:
  • macAddress (str) – MAC address in the form 38:C9:86:26:7E:38; be aware that the MAC address might be case sensitive, depending on the router
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the detailed information’s about a Wifi client

Return type:

WifiDeviceInfo

getStatistic(wifiInterfaceId=1, timeout=1)

Execute GetStatistics action to get Wifi statistics.

Parameters:
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

a tuple of two values, total packets sent and total packets received

Return type:

list[int]

getTotalAssociations(wifiInterfaceId=1, timeout=1)

Execute GetTotalAssociations action to get the amount of associated Wifi clients.

Parameters:
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the amount of Wifi clients

Return type:

int

getWifiInfo(wifiInterfaceId=1, timeout=1)

Execute GetInfo action to get Wifi basic information’s.

Parameters:
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the basic informations

Return type:

WifiBasicInfo

setChannel(channel, wifiInterfaceId=1, timeout=1)

Set the channel of this Wifi interface

Parameters:
  • channel (int) – the channel number
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
setEnable(status, wifiInterfaceId=1, timeout=1)

Set enable status for a Wifi interface, be careful you don’t cut yourself off.

Parameters:
  • status (bool) – enable or disable the interface
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
setSSID(ssid, wifiInterfaceId=1, timeout=1)

Set the SSID (name of the Wifi network)

Parameters:
  • ssid (str) – the SSID/wifi network name
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed

class simpletr64.actions.WifiDeviceInfo(results, macAddress=None)

A container class for Wifi device information’s.

authenticated

Returns if the client has been authenticated.

Returns:if client is authenticated
Return type:bool
ipAddress

Return the IP address

Returns:the IP address
Return type:str
macAddress

Returns the mac address

Returns:the mac address
Return type:str
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]

class simpletr64.actions.WifiBasicInfo(results)

A container class for Wifi client information’s.

authMode

Return the authentication mode for the Wifi client.

Returns:the authentication mode for the Wifi client
Return type:str
beaconType

Return ... what ever

Returns:
Return type:str
bssid

Returns the BSS id.

Returns:the bss id.
Return type:str
channel

Returns the used Wifi channel.

Returns:the used Wifi channel
Return type:int
enabled

Returns if the Wifi client is enabled.

Returns:if client is enabled.
Return type:bool
encryptionMode

Returns the encryption mode.

Returns:the encryption mode
Return type:str
macControl

Returns if mac control is activated.

Returns:if mac control is activated
Return type:bool
raw

Return the raw results which have been used to initialize the object.

Returns:the raw results
Return type:dict[str,str]
ssid

Return the SSID for the given Wifi client.

Returns:the SSID
Return type:str
standard

Return ... what ever

Returns:
Return type:str
status

Returns the status for the Wifi client.

Returns:the status for the client
Return type:str

Fritz specific Classes

class simpletr64.actions.Fritz(hostname, port=49000, protocol='http')

Class to get various information’s of a Fritz product which has TR64/UpnP enabled

The class supports various Fritz products which have UpnP enabled. Also it is an AVM Fritz product the object should load the device definitions with loadDeviceDefinitions() before the usage of any of the methods. As you like to interact with a Fritz product you might use setupTR64Device() also this might not be future compatible. Also a device might not support all of the actions. This class does not implement all of the actions of this namespace, please check the SCPD definitions if you miss some functionality. This library provides some tools to gather the needed information’s.

All LAN actions ask for a interface id, this depends on the device if the counting starts with 0 or 1. Sometimes a device may support more than one LAN interface.

See also

Baseclass: DeviceTR64

loadDeviceDefinitions(), loadSCPD(), setupTR64Device()

The tools which have been provided with this library shows good use of the full library.

static createFromURL(urlOfXMLDefinition)

Factory method to create a DeviceTR64 from an URL to the XML device definitions.

Parameters:urlOfXMLDefinition (str) –
Returns:the new object
Return type:Lan
doUpdate(timeout=1)

Do a software update of the Fritz Box if available.

Parameters:timeout (float) – the timeout to wait for the action to be executed
Returns:a list of if an update was available and the update state (bool, str)
Return type:tuple(bool, str)
getCallList(timeout=1)

Get the list of phone calls made

Example of a phone call result:

[{'Count': None, 'Name': None, 'CalledNumber': '030868709971', 'Numbertype': 'sip', 'Duration': '0:01',
'Caller': '015155255399', 'Called': 'SIP: 030868729971', 'Date': '02.01.14 13:14',
'Device': 'Anrufbeantworter','Path': None, 'Port': '40', 'Type': '1', 'Id': '15'}]

Types:

  • 1 - answered
  • 2 - missed
  • 3 - outgoing
Parameters:timeout (float) – the timeout to wait for the action to be executed
Returns:the list of made phone calls
Return type:list[dict[str: str]]
static getServiceType(method)

For a given method name return the service type which supports it.

Parameters:method – the method name to lookup
Returns:the service type or None, an interface id needs to be added to this
Return type:str
isOptimizedForIPTV(wifiInterfaceId=1, timeout=1)

Return if the Wifi interface is optimized for IP TV

Parameters:
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

if the Wifi interface is optimized for IP TV

Return type:

bool

sendWakeOnLan(macAddress, lanInterfaceId=1, timeout=1)

Send a wake up package to a device specified by its MAC address.

Parameters:
  • macAddress (str) – MAC address in the form 38:C9:86:26:7E:38; be aware that the MAC address might be case sensitive, depending on the router
  • lanInterfaceId (int) – the id of the LAN interface
  • timeout (float) – the timeout to wait for the action to be executed
Returns:

the amount of known hosts.

Return type:

int

setOptimizedForIPTV(status, wifiInterfaceId=1, timeout=1)

Set if the Wifi interface is optimized for IP TV

Parameters:
  • status (bool) – set if Wifi interface should be optimized
  • wifiInterfaceId (int) – the id of the Wifi interface
  • timeout (float) – the timeout to wait for the action to be executed