Best way to develop an integration for Gl-inet routers?

I have a router made by Gl-inet. Their routers run a modified version of OpenWRT. As part of their modification they have a very full featured API, everything from client lists to VPN status. It even accepts POSTS to change many states.

  • VPN control (OVPN, WG, ShadowSocks)
  • LTE Modem control incl SMS
  • Client lists
  • Firewall and port forwarding
  • Public IP
  • BLE controller

I am thinking about developing an integration for these routers. However I’m not sure where to start. One could certainly use it for presence detection as a start.

What class of device would it be? Local polling? Or best to build several separate integrations for the different functions?

There is no python library for the API - should I start there?

Can anyone point me in the direction of an integration that has done something similar so I can know where to start?


Yes, good start :slight_smile: But of course you could use the rest integrations.

Started building an API wrapper: GitHub - HarvsG/gli_py: A python 3 API wrapper for GL-inet routers. [WIP]
Is this the sort of thing that would make an integration easier to build?

Depends on your final goal, if you want to push your integration into core home assistant, pypi based python library is a must. If you are fine to stick with hacs, you can embed the api into integration. I am lazy and usually going with second approach.

Regarding multiple entities vs multiple integrations, you can go with one integration and multiple sensors/entities and users can always disable the ones they don’t need.

1 Like

Has proved very easy to knock together a python package, wI will release it on to pypi soon. Then will start work on a precense detection integration.

Would do a raft of sensors/binary sensors as well. And even some switches. The routers support reboot and VPN on/off over the API.

1 Like

Hi HarvsG
Great stuff - I have a small island in the Bahamas and I use the GliNet 750v2 as a failure internet device. I love the GliNet devices - they are great! Would love to be able to send sms from it, as it is presently my failover of my ptp net connection to the mainland (main island). Would love to test it out as I leave for the island on Thursday and will be there for 4 weeks.


Sounds awful…

Please post when there is something we can test for this. Very interested.

I have released a pypi package that exposes the API: GitHub is here: GitHub - HarvsG/gli_py: A python 3 API wrapper for GL-inet routers. [WIP]

Feel free to play around with the package pip install gli_py . I’ve not documented the API functions yet but you can see them here: gli_py/ at 3d554a56fe2e06ace74ad440b7eef02d0fdb859f · HarvsG/gli_py · GitHub

Assuming you have python 3.8 get started with from gli_py import GLinet my_router = GLinet("YOUR_ROUTER_PASSWORD", base_url="")

@wreuvers I would appreciate any errors you get with the SMS functions, my router doesn’t have a modem at the moment so I haven’t been able to test it.

With regards to building an integration it is a bit more of an unknown for me. I need to get a dev environment set up. I’m trying to work out how much code I can just lift from

Will be developing the integration here: GitHub - HarvsG/ha-glinet-intergration: staging repo for an GL-inet intergration for homeassistant

1 Like