Skip to content

Camera Settings ​

The Camera Settings widget is a full-page interface for the cameras of a machine. It has three tabs; only SETTINGS has content (CALIBRATION and ERROR HANDLING are empty placeholders). The SETTINGS tab has three columns:

  • CAMERA LIST: the known cameras, which can be reordered by drag and drop. Buttons: Reset cameras information (discover the cameras again through NATS), Save cameras order (send the order to the flow) and Add new camera, which does nothing in this version. OPEN VIEWER, below the list, opens a page served by the same machine in a dialog titled Viewer.
  • CAM followed by the camera's order: a crop area with pagination between cameras. The image is a sample bundled with the widget, not a frame from the camera.
  • CAMERA SETTINGS: crop sliders (width, height, offset X and offset Y), which follow the crop drawn on the sample image, and a slider for each other parameter read from the camera (exposure time, gain). Moving a slider sets that parameter on the camera at once, as an integer. The profile selector in this column is not saved anywhere.

The browser talks to the cameras through a NATS WebSocket server whose address is fixed in the widget code: it cannot be set from the node. When the connection fails, the widget stays empty: it does not even ask the flow for the camera list.

Palette: category Pages, label camera settings. 1 input, 1 output.

Configuration ​

PropertyDescriptionDefault
NameNode name shown in the editor.""
GroupDashboard group where the widget is displayed.— (required)
SizeWidget width and height (0 = fit to the group).0 x 0

Input ​

The answer to the camerasinfo request (see Output):

msg.payloadEffect
{ cameras: [...] }Saved camera list. The widget reads the parameters of each camera through NATS, then discovers the cameras on NATS and, when one is not in the list, shows a New camera found dialog (its Add button does nothing in this version).
"nojson"There is no saved list: the widget discovers the cameras through NATS and uses that list.

Each camera is identified by macAddress. CameraName must be the camera type, irayple, omron or rosepetal (any letter case): it selects the names of the parameters read (Width, Height, OffsetX, OffsetY, ExposureTime, Gain; the same names in lower case for rosepetal). With any other type, or without CameraName, the parameters of the whole list are not read. A camera whose parameter request gets no answer is shown as disabled; one that answers is enabled, whatever the saved list says.

js
msg.payload = {
  cameras: [
    { macAddress: "00:11:22:33:44:55", CameraName: "irayple", order: 1, disabled: false }
  ]
};

Output ​

msg.payloadWhen
"camerasinfo"Once the widget has connected to NATS, to ask the flow for the saved list.
{ newOrder: [...] }Save cameras order pressed: the cameras in their new order, each with macAddress, order (renumbered 1, 2, ... after a drag), CameraName and disabled, plus interfaceIP, interfaceMAC, ipAddress, modelName, serialNumber, subnet, gateway, interfaceGatewat (from interfaceGateway), interfaceSubnet and vendorName when the camera has them.

NATS messages ​

Requests are JSON published on image/control. The answer is the first message on image/result with the same action and param (and, for one camera, deviceId equal to its MAC address), and result: true when it worked. A request with no answer fails after 5 seconds.

RequestFields of the answer used
{ "action": "getParam", "param": "ID" }availableCameras: the cameras found.
{ "action": "getParam", "param": "<name>", "MACAddress": "<mac>" }value, minimum, maximum and increment.
{ "action": "setParam", "param": "<name>", "value": <integer>, "MACAddress": "<mac>" }result, and resultMessage when it failed (written to the browser console only).

Usage example ​

Keep the camera list in the flow context (or in a file):

  1. Connect the output to a switch on msg.payload. For "camerasinfo", answer with { cameras: <list> }, or with "nojson" when there is no saved list:
js
const saved = flow.get("cameras");
msg.payload = saved ? { cameras: saved } : "nojson";
return msg;
  1. For { newOrder }, save msg.payload.newOrder (for example with flow.set("cameras", msg.payload.newOrder)), so the next load shows the cameras in that order.