TR 64 - Router Monitor - V1.0.0

Posted on
Sat Jan 16, 2016 10:09 am
ben-p offline
Posts: 9
Joined: Jan 05, 2016

TR 64 - Router Monitor - V1.0.0

This plugin for Indigo Pro let you interact with devices which supports UPnP/TR64. Usually these are devices which
do provide any kind of network connection like Cable/ADSL/WAN modems, WIFI-, LAN-router but as well some media devices.
For now this plugin supports mainly:

  • Cable/ADSL or short WAN devices
  • LAN devices
  • WIFI devices

and in particular products from AVM called Fritz (Box, Repeater, etc).

The plugin provides dedicated data for certain type of devices like how much bytes have been transferred, how many
host are connected, what is the external IP address but also you can get very specific data about a device in your
network for example the IP address of it and if it is connected. This can be used to for presence monitoring. Further
details will follow down.

Installation

Find the latest version here for download::

https://github.com/bpannier/TR64RouterM ... latest.zip

After unpacking, double click on it should bring Indigo up and ask if the plugin should be installed.

Documentation:

The latest documentation can always be found:

https://github.com/bpannier/TR64RouterM ... README.rst

Configuration

This plugin provides different logical devices which will be bind against a physical device where one physical device
can be bind against several logical devices. Most of the logical devices provides several values which gets gathered
through one or multiple calls to the physical device. The protocol which gets used is TR64 based on UPnP based on SOAP
based on HTTP. Even when your device supports TR64 or UPnP your device might not support all features, states or
actions which will be mentioned here, you also will see this in your logfile in case some functionality is missing.

Pre-Condition - Physical Device Configuration:

Any physical device needs to enable TR64 or UPnP, for a Fritz.box for example you can find this under:

Home-network / Network / Network Settings (Heimnetz / Netzwerk / Netzwerkeinstellungen)::

  • Permit access for applications TR64 (Zugriff für Anwendungen zulassen)
  • Status information's using UPnP (Statusinformationen ueber UPnP uebertragen)

Also it is highly recommended to enable authentication.


Plugin Configuration:

  • Update frequency - how often will the devices which belongs to this plugin be updated
  • Turn on Debug - you can get some more verbose information's in the logfile
  • HTTP/HTTPS Proxy - set a proxy of the form "http://hostname:port"
  • Network timeout - after how much seconds a connection should fail

Indigo Device Configuration:

For LAN / WAN / WIFI devices you will have to specify an interface id. Many routers provide more than one interface and
you have to choose with which one you like to interact. The numbering starts with 1. Be aware that most WIFI routers
provide today different frequencies (2.4, 5 Ghz) which will be mapped at least to two different devices.

Also you have to choose to which physical device the logical device in Indigo should be bind. When the Indigo device
configuration opens, the plugin will try to discover any device in your local network which supports TR64, you then
can choose from the list of devices. In case your device will not be found you can assume your device will not be
supported, in very rare cases you might specify the router manually ... sorry, for them who knows, documentation might
be added later.

You can and should specify the username/password or password only to authenticate this plugin against your physical
device.

Also you can toggle the checkbox to "ignore errors", in case your device do not support the full functionality
errors in the logfile of this device will be omitted.


The logical devices which you can add and configure in Indigo after installing this plugin:


Router System

This provides states and actions which are not associated with any network type but with the system in itself.

States::

* softwareVersion
* softwareUpdateAvailable
* uptime
* currentTime
* currentTimeZone

Actions::

* resetDevice - Reboot the physical device


LAN Router

This provides states and actions for the LAN part of a router.

States::

* hostsConnected - the amount of hosts connected/known
* lanBytesSent
* lanBytesReceived
* lanPacketsSent
* lanPacketsReceived
* lanEnabled
* lanStatus
* lanMaxBitrate
* lanDuplex

Actions::

* enableInterface
* disableInterface


WAN Router

This provides states and actions for the WAN/ADSL/Cable/etc part of a router.

States::

* wanBytesSent
* wanBytesReceived
* wanPacketsSent
* wanPacketsReceived
* wanEnabled
* wanStatus
* wanUpstreamRate
* wanDownstreamRate
* wanUpstreamMaxRate
* wanDownstreamMaxRate
* wanUptime
* wanLastError
* wanExternalIP
* wanExternalDNS
* wanLinkStatus

Actions::

* enableInterface
* disableInterface
* terminateConnection
* requestConnection


WIFI Router

This provides states and actions for a WIFI router.

States::

* wifiBytesSent
* wifiBytesReceived
* wifiPacketsSent
* wifiPacketsReceived
* wifiEnabled
* wifiStatus
* wifiAmountAssociatedDevices - how many WIFI devices are/have been connected to this router on the given interface.
* wifiChannel - the channel of the WIFI network
* wifiSSID - the name of the WIFI network

Actions::

* enableInterface
* disableInterface
* setSSID - set a new WIFI network name
* setChannel - set a new channel for the WIFI network of the given interface; please refer your router documentation


LAN Device Information

This is a virtual device which provides information's about one specific device which is connected to the router via
LAN. The device will be specified with it's MAC address in the configuration of the Indigo device.

States::

* ipAddress
* hostname
* leasetime
* active


Wifi Device Information

This is a virtual device which provides information's about one specific device which is connected to the router via
WIFI. The device will be specified with it's MAC address in the configuration of the Indigo device.

States::

* ipAddress
* authenticated


Fritz Product

This is a virtual device which supports AVM Fritz Box/Repeater/etc, it will not work with any other physical device.
Also within this product family your device might not support all features, please check your documentation.

States::

* callListEntryAmount - how many calls have been received/made
* lastCallCalledNumber
* lastCallCaller
* lastCallDate
* lastCallDevice
* lastCallType - 1: answered, 2: missed, 3: outgoing
* lastCallDuration
* lastCallNumberType

Actions::

* doUpdate - do an software update if available
* optimizeForIPTV - the WIFI network could be optimized for IP TV applications
* dontOptimizeForIPTV


Request

I am always looking forward to extend the scope of this plugin, please give me feedback if you like to see additional
functionality or even when you like to contribute. Many TR64 devices supports much more functionality than supported
by this plugin, to check what your devices will support have a look on a tool to check:

http://bpannier.github.io/simpletr64/

This is a Python library which comes with a tool to discover any UPnP devices on the network::

$ upnp_tools discover

To understand what kind of functionality a particular device supports you run::

$ upnp_tools deviceinfo <devicename/ip>

If you find some functionality which is in your interest and might support more people please let me know and hopefully
I can extend the plugin. Please, send me in that case the output of the last command above.


Source Code

This plugin is actively developed on GitHub, where the code is always available <https://github.com/bpannier/TR64RouterMonitor>

You can either clone the public repository::

$ git clone git://github.com/bpannier/TR64RouterMonitor.git

Download the tarball <https://github.com/bpannier/TR64RouterMonitor/tarball/master>::

$ curl -OL https://github.com/bpannier/TR64RouterM ... all/master

Or, download the zipball <https://github.com/bpannier/TR64RouterMonitor/zipball/master>::

$ curl -OL https://github.com/bpannier/simpletr64/ ... tor/master


Once you have a copy of the source, you will have to create and install the plugin with

$ make install


Author

This plugin is written and maintained by Benjamin Pannier <http://bpannier.github.io/> <sourcecode@ka.ro>

Please, feel free to contribute good karma and credits are guaranteed.


History

1.0.0 (2016-01-16)

* Birth!

Posted on
Sat Jan 16, 2016 11:57 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: TR 64 - Router Monitor - V1.0.0

Hi Ben,

This looks great! Thanks for the contribution to the community and the thorough documentation. I've added a link to this page on our plugins list post.

Image

Posted on
Wed Feb 10, 2016 12:55 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

Very nice, I have a Fritz!Box 7490 and a 310 Repeater...I will give it a try :)

Thanks a lot :)

Posted on
Wed Feb 10, 2016 11:21 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

Hi,

I gave it a try...but I have some problems, or I did something wrong.

I have a Fritz!Box 7490 and I have enable the TR64 protocol and the uPNP; I saw in logs that it makes a discovery process at startup, it finds my router at IP 192.168.1.101 but it says that it cannot be added as no supported.
Also trying to add manually the router, the combobox for the Fritz models is empty...

Thanks
Marco

Posted on
Mon Feb 29, 2016 7:02 am
ben-p offline
Posts: 9
Joined: Jan 05, 2016

Re: TR 64 - Router Monitor - V1.0.0

Hi Marco,

sorry for the late reply.

Could you please enable Debug and send me the logfile? I will have a look on it, sounds it is easy fixable.

ben

Posted on
Mon Feb 29, 2016 1:18 pm
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

Here we are :)

Code: Select all
Start discovery of devices
  SQL Logger                      creating table device_history_1862823123 for "new device"
  TR64 Router Monitor Debug       Discovery finished
  TR64 Router Monitor Debug       For discovered host 192.168.1.101 there is no support for TR64, skip it.
  TR64 Router Monitor Debug       For discovered host 192.168.1.102 there is no support for TR64, skip it.
  TR64 Router Monitor Debug       For discovered host 192.168.1.220 there is no support for TR64, skip it.
  TR64 Router Monitor Error       For discovered host 192.168.1.222 the device definitions could not be loaded: Service type 'urn:schemas-upnp-org:service:ConnectionManager:1' is defined twice.
  TR64 Router Monitor Error       Select a router or enter one manually.


For info
192.168.1.101: this is a Fritz!Box router (7490)
192.168.1.102: this a Sinology NAS
192.168.1.220: this a Fritz!Repeater (300E)

At least for the *.101 it should work fine

Bye,
Marco

Posted on
Mon Feb 29, 2016 10:53 pm
ben-p offline
Posts: 9
Joined: Jan 05, 2016

Re: TR 64 - Router Monitor - V1.0.0

Super thanks,

looks strange. Could you please do me a big favour and do the following:

  • sudo pip install simpletr64
  • upnp_tools deviceinfo 192.168.1.101
  • upnp_tools deviceinfo 192.168.1.102
  • upnp_tools deviceinfo 192.168.1.220

and send me output of these, private message is fine as well.

Seems the schema is different than expected.

Thanks a lot,
Ben

Posted on
Tue Mar 01, 2016 12:42 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

Hi :)

I will do them this evening when at home :)

Thanks for the support :)

Posted on
Wed Mar 02, 2016 9:33 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

I have installed simpletr64 on my MacMini (where Indigo runs) and was actually not installed.

upnp_tools device info 192.168.1.101 return

Code: Select all
Traceback (most recent call last):
  File "/usr/local/bin/upnp_tools", line 3, in <module>
    import argparse
ImportError: No module named argparse

Posted on
Wed Mar 02, 2016 11:20 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

I have installed the module argparse and now when I give upnp_tools deviceinfo 192.168.1.101 I get

Code: Select all
usage: upnp_tools [-h] [-t TIMEOUT] [-u USER] [-p PASSWORD] [--http HTTP]
                  [--https HTTPS]
                  {execute,deviceinfo,discover} ...

positional arguments:
  {execute,deviceinfo,discover}
                        sub-command help
    discover            Command to discover all UPnP hosts in the network and
                        to dump their brief information's.
    deviceinfo          Command to dump full UPnP information's of a given
                        host.
    execute             Command to execute an UPnP action. Example is:
                        upnp_tools -u <username> -p <pw>
                        http://192.168.178.1:49000/upnp/control/hosts urn
                        :dslforum-org:service:Hosts:1 GetGenericHostEntry
                        NewIndex::0

optional arguments:
  -h, --help            show this help message and exit
  -t TIMEOUT, --timeout TIMEOUT
                        timeout for network actions in seconds
  -u USER, --user USER  username for authentication
  -p PASSWORD, --password PASSWORD
                        password for authentication
  --http HTTP           proxy URL for http requests (http://proxyhost:port)
  --https HTTPS         proxy URL for https requests (https://proxyhost:port)


That is the man page of upnp_tools...

Posted on
Wed Mar 02, 2016 1:27 pm
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

Uhm...a little bit confused; upnp_tools is installed but I ran again sudo -H pip install upnp_tools and I get:

Code: Select all
Collecting upnp-tools
  Could not find a version that satisfies the requirement upnp-tools (from versions: )
No matching distribution found for upnp-tools


If I give:

sudo -H pip uninstall upnp_tools

I get:

Code: Select all
Cannot uninstall requirement upnp-tools, not installed


and if I give which upnp_tools I get:

Code: Select all
usr/local/bin/upnp_tools


Confused :roll:

Posted on
Sat Jun 11, 2016 7:25 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: TR 64 - Router Monitor - V1.0.0

Well, it does not work, at all, and the developer did not answer to my MP.
It seems he abandoned the project; I will try to fix it...

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 14 guests