Skip to content

Python and integration reference

django-micboard is a reusable Django app. Its stable integration surface is the typed service layer, management commands, model managers, and authenticated WebSocket consumer. A general REST API is not shipped yet; see HTTP endpoints for current status.

Hardware queries

Use the models’ user-scoped managers instead of exposing an unscoped queryset:

from micboard.models.hardware.wireless_chassis import WirelessChassis
from micboard.models.hardware.wireless_unit import WirelessUnit
active_chassis = WirelessChassis.objects.for_user(user=request.user).filter(
status__in=("online", "degraded", "provisioning"),
)
active_units = WirelessUnit.objects.for_user(user=request.user).filter(
status__in=("online", "degraded", "provisioning"),
)

Never trust tenant IDs supplied by clients; derive access from the authenticated user.

Performer assignments

Assignment writes go through the service so object scope and role checks stay centralized:

from micboard.services.core.performer_assignment import PerformerAssignmentService
from micboard.services.core.performer_assignment_dtos import CreatePerformerAssignment
assignment = PerformerAssignmentService.create_assignment(
command=CreatePerformerAssignment(
performer_id=performer.id,
unit_id=wireless_unit.id,
group_id=monitoring_group.id,
alert_on_battery_low=True,
),
user=request.user,
)

Manufacturer integrations

Build a plugin bound to a persisted manufacturer:

from micboard.services.common.base.plugin import build_manufacturer_plugin
plugin = build_manufacturer_plugin(manufacturer)
devices = plugin.get_devices()

The Shure HTTP client is also available for integration-specific operations:

from micboard.integrations.shure.client import ShureSystemAPIClient
client = ShureSystemAPIClient()
devices = client.devices.get_devices()
health = client.check_health()

WebSocket updates

The browser WebSocket endpoint is /ws and requires authentication. Configure the host ASGI application with AllowedHostsOriginValidator around AuthMiddlewareStack; see the real-time guide.

Management commands

Poll a manufacturer once:

Terminal window
uv run --no-sync python manage.py poll_devices --manufacturer shure

Add --async to enqueue the poll through native Huey. Inspect command-specific options without running work:

Terminal window
uv run --no-sync python manage.py poll_devices --help
uv run --no-sync python manage.py diagnostic_api_health_check --help

Rate limiting

External manufacturer calls use the shared rate limiter and retry infrastructure. See the integration reference.