Vigiora

Deze pagina is nog niet beschikbaar in het Nederlands. Hij wordt in het Engels getoond.

Network toolsSinds 1.6.7

Scan the server's local network, find the current IP of a MAC address, and move a camera to its new address — over API v1 or from an AI agent.

From version 1.6.7 (API 1.5.0), a self-hosted Vigiora server can look at its own local network for you. Routers hand out addresses with DHCP, so a camera's IP can change after a power cut; its MAC address does not. The network tools use that:

  • Scan the server's private subnets for devices, open camera ports and ONVIF cameras.
  • List the devices found, with their maker and whether a Vigiora camera already uses them.
  • Look up the current IP of a MAC address (or the MAC of an IP).
  • Relocate a camera to the address its MAC has now.

Vigiora already does the last step by itself for cameras on its network (see Fixed IPs and rediscovery). The tools let a script or an AI agent do it on request, and help you find a camera before you add it.

What the tools do#

OperationWhat it does
POST /api/v1/network/actions/scanStarts a scan and answers 202 with the scan to poll.
GET /api/v1/network/scans/{scan_id}The scan's status, progress and the devices found so far.
GET /api/v1/network/devicesThe latest known devices, with filters. Sends no traffic.
GET /api/v1/network/lookup?mac=The current IP of a MAC address. ?ip= gives the MAC of an IP.
POST /api/v1/cameras/{camera_id}/actions/relocateMoves a camera to its MAC's current address. dry_run only reports.

Scans#

A scan checks the private subnets the server is directly connected to:

  • Every host gets one TCP connection, so the server's neighbour (ARP) table learns its MAC.
  • Live hosts are checked on an allowlist of camera ports: 80, 443, 554, 8000, 8080, 8899, 9000 (from 1.6.8, Reolink), 34567 and 37777. Other ports are refused.
  • With onvif (on by default), the server sends an ONVIF WS-Discovery probe by multicast, and by unicast to hosts with an open port, because many networks don't deliver multicast replies. A camera with ONVIF turned off doesn't answer, so onvif is false for it.
  • With resolve_names: true (off by default), it looks up reverse DNS names. This sends the LAN's addresses to the server's DNS resolver.

From version 1.6.8 the server also scans by itself, every hour by default, to find new cameras: see Automatic camera discovery and the auto-scan operations in API v1. Those scans follow the same rules.

Only one scan runs at a time, and it ends within about 60 seconds. A scan covers at most 1,022 hosts (a /22). When that leaves subnets out, the scan reports truncated: true and lists them in skipped_subnets; scan one of them with subnet. The last 10 scans are kept in memory until the server restarts.

Devices#

Each device has:

FieldMeaning
ip, macThe address and the MAC (lower case, aa:bb:cc:dd:ee:ff).
vendorThe maker's short name (Hikvision, EZVIZ, Dahua, Reolink…), from the MAC prefix in the IEEE public registry built into the server. null for unregistered prefixes and randomised MACs.
hostnameThe reverse DNS name, only when the scan asked for it.
open_portsThe allowlisted ports that answered.
onvif, onvif_urlWhether the device answered the ONVIF probe, and its device service URL.
known_camera_idThe Vigiora camera that uses this device, if you may view it.
is_known_cameraA Vigiora camera uses the device, visible to you or not.
is_selfThe server itself.

Filter the list with vendor (contains the text), has_port (one allowlisted port) and unassigned (true: devices no camera uses).

Lookups#

?mac= accepts aa:bb:cc:dd:ee:ff, AA-BB-CC-DD-EE-FF, aabb.ccdd.eeff or aabbccddeeff. The server first checks its neighbour table, and uses the entry only if the host still answers (source: neighbor). Otherwise it sweeps the connected subnets in small chunks and stops as soon as the MAC answers (source: sweep, up to about 20 seconds). A MAC that nothing has is 404 not_found.

Scopes and safety#

The tools need the network:read scope, and the user must be an admin or operator. Relocating a camera needs cameras:write and operator permission on the camera instead.

  • Not read only. network:read reads, but a scan or a lookup sends traffic on your LAN. So legacy read-only keys and the OAuth Read only access never get it. Read and control does. Viewers' keys can't hold it.
  • Private subnets only. Only RFC 1918 subnets on a physical interface of the server are probed (never public, CGNAT or link-local ranges), at most a /22 per scan, and only on the allowlisted ports.
  • Camera following comes first. While Vigiora's automatic camera following uses the network, scans and lookup sweeps answer 503 network_busy with Retry-After. Lookup sweeps also share a budget of 4 per 10 minutes per server (details.reason: lookup_budget). A lookup answered from the neighbour table doesn't count.
  • Rate limits. At most 2 scans and 30 lookups a minute per credential (a relocate counts as a lookup), on top of the usual request limit. Over it: 429 rate_limited.
  • One scan at a time. A second scan while one runs is 409 scan_in_progress, with the running scan's id in details.scan_id.

Relocate is careful#

A relocate moves the camera only when everything checks out. It is refused with 409 conflict and a details.reason:

details.reasonWhy
old_address_aliveSomething still answers at the camera's current address, so the camera hasn't moved.
mac_mismatchThe new address doesn't answer with the camera's MAC when poked right before the login check. No login is sent.
verify_failedThe device at the new address didn't accept the camera's stored login, or accepted a wrong password.
device_not_foundNo device with the camera's MAC answers on its subnet.
ambiguous, shared_mac, ip_in_useSeveral addresses match, another camera uses the same MAC (an NVR or a bridge), or another camera already uses the new address.
no_hardware_id, not_lan_cameraVigiora hasn't learned the camera's MAC yet, or the camera isn't on the server's network.

Before the switch, the device at the new address must refuse a wrong password and accept the stored one (RTSP Digest), so the camera's password only goes to the right camera. A dry_run runs the address checks and sends no login at all. The camera then moves the same way as with automatic following: live view and recording follow, the change is logged, and a camera.moved event is sent.

Examples with curl#

Set your server address and a key with network:read (and cameras:write for relocating):

Terminal
BASE="https://yourname.vigiora.com"
H=(-H "Authorization: Bearer $VIGIORA_API_KEY")

Scan the network#

Terminal
curl -s -X POST "$BASE/api/v1/network/actions/scan" "${H[@]}" \
  -H "Content-Type: application/json" \
  -d '{"subnet":"192.168.1.0/24","ports":[80,554,8000],"onvif":true}'

All fields are optional: without a body, the server scans every connected subnet on every allowlisted port. The answer is 202 with the scan (shortened here):

{ "id": "scan_5d0c2e9a71b4f38e", "status": "running", "phase": "sweep", "progress": 0, "subnets": ["192.168.1.0/24"], "truncated": false, "skipped_subnets": [], "device_count": 0, "devices": [] }

Poll the scan#

Terminal
curl -s "$BASE/api/v1/network/scans/scan_5d0c2e9a71b4f38e" "${H[@]}" | jq '{status, progress, truncated, device_count}'

status goes from running to done (or failed, with error, keeping what it found).

List devices#

Terminal
# Hikvision devices with RTSP open that no camera uses yet
curl -s "$BASE/api/v1/network/devices?vendor=hikvision&has_port=554&unassigned=true" "${H[@]}" \
  | jq '.data[] | {ip, mac, vendor, open_ports, onvif}'

Look up a MAC#

Terminal
curl -s "$BASE/api/v1/network/lookup?mac=08:cc:81:4a:1f:02" "${H[@]}"
{ "mac": "08:cc:81:4a:1f:02", "ip": "192.168.1.38", "found": true, "source": "sweep", "checked_at": "2026-11-01T06:12:09Z", "other_ips": [], "known_camera_id": 81, "is_known_camera": true }

?ip=192.168.1.38 does the reverse. Use the Retry-After header when the answer is 503 network_busy.

Relocate a camera#

Terminal
curl -s -X POST "$BASE/api/v1/cameras/81/actions/relocate" "${H[@]}" \
  -H "Idempotency-Key: $(uuidgen)" -H "Content-Type: application/json" -d '{"dry_run":true}'
{ "camera_id": 81, "mac": "08:cc:81:4a:1f:02", "old_ip": "192.168.1.37", "new_ip": "192.168.1.38", "changed": true, "applied": false, "dry_run": true, "source": "sweep" }

Send {} (or {"dry_run":false}) to apply it; the answer then has applied: true. An address that didn't change answers changed: false.

Recipe: a camera changed IP#

A real case: after a router restart overnight, a Hikvision camera got 192.168.1.38 instead of 192.168.1.37. Its stream address still pointed at .37. The camera's MAC, which Vigiora had learned, still identified it.

  1. Find the MAC's current address

    Read the MAC under Hardware ID (MAC) on the camera's General tab, then look it up:

    Terminal
    curl -s "$BASE/api/v1/network/lookup?mac=08:cc:81:4a:1f:02" "${H[@]}" | jq '{ip, known_camera_id}'

    The answer is 192.168.1.38, matched to camera 81.

  2. Check with a dry run

    Terminal
    curl -s -X POST "$BASE/api/v1/cameras/81/actions/relocate" "${H[@]}" \
      -H "Content-Type: application/json" -d '{"dry_run":true}'

    changed: true, old_ip .37 and new_ip .38. If it answers old_address_alive, something still uses .37: check before moving anything.

  3. Relocate

    Terminal
    curl -s -X POST "$BASE/api/v1/cameras/81/actions/relocate" "${H[@]}" \
      -H "Idempotency-Key: $(uuidgen)" -H "Content-Type: application/json" -d '{}'

    The answer has applied: true. Live view and recording continue from .38.

Docker and hosted servers#

The tools need to see the LAN. When they can't, every operation answers 409 network_unavailable with details.reason, never an empty list:

details.reasonWhen
hostedThe server isn't self-hosted.
container_networkThe server runs in a container without host networking: a Docker or Podman bridge, a Kubernetes pod, containerd or LXC, or Docker Desktop.
not_supportedThe operating system has no neighbour table Vigiora can read.
no_lanThe server has no private subnet on a physical interface.
disabledThe network tools aren't available on this server.

The Vigiora installer, including its Docker Compose setup, runs the server with host networking, so the tools work there. If you run the container yourself, use network_mode: host. The tools work on self-hosted Linux, Windows 11 and macOS servers.

From an AI agent (MCP)#

The tools are also MCP tools:

ToolHint
start_network_scan, get_network_scan, list_network_devicesstart_network_scan isn't read only.
lookup_network_addressNot read only: a lookup may probe the LAN.
relocate_cameraDestructive.

Scans, lookups and relocate need your approval while human in the loop is on (the default); while it is off, the agent runs them directly. A connection signed in with Read and control gets them when you are an admin or operator; Read only doesn't. Ask your agent things like:

  • "Find the Hikvision with MAC 08:cc:81:4a:1f:02 and fix its address." The agent calls lookup_network_address, then relocate_camera with dry_run, shows you the change, and relocates (after your OK while human in the loop is on).
  • "The entrance camera is offline since the router restarted. Did its IP change?"
  • "Scan the network and list the cameras Vigiora doesn't use yet."
  • "Which devices have RTSP (port 554) open?"
Deze pagina bewerken op GitHub