This is the preferred discovery method, as it has several advantages over the DHCP discovery method:

  1. It doesn’t require rebooting the camera.
  2. It’s faster.
  3. It’s more reliable.
  4. Sometimes the HUB freezes when DHCP discovery is enabled. To unfreeze the HUB, you have to reboot it.

Call the discovery script with .

You can filter which Ezviz camera model to add by passing in the model parameter.

Current valid values for model are:

  • VistaCam702
  • VistaCam1102

The model parameter is mandatory, because cameras with older firmware versions (a.k.a. the factory provisioned ones) don’t respond to UDP broadcasts that don’t contain the camera model.

The UDP broadcast discovery can be called in 2 modes:

1. Create mode (default)

In “create” mode, the script will scan for the first new camera with the specified model (or any Ezviz camera if the model is not specified), and add it as a device on the hub.

If no new camera is found, no device is created.

To call the script in “create” mode, set the “mode” parameter to “create“, or don’t set the “mode” parameter at all.

Examples

Add a VistaCam 702:

				
					{
   "method": "hub.extensions.plugin.run",
   "id": "_AUTO_370954",
   "params": {
      "script": "HUB:ezviz/scripts/discovery",
      "scriptParams": {
         "action": "udp_discovery",
         "model": "VistaCam702"
      }
   }
}				
			
2. Scan mode

In “scan” mode, the script will scan for cameras with the specified model (or any Ezviz camera if the model is not specified) and broadcast an array with the cameras found.

To call the script in “scan” mode, set the “mode” parameter to “scan:

Examples

Call UDP discovery in scan mode, for any camera model:

				
					{
    "method": "hub.extensions.plugin.run",
    "id": "_ID_",
    "params": {
        "script": "HUB:ezviz/scripts/discovery",
        "scriptParams": {
            "action": "udp_discovery",
            "mode": "scan"
        }
    }
}				
			
The broadcasted response looks like this:
				
					{
    "id": "ui_broadcast",
    "msg_subclass": "hub.extensions.plugin.ui_broadcast",
    "result": {
        "discovered_devices": [
            {
                "device_name": "VistaCam 702",
                "ip": "192.168.87.29",
                "mac": "44:47:cc:0d:df:03",
                "model": "VistaCam702",
                "serial": "85000001",
                "ssid": "VistaCam702_85000001"
            },
            {
                "device_name": "VistaCam 1200",
                "ip": "192.168.87.26",
                "mac": "80:91:33:d1:97:71",
                "model": "VistaCam1200",
                "serial": "12345678",
                "ssid": "VistaCam1200_12345678"
            }
        ],
        "plugin": "ezviz"
    }
}
				
			

In “*scan” mode the device is not created automatically. You must create the device yourself.*


To create a device, call , passing as parameters the device information from the broadcasted response:

				
					{
   "method": "hub.extensions.plugin.run",
   "id": "_ID_",
   "params": {
      "script": "HUB:ezviz/scripts/create_device",
      "scriptParams": {
            "device_name": "VistaCam 702",
            "ip": "192.168.87.29",
            "mac": "44:47:cc:0d:df:03",
            "model": "VistaCam702",
            "serial": "85000001",
            "ssid": "VistaCam702_85000001"
        }
    }
}