A aysnc python 3 API wrapper for GL-inet routers with version 4 firmware. [WIP]
GL-inet routers are built on OpenWRT. They are highly customizeable but have an attractive user interface.
As part of their modiification of the UI they used to provide a documented locally accessible API.
I thought it would be handy to develop a python 3 wrapper for the API for easy intergation into other services such as HomeAssistant
pip3 install gli-py
- Clone the repo
- Ensure you have python 3.11 or greater installed
python3 -V
orpython -V
- Uses poetry for venv control
pip3 install poetry
poetry config virtualenvs.in-project true
create the venvs in the project folderpoetry install
poetry shell
- To run tests, ensure there is a file called
router_pwd
in the root directory with the router password in. - Then run
pytest -s
to see responses, assumes the router is at192.168.0.1
- Set token with
poetry config pypi-token.pypi TOKEN
- publish with
poetry publish --build
- Clone the repo into the vscode
/workspaces/
dir - The inside the
ha-env
terminal run(ha-venv) vscode ➜ /workspaces/core (branch-name) $ pip install -e /workspaces/gli4py
- Ensure the custom component has
"python.analysis.extraPaths": ["/workspaces/gli4py/"]
in.vscode/settings.json
- deactivate the
ha-env
withdeactivate
- Do steps 3 onwards above
Todo list:
- Decide on useful endpoints to expose - see https://github.com/HarvsG/ha-glinet-integration#todo
- Expose said endpoints
- Write remaining
- Package correctly
- Test that dev enviroment is re-producable
- Publish on pip
- Static typing