core icon indicating copy to clipboard operation
core copied to clipboard

UPNP/IGD configuration failed

Open JohanKrab opened this issue 1 year ago • 7 comments

The problem

Schermafdruk van 2024-09-07 13-37-32

What version of Home Assistant Core has the issue?

2024.9.1

What was the last working version of Home Assistant Core?

2024.7.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

UPNP/IGD

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Bron: config_entries.py:604
Eerst voorgekomen: 13:14:38 (5 gebeurtenissen)
Laatst gelogd: 13:33:02
Error setting up entry R7000 (Gateway) for upnp

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 96, in async_setup_entry
    await device.async_subscribe_services()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 208, in async_subscribe_services
    await self._igd_device.async_subscribe_services(auto_resubscribe=True)
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/profiles/profile.py", line 355, in async_subscribe_services
    new_sid, timeout = await self._event_handler.async_subscribe(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/event_handler.py", line 208, in async_subscribe
    raise UpnpResponseError(
async_upnp_client.exceptions.UpnpResponseError: Did not receive HTTP 200 but 400

Additional information

No response

JohanKrab avatar Sep 07 '24 11:09 JohanKrab

Hey there @stevenlooman, mind taking a look at this issue as it has been labeled with an integration (upnp) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of upnp can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign upnp Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


upnp documentation upnp source (message by IssueLinks)

home-assistant[bot] avatar Sep 07 '24 16:09 home-assistant[bot]

You may want to provide a bit more details, like an issue description (just a screenshot without any context is not a full error description). What is a R7000 exactly? Since when does this issue occur (update of ha or the R7000 firmware or just after restarting ha or ...)?

mib1185 avatar Sep 07 '24 16:09 mib1185

Thank you for this issue @JohanKrab. Recently, the upnp component went from purely polling to a combination of subscribing to events (eventing) + polling. Polling means actively asking the router for new data for the sensors (even if nothing changed), while eventing means that the router actively sends a signal to home assistant in case anything changes. Unfortunately, not all data supports eventing, but for the things that do (for example, connection status) this reduces the number of things Home Assistant has to do every 30 seconds.

The latter (eventing + polling), unfortunately, is not properly supported by all routers (even though they should, according to the Internet Gateway Device standard. In your case, while subscribing for events at the router, the router unexpectedly returns an error. I think this error should be handled in a proper way, instead of "crashing" with this error. I'll try to fix this in the future.

In the mean time, you can force the upnp integration to fall back to the old only-polling behavior. You can do this by going to Settings --> Devices & services --> UPnP/IGD --> Configure. Then enable the option Force polling of all data. Your Home Assistant language is Dutch; the translated terms are: Instellingen --> Apparaten en diensten --> UPnP/IGD --> Configureren.

Hope this helps for now. Please let me know.

StevenLooman avatar Sep 11 '24 19:09 StevenLooman

I hit this issue with a Technicolor CobraXh modem, sold as a Telstra Smart Modem 3.

The "Force polling of all data" workaround was effective.

These modems use miniupnpd (https://github.com/miniupnp/miniupnp/)

On the modem side, the miniupnpd log shows: Invalid Callback in SUBSCRIBE http://192.168.5.3:44341/notify

It seems to fire that log message from here: https://github.com/miniupnp/miniupnp/blob/miniupnpd_2_3_7/miniupnpd/upnphttp.c#L703-L705

I can't obviously see why it wouldn't like that subscription URL.

tathamoddie avatar Sep 20 '24 07:09 tathamoddie

Thank you for futher investigating as well as for pointing to this, @tathamoddie. The function checkCallbackURL seems to mark it as an invalid callback URL. Some of the things that can cause this, judging from the code from a quick look:

  • https callback URL, instead of http
  • IPv6 callback URL, while IPv6 is disabled in miniupnp
  • Address in URL does not match caller address
  • Invalid address

Can you create a log file with debug logging enabled? This should include the communication between Home Assistant and the model/router. Hopefully, this shows what is causing this.

StevenLooman avatar Sep 20 '24 09:09 StevenLooman

I had a related experience recently with a Verizon CR1000A router (I have FIOS home internet) that Home Assistant had been detecting via the UPnP/IGD integration, that I just solved by checking the Force polling of all data option in the device configuration as suggested by @StevenLooman above.

In case its helpful, sharing the log error I was seeing before taking the remediation step:

Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: October 4, 2024 at 6:52:22 PM (2 occurrences)
Last logged: October 7, 2024 at 4:53:13 PM

Error setting up entry Verizon Router for upnp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 96, in async_setup_entry
    await device.async_subscribe_services()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 208, in async_subscribe_services
    await self._igd_device.async_subscribe_services(auto_resubscribe=True)
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/profiles/profile.py", line 355, in async_subscribe_services
    new_sid, timeout = await self._event_handler.async_subscribe(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/event_handler.py", line 208, in async_subscribe
    raise UpnpResponseError(
async_upnp_client.exceptions.UpnpResponseError: Did not receive HTTP 200 but 412

Note that the HTTP response error is 412 (as opposed to 400 that @JohanKrab reported above)

tabula-raza avatar Oct 08 '24 18:10 tabula-raza

This should be fixed with #127006.

StevenLooman avatar Oct 10 '24 21:10 StevenLooman

Can you create a log file with debug logging enabled? This should include the communication between Home Assistant and the model/router. Hopefully, this shows what is causing this.

It's a Technicolor CobraXh (2320JC56A).

Logs below.

The requests from the integration look valid.

I suspect, mostly via elimination of other scenarios, that the issue is because of the "Address in URL does not match caller address" check. I'm running HA OS in a VM, so the modem might be mixing up the IP of the host vs. the VM?

2024-10-17 12:20:47.057 DEBUG (MainThread) [homeassistant.components.upnp] Unloading config entry: 01J87325ARNZ563TTWM5XSXJH0
2024-10-17 12:20:47.059 DEBUG (MainThread) [homeassistant.components.upnp] Setting up config entry: 01J87325ARNZ563TTWM5XSXJH0
2024-10-17 12:20:47.060 DEBUG (MainThread) [homeassistant.components.upnp] Device discovered: uuid:3d6576f7-21e3-414f-853d-d51d3f0445fd::urn:schemas-upnp-org:device:InternetGatewayDevice:2, at: {'http://192.168.5.1:5000/rootDesc.xml'}
2024-10-17 12:20:47.060 DEBUG (MainThread) [async_upnp_client.client_factory] Creating device, description_url: http://192.168.5.1:5000/rootDesc.xml
2024-10-17 12:20:47.061 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Sending request:
GET http://192.168.5.1:5000/rootDesc.xml



2024-10-17 12:20:47.071 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Got response from GET http://192.168.5.1:5000/rootDesc.xml:
200
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 2709
Server: Homeware UPnP/1.1
Ext: 
Date: Thu, 17 Oct 2024 01:20:46 GMT

b'<?xml version="1.0"?>\r\n<root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><device><deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:2</deviceType><friendlyName>Technicolor CobraXh (2320JC56A)</friendlyName><manufacturer>Technicolor</manufacturer><manufacturerURL>http://www.technicolor.com/</manufacturerURL><modelDescription>Technicolor Internet Gateway Device</modelDescription><modelName>Technicolor</modelName><modelNumber>CobraXh</modelNumber><modelURL>http://www.technicolor.com/</modelURL><serialNumber>2320JC56A</serialNumber><UDN>uuid:3d6576f7-21e3-414f-853d-d51d3f0445fd</UDN><serviceList><service><serviceType>urn:schemas-upnp-org:service:Layer3Forwarding:1</serviceType><serviceId>urn:upnp-org:serviceId:Layer3Forwarding1</serviceId><controlURL>/JXyaKhg/ctl/L3F</controlURL><eventSubURL>/JXyaKhg/evt/L3F</eventSubURL><SCPDURL>/JXyaKhg/L3F.xml</SCPDURL></service></serviceList><deviceList><device><deviceType>urn:schemas-upnp-org:device:WANDevice:2</deviceType><friendlyName>WANDevice</friendlyName><manufacturer>MiniUPnP</manufacturer><manufacturerURL>http://www.technicolor.com/</manufacturerURL><modelDescription>WAN Device</modelDescription><modelName>WAN Device</modelName><modelNumber>20180101</modelNumber><modelURL>http://www.technicolor.com/</modelURL><serialNumber>2320JC56A</serialNumber><UDN>uuid:3d6576f7-21e3-414f-853e-d51d3f0445fd</UDN><UPC>000000000000</UPC><serviceList><service><serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType><serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId><controlURL>/JXyaKhg/ctl/CmnIfCfg</controlURL><eventSubURL>/JXyaKhg/evt/CmnIfCfg</eventSubURL><SCPDURL>/JXyaKhg/WANCfg.xml</SCPDURL></service></serviceList><deviceList><device><deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:2</deviceType><friendlyName>WANConnectionDevice</friendlyName><manufacturer>MiniUPnP</manufacturer><manufacturerURL>http://www.technicolor.com/</manufacturerURL><modelDescription>MiniUPnP daemon</modelDescription><modelName>MiniUPnPd</modelName><modelNumber>20180101</modelNumber><modelURL>http://www.technicolor.com/</modelURL><serialNumber>2320JC56A</serialNumber><UDN>uuid:3d6576f7-21e3-414f-853f-d51d3f0445fd</UDN><UPC>000000000000</UPC><serviceList><service><serviceType>urn:schemas-upnp-org:service:WANIPConnection:2</serviceType><serviceId>urn:upnp-org:serviceId:WANIPConn1</serviceId><controlURL>/JXyaKhg/ctl/IPConn</controlURL><eventSubURL>/JXyaKhg/evt/IPConn</eventSubURL><SCPDURL>/JXyaKhg/WANIPCn.xml</SCPDURL></service></serviceList></device></deviceList></device></deviceList><presentationURL>http://192.168.5.1/</presentationURL></device></root>'
2024-10-17 12:20:47.073 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Sending request:
GET http://192.168.5.1:5000/JXyaKhg/L3F.xml



2024-10-17 12:20:47.079 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Got response from GET http://192.168.5.1:5000/JXyaKhg/L3F.xml:
200
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 795
Server: Homeware UPnP/1.1
Ext: 
Date: Thu, 17 Oct 2024 01:20:46 GMT

b'<?xml version="1.0"?>\r\n<scpd xmlns="urn:schemas-upnp-org:service-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><actionList><action><name>SetDefaultConnectionService</name><argumentList><argument><name>NewDefaultConnectionService</name><direction>in</direction><relatedStateVariable>DefaultConnectionService</relatedStateVariable></argument></argumentList></action><action><name>GetDefaultConnectionService</name><argumentList><argument><name>NewDefaultConnectionService</name><direction>out</direction><relatedStateVariable>DefaultConnectionService</relatedStateVariable></argument></argumentList></action></actionList><serviceStateTable><stateVariable sendEvents="yes"><name>DefaultConnectionService</name><dataType>string</dataType></stateVariable></serviceStateTable></scpd>'
2024-10-17 12:20:47.081 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Sending request:
GET http://192.168.5.1:5000/JXyaKhg/WANCfg.xml



2024-10-17 12:20:47.088 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Got response from GET http://192.168.5.1:5000/JXyaKhg/WANCfg.xml:
200
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 2943
Server: Homeware UPnP/1.1
Ext: 
Date: Thu, 17 Oct 2024 01:20:46 GMT

b'<?xml version="1.0"?>\r\n<scpd xmlns="urn:schemas-upnp-org:service-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><actionList><action><name>GetCommonLinkProperties</name><argumentList><argument><name>NewWANAccessType</name><direction>out</direction><relatedStateVariable>WANAccessType</relatedStateVariable></argument><argument><name>NewLayer1UpstreamMaxBitRate</name><direction>out</direction><relatedStateVariable>Layer1UpstreamMaxBitRate</relatedStateVariable></argument><argument><name>NewLayer1DownstreamMaxBitRate</name><direction>out</direction><relatedStateVariable>Layer1DownstreamMaxBitRate</relatedStateVariable></argument><argument><name>NewPhysicalLinkStatus</name><direction>out</direction><relatedStateVariable>PhysicalLinkStatus</relatedStateVariable></argument></argumentList></action><action><name>GetTotalBytesSent</name><argumentList><argument><name>NewTotalBytesSent</name><direction>out</direction><relatedStateVariable>TotalBytesSent</relatedStateVariable></argument></argumentList></action><action><name>GetTotalBytesReceived</name><argumentList><argument><name>NewTotalBytesReceived</name><direction>out</direction><relatedStateVariable>TotalBytesReceived</relatedStateVariable></argument></argumentList></action><action><name>GetTotalPacketsSent</name><argumentList><argument><name>NewTotalPacketsSent</name><direction>out</direction><relatedStateVariable>TotalPacketsSent</relatedStateVariable></argument></argumentList></action><action><name>GetTotalPacketsReceived</name><argumentList><argument><name>NewTotalPacketsReceived</name><direction>out</direction><relatedStateVariable>TotalPacketsReceived</relatedStateVariable></argument></argumentList></action></actionList><serviceStateTable><stateVariable sendEvents="no"><name>WANAccessType</name><dataType>string</dataType><allowedValueList><allowedValue>DSL</allowedValue><allowedValue>POTS</allowedValue><allowedValue>Cable</allowedValue><allowedValue>Ethernet</allowedValue></allowedValueList></stateVariable><stateVariable sendEvents="no"><name>Layer1UpstreamMaxBitRate</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="no"><name>Layer1DownstreamMaxBitRate</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="yes"><name>PhysicalLinkStatus</name><dataType>string</dataType><allowedValueList><allowedValue>Up</allowedValue><allowedValue>Down</allowedValue><allowedValue>Initializing</allowedValue><allowedValue>Unavailable</allowedValue></allowedValueList></stateVariable><stateVariable sendEvents="no"><name>TotalBytesSent</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="no"><name>TotalBytesReceived</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="no"><name>TotalPacketsSent</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="no"><name>TotalPacketsReceived</name><dataType>ui4</dataType></stateVariable></serviceStateTable></scpd>'
2024-10-17 12:20:47.091 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Sending request:
GET http://192.168.5.1:5000/JXyaKhg/WANIPCn.xml



2024-10-17 12:20:47.097 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Got response from GET http://192.168.5.1:5000/JXyaKhg/WANIPCn.xml:
200
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 12177
Server: Homeware UPnP/1.1
Ext: 
Date: Thu, 17 Oct 2024 01:20:46 GMT

b'<?xml version="1.0"?>\r\n<scpd xmlns="urn:schemas-upnp-org:service-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><actionList><action><name>SetConnectionType</name><argumentList><argument><name>NewConnectionType</name><direction>in</direction><relatedStateVariable>ConnectionType</relatedStateVariable></argument></argumentList></action><action><name>GetConnectionTypeInfo</name><argumentList><argument><name>NewConnectionType</name><direction>out</direction><relatedStateVariable>ConnectionType</relatedStateVariable></argument><argument><name>NewPossibleConnectionTypes</name><direction>out</direction><relatedStateVariable>PossibleConnectionTypes</relatedStateVariable></argument></argumentList></action><action><name>RequestConnection</name></action><action><name>ForceTermination</name></action><action><name>GetStatusInfo</name><argumentList><argument><name>NewConnectionStatus</name><direction>out</direction><relatedStateVariable>ConnectionStatus</relatedStateVariable></argument><argument><name>NewLastConnectionError</name><direction>out</direction><relatedStateVariable>LastConnectionError</relatedStateVariable></argument><argument><name>NewUptime</name><direction>out</direction><relatedStateVariable>Uptime</relatedStateVariable></argument></argumentList></action><action><name>GetNATRSIPStatus</name><argumentList><argument><name>NewRSIPAvailable</name><direction>out</direction><relatedStateVariable>RSIPAvailable</relatedStateVariable></argument><argument><name>NewNATEnabled</name><direction>out</direction><relatedStateVariable>NATEnabled</relatedStateVariable></argument></argumentList></action><action><name>GetGenericPortMappingEntry</name><argumentList><argument><name>NewPortMappingIndex</name><direction>in</direction><relatedStateVariable>PortMappingNumberOfEntries</relatedStateVariable></argument><argument><name>NewRemoteHost</name><direction>out</direction><relatedStateVariable>RemoteHost</relatedStateVariable></argument><argument><name>NewExternalPort</name><direction>out</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>out</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument><argument><name>NewInternalPort</name><direction>out</direction><relatedStateVariable>InternalPort</relatedStateVariable></argument><argument><name>NewInternalClient</name><direction>out</direction><relatedStateVariable>InternalClient</relatedStateVariable></argument><argument><name>NewEnabled</name><direction>out</direction><relatedStateVariable>PortMappingEnabled</relatedStateVariable></argument><argument><name>NewPortMappingDescription</name><direction>out</direction><relatedStateVariable>PortMappingDescription</relatedStateVariable></argument><argument><name>NewLeaseDuration</name><direction>out</direction><relatedStateVariable>PortMappingLeaseDuration</relatedStateVariable></argument></argumentList></action><action><name>GetSpecificPortMappingEntry</name><argumentList><argument><name>NewRemoteHost</name><direction>in</direction><relatedStateVariable>RemoteHost</relatedStateVariable></argument><argument><name>NewExternalPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>in</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument><argument><name>NewInternalPort</name><direction>out</direction><relatedStateVariable>InternalPort</relatedStateVariable></argument><argument><name>NewInternalClient</name><direction>out</direction><relatedStateVariable>InternalClient</relatedStateVariable></argument><argument><name>NewEnabled</name><direction>out</direction><relatedStateVariable>PortMappingEnabled</relatedStateVariable></argument><argument><name>NewPortMappingDescription</name><direction>out</direction><relatedStateVariable>PortMappingDescription</relatedStateVariable></argument><argument><name>NewLeaseDuration</name><direction>out</direction><relatedStateVariable>PortMappingLeaseDuration</relatedStateVariable></argument></argumentList></action><action><name>AddPortMapping</name><argumentList><argument><name>NewRemoteHost</name><direction>in</direction><relatedStateVariable>RemoteHost</relatedStateVariable></argument><argument><name>NewExternalPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>in</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument><argument><name>NewInternalPort</name><direction>in</direction><relatedStateVariable>InternalPort</relatedStateVariable></argument><argument><name>NewInternalClient</name><direction>in</direction><relatedStateVariable>InternalClient</relatedStateVariable></argument><argument><name>NewEnabled</name><direction>in</direction><relatedStateVariable>PortMappingEnabled</relatedStateVariable></argument><argument><name>NewPortMappingDescription</name><direction>in</direction><relatedStateVariable>PortMappingDescription</relatedStateVariable></argument><argument><name>NewLeaseDuration</name><direction>in</direction><relatedStateVariable>PortMappingLeaseDuration</relatedStateVariable></argument></argumentList></action><action><name>DeletePortMapping</name><argumentList><argument><name>NewRemoteHost</name><direction>in</direction><relatedStateVariable>RemoteHost</relatedStateVariable></argument><argument><name>NewExternalPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>in</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument></argumentList></action><action><name>GetExternalIPAddress</name><argumentList><argument><name>NewExternalIPAddress</name><direction>out</direction><relatedStateVariable>ExternalIPAddress</relatedStateVariable></argument></argumentList></action><action><name>DeletePortMappingRange</name><argumentList><argument><name>NewStartPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewEndPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>in</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument><argument><name>NewManage</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_Manage</relatedStateVariable></argument></argumentList></action><action><name>GetListOfPortMappings</name><argumentList><argument><name>NewStartPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewEndPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>in</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument><argument><name>NewManage</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_Manage</relatedStateVariable></argument><argument><name>NewNumberOfPorts</name><direction>in</direction><relatedStateVariable>PortMappingNumberOfEntries</relatedStateVariable></argument><argument><name>NewPortListing</name><direction>out</direction><relatedStateVariable>A_ARG_TYPE_PortListing</relatedStateVariable></argument></argumentList></action><action><name>AddAnyPortMapping</name><argumentList><argument><name>NewRemoteHost</name><direction>in</direction><relatedStateVariable>RemoteHost</relatedStateVariable></argument><argument><name>NewExternalPort</name><direction>in</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument><argument><name>NewProtocol</name><direction>in</direction><relatedStateVariable>PortMappingProtocol</relatedStateVariable></argument><argument><name>NewInternalPort</name><direction>in</direction><relatedStateVariable>InternalPort</relatedStateVariable></argument><argument><name>NewInternalClient</name><direction>in</direction><relatedStateVariable>InternalClient</relatedStateVariable></argument><argument><name>NewEnabled</name><direction>in</direction><relatedStateVariable>PortMappingEnabled</relatedStateVariable></argument><argument><name>NewPortMappingDescription</name><direction>in</direction><relatedStateVariable>PortMappingDescription</relatedStateVariable></argument><argument><name>NewLeaseDuration</name><direction>in</direction><relatedStateVariable>PortMappingLeaseDuration</relatedStateVariable></argument><argument><name>NewReservedPort</name><direction>out</direction><relatedStateVariable>ExternalPort</relatedStateVariable></argument></argumentList></action></actionList><serviceStateTable><stateVariable sendEvents="no"><name>ConnectionType</name><dataType>string</dataType><allowedValueList><allowedValue>Unconfigured</allowedValue><allowedValue>IP_Routed</allowedValue><allowedValue>IP_Bridged</allowedValue></allowedValueList><defaultValue>IP_Routed</defaultValue></stateVariable><stateVariable sendEvents="yes"><name>PossibleConnectionTypes</name><dataType>string</dataType></stateVariable><stateVariable sendEvents="yes"><name>ConnectionStatus</name><dataType>string</dataType><allowedValueList><allowedValue>Unconfigured</allowedValue><allowedValue>Connecting</allowedValue><allowedValue>Connected</allowedValue><allowedValue>PendingDisconnect</allowedValue><allowedValue>Disconnecting</allowedValue><allowedValue>Disconnected</allowedValue></allowedValueList></stateVariable><stateVariable sendEvents="no"><name>Uptime</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="no"><name>LastConnectionError</name><dataType>string</dataType><allowedValueList><allowedValue>ERROR_NONE</allowedValue><allowedValue>ERROR_COMMAND_ABORTED</allowedValue><allowedValue>ERROR_NOT_ENABLED_FOR_INTERNET</allowedValue><allowedValue>ERROR_USER_DISCONNECT</allowedValue><allowedValue>ERROR_ISP_DISCONNECT</allowedValue><allowedValue>ERROR_IDLE_DISCONNECT</allowedValue><allowedValue>ERROR_FORCED_DISCONNECT</allowedValue><allowedValue>ERROR_NO_CARRIER</allowedValue><allowedValue>ERROR_IP_CONFIGURATION</allowedValue><allowedValue>ERROR_UNKNOWN</allowedValue></allowedValueList></stateVariable><stateVariable sendEvents="no"><name>RSIPAvailable</name><dataType>boolean</dataType></stateVariable><stateVariable sendEvents="no"><name>NATEnabled</name><dataType>boolean</dataType></stateVariable><stateVariable sendEvents="yes"><name>ExternalIPAddress</name><dataType>string</dataType></stateVariable><stateVariable sendEvents="yes"><name>PortMappingNumberOfEntries</name><dataType>ui2</dataType></stateVariable><stateVariable sendEvents="no"><name>PortMappingEnabled</name><dataType>boolean</dataType></stateVariable><stateVariable sendEvents="no"><name>PortMappingLeaseDuration</name><dataType>ui4</dataType><allowedValueRange><minimum>0</minimum><maximum>604800</maximum></allowedValueRange><defaultValue>3600</defaultValue></stateVariable><stateVariable sendEvents="no"><name>RemoteHost</name><dataType>string</dataType></stateVariable><stateVariable sendEvents="no"><name>ExternalPort</name><dataType>ui2</dataType></stateVariable><stateVariable sendEvents="no"><name>InternalPort</name><dataType>ui2</dataType><allowedValueRange><minimum>1</minimum><maximum>65535</maximum></allowedValueRange></stateVariable><stateVariable sendEvents="no"><name>PortMappingProtocol</name><dataType>string</dataType><allowedValueList><allowedValue>TCP</allowedValue><allowedValue>UDP</allowedValue></allowedValueList></stateVariable><stateVariable sendEvents="no"><name>InternalClient</name><dataType>string</dataType></stateVariable><stateVariable sendEvents="no"><name>PortMappingDescription</name><dataType>string</dataType></stateVariable><stateVariable sendEvents="yes"><name>SystemUpdateID</name><dataType>ui4</dataType></stateVariable><stateVariable sendEvents="no"><name>A_ARG_TYPE_Manage</name><dataType>boolean</dataType></stateVariable><stateVariable sendEvents="no"><name>A_ARG_TYPE_PortListing</name><dataType>string</dataType></stateVariable></serviceStateTable></scpd>'
2024-10-17 12:20:47.107 DEBUG (MainThread) [async_upnp_client.aiohttp] New source for UpnpNotifyServer: ('192.168.5.3', 40665)
2024-10-17 12:20:47.108 DEBUG (MainThread) [homeassistant.components.upnp] Started event handler at http://192.168.5.3:40665/notify
2024-10-17 12:20:47.108 DEBUG (MainThread) [async_upnp_client.profiles.profile] Subscribing to service: <UpnpService(urn:upnp-org:serviceId:Layer3Forwarding1, uuid:3d6576f7-21e3-414f-853d-d51d3f0445fd)>
2024-10-17 12:20:47.109 DEBUG (MainThread) [async_upnp_client.event_handler] Subscribing to: <UpnpService(urn:upnp-org:serviceId:Layer3Forwarding1, uuid:3d6576f7-21e3-414f-853d-d51d3f0445fd)>, callback URL: http://192.168.5.3:40665/notify
2024-10-17 12:20:47.109 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Sending request:
SUBSCRIBE http://192.168.5.1:5000/JXyaKhg/evt/L3F
NT: upnp:event
TIMEOUT: Second-540
HOST: 192.168.5.1:5000
CALLBACK: <http://192.168.5.3:40665/notify>


2024-10-17 12:20:47.112 DEBUG (MainThread) [async_upnp_client.traffic.upnp] Got response from SUBSCRIBE http://192.168.5.1:5000/JXyaKhg/evt/L3F:
412
Content-Type: text/xml; charset="utf-8"
Connection: close
Content-Length: 0
Server: Homeware UPnP/1.1
Ext: 
Date: Thu, 17 Oct 2024 01:20:46 GMT

b''
2024-10-17 12:20:47.113 DEBUG (MainThread) [async_upnp_client.event_handler] Did not receive 200, but 412
2024-10-17 12:20:47.113 INFO (MainThread) [async_upnp_client.profiles.profile] Device rejected subscription request: UpnpResponseError('Did not receive HTTP 200 but 412')
2024-10-17 12:20:47.114 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Technicolor CobraXh (2320JC56A) for upnp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 96, in async_setup_entry
    await device.async_subscribe_services()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 208, in async_subscribe_services
    await self._igd_device.async_subscribe_services(auto_resubscribe=True)
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/profiles/profile.py", line 355, in async_subscribe_services
    new_sid, timeout = await self._event_handler.async_subscribe(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/event_handler.py", line 208, in async_subscribe
    raise UpnpResponseError(
async_upnp_client.exceptions.UpnpResponseError: Did not receive HTTP 200 but 412

tathamoddie avatar Oct 17 '24 02:10 tathamoddie

Thank you @tathamoddie. This confirms that is should be fixed with #127006.

StevenLooman avatar Oct 18 '24 19:10 StevenLooman

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.