Metadata-Version: 2.1
Name: hubaxle
Version: 0.1.8
Summary: Control interface for the GL Hub
License: MIT
Author: Groundlight
Author-email: info@groundlight.ai
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: django (>=5.0.10,<6.0.0)
Requires-Dist: djangorestframework (>=3.15.1,<4.0.0)
Requires-Dist: drf-spectacular (>=0.27.1,<0.28.0)
Requires-Dist: framegrab (>=0.6.2,<0.7.0)
Requires-Dist: groundlight (>=0.15.0,<0.16.0)
Requires-Dist: numpy (==1.26.4)
Requires-Dist: onvif-zeep (>=0.2.12,<0.3.0)
Requires-Dist: opencv-python (==4.9.0.80)
Requires-Dist: psutil (>=5.9.8,<6.0.0)
Requires-Dist: pytest (>=8.0.2,<9.0.0)
Requires-Dist: pytest-django (>=4.8.0,<5.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: typer (>=0.9.0,<0.10.0)
Requires-Dist: wsdiscovery (>=2.0.0,<3.0.0)
Description-Content-Type: text/markdown

# HubAxle - control interface for the GL Hub

Exposes an HTTP API for controlling the GL Hub.

There are several primary functions:

- Update the configuration files which the GL Runtime is consuming
- Monitor status of the GL Runtime
- Discover and set up cameras that are accessible to the hub

# Command-line tools

- `poetry run discover-cameras` - discover cameras on the local network
- `poetry run launch-service` - start the hubaxle service


# Using it.

1. Set up a user by setting the `HUB_LOGINS` env var to `username:password`
   Either do this through the balena dashboard, or by running
```
docker compose up -e HUB_LOGINS="username:password" hubaxle
```

2. Open the port on the hubaxle container.  (port 8000 inside the container, port 80 on the host)

3. Open `/admin/` page, and authenticate with your login

4. Create a config entry called `runtime.yaml`
5. Watch as the glruntime container does what you tell it to!

## Testing

```
poetry run pytest
```

## Development:

If it's awkward to set the `HUB_LOGINS` env var, you can also run

```
./src/manage.py createsuperuser
```

from the hubaxle container, and then you can log in with the credentials you set.

### API Development
Using DRF-spectacular, we completely auto-generate the Open-api spec and then in turn use that to autogenerate a client library using Openapi-generator. We then provide a thin wrapper around the client library to make it easier to use.

To generate the api-spec and the client library, inside the src directory run:

```
make generate-api
```

A couple of notes:
- This means that schema.yaml should NEVER be manually edited.
- Inside the autogenerated client library, we generate classes with the exact same name as the the Django models, and, by default, the exact same fields. Note this if there are any fields that you want to keep private.
However, this model provides increased clarity, the data that you send in as a request maps extremely directly onto the model that the backend deals with


