[Custom Integration] GL-inet routers

Still in alpha but I have implemented device tracking and the ability to toggle a WireGuard client.

Help with development would very much be welcome, there is plently to do for all levels of coder and lots of #TODO ideas marked in the code and the README.md

1 Like

After connecting to my router I get a success message ( Created configuration for GL-inet Ax1800. ).
However the integration instantly states “Failed to set up”. Firmware is v4.1.0


2023-09-24 00:43:48.635 ERROR (MainThread) [custom_components.glinet.router] Response from http://192.168.86.1 to request wireguard_client_list is of type <class 'list'>, Response: []
2023-09-24 00:43:48.662 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry GL-inet Ax1800 for glinet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/glinet/__init__.py", line 53, in async_setup_entry
await router.setup()
File "/config/custom_components/glinet/router.py", line 148, in setup
await self.update_all()
File "/config/custom_components/glinet/router.py", line 200, in update_all
await self.update_wireguard_client_state()
File "/config/custom_components/glinet/router.py", line 322, in update_wireguard_client_state
self._wireguard_clients[response["peer_id"]].connected = (response["status"] == 1)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 0

Version 4 firmware requires a different version:

That’s the version I’m using:

Logger: homeassistant.config_entries
Source: custom_components/glinet/router.py:322
Integration: GL-inet
First occurred: 17:15:18 (1 occurrences)
Last logged: 17:15:18

Error setting up entry GL-inet Ax1800 for glinet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/glinet/__init__.py", line 53, in async_setup_entry
    await router.setup()
  File "/config/custom_components/glinet/router.py", line 148, in setup
    await self.update_all()
  File "/config/custom_components/glinet/router.py", line 200, in update_all
    await self.update_wireguard_client_state()
  File "/config/custom_components/glinet/router.py", line 322, in update_wireguard_client_state
    self._wireguard_clients[response["peer_id"]].connected = (response["status"] == 1)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 0

Does any functionality work? Or does the whole component fail to load?

The whole integration fails to load:

Click the 3 icons and then reload

It instantly goes back to the pictured state, are there any logs I can provide?

The logs you provided looks like bad code written by me, I need to allow for a case where there are no wireguard configs.

~A quick workaround might be to set up a fake a wireguard peer on your device~

If made a quick edit, test the latest version

Here’s the log after enabling WireGuard and setting up a profile:

2023-10-12 18:34:51.043 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry GL-inet Ax1800 for glinet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/glinet/__init__.py", line 53, in async_setup_entry
await router.setup()
File "/config/custom_components/glinet/router.py", line 148, in setup
await self.update_all()
File "/config/custom_components/glinet/router.py", line 200, in update_all
await self.update_wireguard_client_state()
File "/config/custom_components/glinet/router.py", line 322, in update_wireguard_client_state
if self._wireguard_clients[response["peer_id"]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 0

I’ve updated the code and restarted HA + router, I’ve also connected a phone to the Wireguard instance successfully.

Hello and good day,
I have the same router model and wanted to ask if you have successfully integrated it into Home Assistant?
If so, could you explain to me how you did it?
Thank you very much for your effor

Just wanted to throw my support behind this project, thanks for all the work so far! Been following this for a few months. I’ve got the Spitz AX3000 running 2 SIMs living full time vanlife, and I’d love to use this integration to the fullest.

I’m a 10 year full stack engineer, just don’t have time to learn Python to get involved early stages, but I’m happy to help test and do grunt work to further the API coverage once prior art and consistent functionality is established.

FWIW, personally no need for the VPN / Wireguard stuff, would love to be able to show/select bands, Network level (LTE/5G NA/NSA), RSSI, signal strength etc., as well as network selection, SIM switching and a list of connected devices. That’d be awesome!

1 Like

Hello, I have had the Gl.Inet AX1800 router for two weeks now, I am trying to connect it with HA without success. The IP of the router is 192.168.1.1 (I enter its configuration via the web) and the password is the one to access this website. But it still doesn’t give me this error every time.
Can anybody help me?
Thank you.

Please don’t hijack this thread for support queries. Raise an issue on the GitHub page. When you do please include errors in the logs (found under Settings → systems → logs)