ha-glinet4-integration
A HomeAssistant custom component for GL-inet routers that uses their API version 4.
Working - in alpha, breaking changes very likely.
Contributions are welcome, for ideas see the TODO list below or the various #TODO
s in the code.
Features
- Device tracker for devices connected directly or indirectly to a Gl-inet router.
- Note, modern phones use MAC address randomisation when they connect to WiFi, you will need to disable this for your home wifi only on android and iphone
- Control all configured wireguard clients with a switch.
Installation
- Create a new folder in
config/custom_components
called glinet
- Copy manually, or clone the files in this repo into that folder
git clone https://github.com/HarvsG/ha-glinet4-integration.git .
(The .
at the end is important)
- Reboot homeassistant
- Add the new Glinet integration under Devices and services
- Edit the host path with you router IP - ensure you keep the
http://
- Add your router admin page login password (not your WIFI password). Placeholder is GL-inet's default
goodlife
, but this should be changed.
Dev set up
- Set up the vscode homeassistant core dev setup
- Or you could just use a running install of homeassistant (restarts are required for a lot of changes)
- Run once to generate directories
- create a
config/custom_components/glinet
directory
git clone https://github.com/HarvsG/ha-glinet4-integration.git .
- Note, the vscode git tracker will track the parent repo (ha core), but command line git will still work within the
glinet
dir
- You may need to config a new ssh key inside the container. Use this - this will be overwitten if you rebuild the container
TODO
- [ ] Auto detect router IP for config flow - assume it is the default gateway, test an enpoint that doesn't require auth (/model or /hello), fallback to default
192.168.8.1
- [ ] Add switches for wireguard and open vpn (client and server), done for wireguard client, but we can probably do all programatically rather than repeating boilerplate
- worth considering you can have multiple clients, most of the API endpoints act on the last used client config. Can we get a list from the API and create switches for all? Maybe (router/vpn/status?)
- [ ] Support HACS - lets get some more features working first
- [ ] Allow deletion of unhelpful device tracker devices/entities, docs, example
- [ ] Clean, comment and refactor code
- [ ] Add tests - will need to mock the API
- [ ] Allow reconfig for password changes - currently have to delete and re-add integration
- [ ] Look into using
https
instead of http
- [ ] Add features:
- Upload/Download sensors
- Internet reachable sensors (remember that API timesout when internet not reachable)
- Public IP sensor
- Diagnostic sensors for stats in (/router/status) such as uptime, LAN IP and memory useage
- [ ] Consider features
Tested on
- Beryl MT3000
- Convexa B1300
Depends on
https://github.com/HarvsG/gli4py