Get Started#
Sensor Manager discovers USB and ONVIF network cameras and exposes them through a REST API.
Prerequisites#
See System Requirements.
Run with Docker Compose#
Go to the component directory:
cd edge-ai-libraries/microservices/sensor-manager
Build the image and start the service (
.envis created from.env.exampleon first run):make build run
List the discovered cameras:
curl http://localhost:8090/api/v1/sensorsLoad the ONVIF profiles of a network camera:
curl -X POST http://localhost:8090/api/v1/sensors/network-camera-192.168.1.100-80/profiles \ -H "Content-Type: application/json" \ -d '{"username": "<user>", "password": "<password>"}'
Caution
Avoid putting real passwords in your shell history. For example, read them from a file or an environment variable.
Stop the service:
make stop
Configuration#
Variable |
Default |
Description |
|---|---|---|
|
|
Bind address of the HTTP server |
|
|
HTTP port |
|
|
Enable the periodic WS-Discovery sweep |
|
|
Seconds between discovery sweeps (minimum 1) |
|
|
Python log level |
|
|
Host GID of the |
Networking and Security Notes#
ONVIF WS-Discovery sends a UDP multicast probe to
239.255.255.250:3702and receives unicast replies, which do not pass Docker’s bridge NAT. The container therefore usesnetwork_mode: host, so the API is reachable on all host interfaces onSENSOR_MANAGER_PORT. The API has no authentication: restrict access with a firewall, or setSENSOR_MANAGER_HOSTto a specific address.Containers on a bridge network reach the service through the host gateway, for example with
extra_hosts: ["host.docker.internal:host-gateway"]andhttp://host.docker.internal:8090./devis mounted read-only. Access to V4L2 (c 81:*) and USB (c 189:*) character devices is granted withdevice_cgroup_rules. The container runs as a non-root user with a read-only root filesystem and all capabilities dropped.