Find the camera on the network instead of asking for its address
The add-camera form asked for an IP address, and a shop owner does not know their camera's IP address - it is on a sticker under the camera or in a menu that differs by make. That field is where onboarding stopped for anyone who was not an installer. behavision/discover.py: one ONVIF WS-Discovery multicast (names the camera and often its make) merged with a TCP sweep of port 554 across the local /24 (misses nothing that streams). Stdlib only, ~4 s on the office network, both cameras found. The add-camera sheet leads with 'Find cameras on this network'; picking a row fills the address and, when the make is recognisable, the stream path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGcjxF1cNLcuwc3DAPcnfj
This commit is contained in:
@@ -609,6 +609,14 @@ func (a *App) Cameras() ([]map[string]any, error) {
|
||||
return a.local.Cameras(ctx)
|
||||
}
|
||||
|
||||
// DiscoverCameras lists the cameras on this PC's network, so the add-camera
|
||||
// form is a pick-list and not a request for an IP address nobody knows.
|
||||
func (a *App) DiscoverCameras() (map[string]any, error) {
|
||||
ctx, cancel := context.WithTimeout(a.ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
return a.local.DiscoverCameras(ctx)
|
||||
}
|
||||
|
||||
func (a *App) TestCamera(cam map[string]any) (map[string]any, error) {
|
||||
ctx, cancel := context.WithTimeout(a.ctx, 60*time.Second)
|
||||
defer cancel()
|
||||
|
||||
Reference in New Issue
Block a user