I’m trying to make my home assistant accessible from the internet so I can use Google Home for control with the Google Assistant component. I’m assuming the best way to configure the router to forward traffic to my instance is the UPnP component. However, when I put it in the config and restart, I get an error in the log. I’m running HA inside docker, which is inside a VirtualBox Ubuntu server. Any help would be appreciated.
Here is the relevant part of the config:
upnp:
local_ip: 192.168.0.39
ports:
hass: 8000
And here is the error I’m getting:
Log Details (ERROR)
Sat Jun 02 2018 21:30:46 GMT+1000 (Australian Eastern Standard Time)
Error during setup of component upnp
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 143, in _async_setup_component
hass, processed_config)
File "/usr/lib/python3.6/site-packages/homeassistant/components/upnp.py", line 116, in async_setup
await service.add_port_mapping(internal, external, host, 'TCP',
AttributeError: 'BaseService' object has no attribute 'add_port_mapping'
The server is bridged. If I use “ifconfig” it shows the expected IP address in my LAN (although hassio is there with a different range - 172… instead of 168… - could that be docker doing magic?). I’m using the latest version of HA - 0.70.1
It’s a Netgear D6200 DSL modem/router. The router already has a couple of UPnP entries for other ports (probably set up years ago). Full disclosure - I’m also having problems with the Netgear component timing out, although it does find some attached devices. The error message does sound “bug-like” - I don’t know Python but in the languages I do know, it would be a bad thing to expect an object to call ‘add_port_mapping’ if it doesn’t implement it. Having said that, I’m new to everything in this field, so it’s probably my fault.
Well I think I might know the problem, but will need to walk you through some tests in order to pin point and find a possible solution. Can you find me on Discord ? I use the same handle (@dgomes)
You’re right, my modem is configured as PPPoE - it seems freaky you can deduce that from the error. If the world has moved beyond PPP, nobody told Australia - my street has to wait another 2 years for the next substandard upgrade. At least the top two ISPs here use PPP, so the implication is nobody in Australia on DSL has the UPnP component working (really?). I’m not going to get the chance to look at this until next weekend. I will try the clone&test then, and contact you on Discord. In the meantime, do you think I should raise a defect?
I have run msearch.py, although I’m not sure how to get it off the box in text format, so I took a screen shot. One thing that stands out is 192.168.0.5, which is my v1.0 Philips Hue hub. If I turn the hub off it seems to crash earlier - the first DEBUG line comes out but not the second, and then an exception occurs at line 40, 'NoneType' object has no attribute 'src_ip'.
I also probably ran it the hardest way - I used pip install to get the package and then wget to get the raw version of msearch.py.
I really need you to use the version from my git repository and not the version from pip … I already did some changes there that have not been pushed upstream.
Ah yes, that was my intention, so I must be doing it wrongly. I did pip3 install --upgrade git+https://github.com/dgomes/pyupnp-async/ and then wget to get the raw msearch.py.
After some Googling, I used -e instead of --upgrade and added #egg=pyupnp_async which gave me a local copy. I then went to the directory and did python3 setup.py install, which all seemed to go ok. On rerunning I got the error below. Note there are two errors - the first seems to happen occasionally (no attribute src_ip). The second shows the source is the local copy of your version, so hopefully I got it right this time. Learning all the time! BTW I had a quick look at Discord, and it did my head in. How about email instead? Although being in different parts of the world, carrier pigeon might be just as quick. Also, why is it looking at the hub for the lights, rather than the router? My router is at 192.168.0.1.
this will download all the code without any need to install anything system wide. I would go one step further and remove existing pyupnp-async installs:
# pip uninstall pyupnp-async
Afterwards just run all the stuff from inside the pyupnp_async directory you downloaded using git.
I find very strange that only the Hue light shows up… can you disconnect the Hue hub temporarily and run msearch ?
Lets keep the pigeon exchange here, hoping to find someone else in a closer timezone
Hey, Did you guys ever managed to work this out?
I’m using a Netgear R8000 and connected over PPPoE to the internet.
I’ve added this to my configs (with the right numbers of course):
Error setting up entry R8000 (Gateway) for upnp
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/config_entries.py", line 236, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/upnp/__init__.py", line 113, in async_setup_entry
device = await Device.async_create_device(hass, ssdp_description)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/upnp/device.py", line 36, in async_create_device
upnp_device = await factory.async_create_device(ssdp_description)
File "/usr/local/lib/python3.6/site-packages/async_upnp_client/__init__.py", line 848, in async_create_device
service = await self.async_create_service(service_desc_xml, description_url)
File "/usr/local/lib/python3.6/site-packages/async_upnp_client/__init__.py", line 875, in async_create_service
return self.create_service(service_description_xml, scpd_xml)
File "/usr/local/lib/python3.6/site-packages/async_upnp_client/__init__.py", line 882, in create_service
state_vars = self.create_state_variables(scpd_xml)
File "/usr/local/lib/python3.6/site-packages/async_upnp_client/__init__.py", line 902, in create_state_variables
state_var = self.create_state_variable(state_var_xml)
File "/usr/local/lib/python3.6/site-packages/async_upnp_client/__init__.py", line 908, in create_state_variable
state_variable_info = self._state_variable_parse_xml(state_variable_xml)
File "/usr/local/lib/python3.6/site-packages/async_upnp_client/__init__.py", line 927, in _state_variable_parse_xml
state_variable_xml.find('service:sendEventsAttribute', NS).text == 'yes'
AttributeError: 'NoneType' object has no attribute 'text'
Is this the same problem?
I’m going to fall back to my original static port forward, but I would so love to have these handled by upnp. Please let me know if you need any testing, I’ll try my best.