UPnP Interface with Draytek Router Broken

Hello all,

I have a Draytek 2860Ln Router which HA happily found.
However the interface doesn’t work, digging in the logs found the cause…

UPnP/IGD (Internet Gateway Device) has a standard protocol which (as described in http://upnp.org/specs/gw/UPnP-gw-WANCommonInterfaceConfig-v1-Service.pdf ). It specifies an ‘action’ to get the number of packets received, called GetTotalPacketsReceived, page 16 of that document. The action has one OUT-argument: NewTotalPacketsReceived.

The 2860Ln, however, reports it as NewTotalPacketReceived, it misses the ‘s’ off Packets. This causes the interface to fail.

I’ve reported it to Draytek but I can’t imagine they’ll ever fix it.

Is there any way I can tweak my HA instance to expect the incorrect spelling?

It’s in the async_upnp_client module at line 114 (currently) of igd.py (github link)

If you can find and edit that file on your system, it should work after a restart.

Thanks for the quick response Troon.

I made the edit in igd.py and changed:

total_packets_received: int = result["NewTotalPacketsReceived"]

to be

total_packets_received: int = result["NewTotalPacketReceived"]

After restart still getting the error:

Logger: homeassistant.components.upnp
Source: components/upnp/device.py:180
Integration: UPnP ([documentation](https://www.home-assistant.io/integrations/upnp), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+upnp%22))
First occurred: 18:02:03 (79 occurrences)
Last logged: 18:50:11

* Unexpected error fetching Vigor2860Ln data: Invalid response, unknown argument: NewTotalPacketReceived, <ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" xmlns:ns2="urn:schemas-microsoft-com:datatypes" ns0:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns0:Body><ns1:GetTotalPacketsReceivedResponse><NewTotalPacketReceived ns2:dt="ui4">84855210</NewTotalPacketReceived></ns1:GetTotalPacketsReceivedResponse></ns0:Body></ns0:Envelope>
* Unexpected error fetching Vigor2860Ln data: Invalid response, unknown argument: NewTotalPacketReceived, <ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" xmlns:ns2="urn:schemas-microsoft-com:datatypes" ns0:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns0:Body><ns1:GetTotalPacketsReceivedResponse><NewTotalPacketReceived ns2:dt="ui4">84855762</NewTotalPacketReceived></ns1:GetTotalPacketsReceivedResponse></ns0:Body></ns0:Envelope>
* Unexpected error fetching Vigor2860Ln data: Invalid response, unknown argument: NewTotalPacketReceived, <ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" xmlns:ns2="urn:schemas-microsoft-com:datatypes" ns0:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns0:Body><ns1:GetTotalPacketsReceivedResponse><NewTotalPacketReceived ns2:dt="ui4">84856252</NewTotalPacketReceived></ns1:GetTotalPacketsReceivedResponse></ns0:Body></ns0:Envelope>
* Unexpected error fetching Vigor2860Ln data: Invalid response, unknown argument: NewTotalPacketReceived, <ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" xmlns:ns2="urn:schemas-microsoft-com:datatypes" ns0:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns0:Body><ns1:GetTotalPacketsReceivedResponse><NewTotalPacketReceived ns2:dt="ui4">84864833</NewTotalPacketReceived></ns1:GetTotalPacketsReceivedResponse></ns0:Body></ns0:Envelope>
* Unexpected error fetching Vigor2860Ln data: Invalid response, unknown argument: NewTotalPacketReceived, <ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" xmlns:ns2="urn:schemas-microsoft-com:datatypes" ns0:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns0:Body><ns1:GetTotalPacketsReceivedResponse><NewTotalPacketReceived ns2:dt="ui4">84865948</NewTotalPacketReceived></ns1:GetTotalPacketsReceivedResponse></ns0:Body></ns0:Envelope>

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 180, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 140, in _async_update_data return await self.update_method() File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 180, in async_get_traffic_data values = await asyncio.gather( File "/usr/local/lib/python3.8/site-packages/async_upnp_client/profiles/igd.py", line 113, in async_get_total_packets_received result = await action.async_call() File "/usr/local/lib/python3.8/site-packages/async_upnp_client/client.py", line 573, in async_call response_args = self.parse_response( File "/usr/local/lib/python3.8/site-packages/async_upnp_client/client.py", line 634, in parse_response return self._parse_response_args(service_type, xml) File "/usr/local/lib/python3.8/site-packages/async_upnp_client/client.py", line 658, in _parse_response_args raise UpnpError( async_upnp_client.client.UpnpError: Invalid response, unknown argument: NewTotalPacketReceived, <ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" xmlns:ns2="urn:schemas-microsoft-com:datatypes" ns0:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns0:Body><ns1:GetTotalPacketsReceivedResponse><NewTotalPacketReceived ns2:dt="ui4">82970551</NewTotalPacketReceived></ns1:GetTotalPacketsReceivedResponse></ns0:Body></ns0:Envelope>

@paulrickwood - did you get anywhere with this one? Keen to resolve the same for myself.

No unfortunately not.
Away for Christmas but will have another look when I get back.