Aephir / HomeAssistant2

Second version of homeassistant, now running on Raspbian Stretch Lite (RPi3)
0 stars 0 forks source link

Can I log in and change router settings from home assistant? Or at least from the RPi? #7

Closed Aephir closed 6 years ago

Aephir commented 6 years ago

To update my certificates, I need to forward port 443 to 443 on my RPi. To use home assistant, I need to forward port 443 to port 8123 on my RPi.

Is there a way to make a script that can log in to router from RPi running home assistant and change to port forwarding, then run the certbot to update let's encrypt certificates, and when this is done, change the port forwards back?

Aephir commented 6 years ago

I've asked about this here: https://unix.stackexchange.com/questions/418675/change-router-port-forwarding-remotely-via-terminal-script

Aephir commented 6 years ago

I tried a modified python script (from here): https://www.gniibe.org/memo/system/dynamic-ip/upnp.html

But even after

sudo apt-get install python-gupnp-igd 
sudo apt-get install libglib2.0-dev

I still get an error loading gupnp.igd

import gupnp.igd 
  ImportError: could not import gobject (error was: 'No module named gobject')

Why??

EDIT: gupnp is GUI based, I need something to use from CLI.

Aephir commented 6 years ago

See: https://gist.github.com/jkiddo/d5ee6e5395cd22891ea286ec1494db37 Can I modify this to change port forwardings? It logs in to the exact same router as I have, so maybe?

Aephir commented 6 years ago

Try making this work: https://github.com/Aephir/Miscellaneous/blob/master/443_port_sagemcom.sh

Not sure what to do.

Aephir commented 6 years ago

This was to update certificates. I have installed nginx, and serve home assistant through that. So I just made a script to stop nginx, update certificates and start nginx when the certificates are less than 15 from expiring.