Gogogate2 Hub additional features/script

This is my first post here, but looking for some guidance.

I’ve reverse engineered the site for my Gogogate2 hub and found some urls that could be sensors or switches in Home assistant.

Sensors:

  • Hub light status = /isg/light.php?op=refresh (returns 0 for off, 1 for on)
  • Temperature and battery of each door (same api call as battery) = /isg/temperature.php?door=x (where x= door number, i.e 1, 2, etc.) (returns this: [“13447”,“80”]… where 13447=13.4 degrees C, and 80=80% battery remaining)

Switches:

  • Hub light on/off = /isg/light.php?op=activate&light=x (where x = 0 for on, 1 for off)

My main issue is logging in to the webpage. I was able to do this in python using twill; however haven’t been able to using curl yet. It is not using basic authentication so can’t be done by adding the user and password to the url or the -u parameter.

These are the forms shown from twill in python.
image

So I could execute something in python using the following.

#modify the following lines
login = 'admin'
password = 'yourpassword'
ip = '192.168.1.x'

from twill.commands import *
url_a = 'http://' + ip
go(url_a)
fv("2", "login", login)
fv("2", "pass", password)
submit()

url_b = '/isg/light.php?op=refresh'
go(url_a + url_b)

What is the preferred way to get this into home assistant? I assume using curl, but maybe there are other methods I am not aware of as I’m fairly new to home assistant. From my understand the python scripts integration won’t work as it doesn’t support imports (at least from what I’ve read on this forum).

And how can I accomplish the login to the site using curl or whatever is the preferred method?