Qb method node
The Blickfeld Qb Method node of Blickfeld Flow calls methods of the gRPC API. It addresses either the sensor the flow runs on or other sensors in the network, and the request and the response are defined and processed as messages within the flow.
The node editor
Drag a blickfeld-qb2-method node into a flow and double-click it to open the editor.
Connect to a sensor
Connection selects how the node reaches the sensor:
| Connection | What it does |
|---|---|
Local device |
The default. Connects to the sensor the flow runs on, as |
Device configuration |
Uses a shared blickfeld-device configuration node. Use it for another sensor in the network, or when several method nodes talk to the same sensor. |
Legacy configuration |
Shows the fields IP or FQDN and Key on the method node itself, for older flows. |
With Local device and Legacy configuration, the incoming message can override the connection:
-
msg.fqdnaddresses another sensor instead of the one the flow runs on. With Legacy configuration it applies only while IP or FQDN is empty. -
msg.keysets the application key.
With Device configuration, the node ignores both.
When addressing another sensor in the network, provide an application key of that sensor, in a blickfeld-device node or in msg.key.
|
The blickfeld-device configuration node
A blickfeld-device node stores the connection details of one sensor, which any number of method nodes can use.
Add one from the Device field of a method node (select Add new blickfeld-device… and click ), or from
> Configuration nodes.
| Setting | What it does | Default |
|---|---|---|
IP or FQDN |
The address of the sensor. When it is set, the node connects and reads the Serial of the sensor. |
Empty |
Serial |
Filled in from the sensor once IP or FQDN is set; there is nothing to enter. The node checks the TLS identity of the sensor with it. |
Detected |
Key |
The application key, stored as an encrypted credential and never written to exported flows. Click Test to check it; the node also checks it when the dialog opens. |
Empty |
Auth timeout |
How long to wait for the sign-in, in seconds. |
|
To get an application key, see Create an application key.
Select a method
Choose the API method in the Method field (for example diagnostics.Health/Get).
Below the field, a short summary shows the call style, the description of the method and a View request / response schema link that opens the full schema in a dialog.
The call style is Single request / response, Server stream (multiple responses), Client stream (multiple requests) or Bi-directional stream.
View the request and response schema
The schema of the selected method is available in the Help sidebar (the Help tab of the sidebar, or Ctrl+H), under API reference at the end of the help of the node, or in a dialog through the View request / response schema link.
It lists the nested request and response fields with their types, enum values, repeated/oneof markers and the documentation of each field from the protocol.
Build the request interactively
With Request set to JSON, the API reference becomes interactive: every request field gets a ⊕ icon. Click it to insert the field at its full path into the request JSON, with any parent objects and a placeholder value. Assemble the request by clicking fields, then fine-tune the JSON. The full-screen JSON editor is the recommended view for this: open it with the … button of the Request field, and each field you click appears in it right away.
Map the request and the response
| Setting | What it does | Default |
|---|---|---|
Request |
What the node sends as the request:
A method without request fields offers only Empty request. |
|
Response |
What the node puts into |
|
Response Format |
JSON, Protobuf-ts Object or Protobuf Binary Buffer. |
JSON |
Timeout |
In seconds, for calls that are not streams. Empty for server-side streams. |
|
With the Response Format JSON, the whole response leaves out every field that has its default value, such as false, 0 or an empty text. A flow that reads msg.payload from Forward complete message has to treat a missing field as that default. With response. and a field path, the field is included even when it has its default value.
|
Test a method in the editor
Click Test method to run the call against the sensor without deploying the flow. The dialog shows the response or the error.
This works for self-contained calls, whose request is empty or set here as JSON; a call that needs an incoming msg cannot be tested on its own.
For a stream, the dialog shows the first message.
Trigger with a button
For a self-contained call, tick Show a trigger button on the node (replaces the input). The node then shows a button on the canvas, like an inject node, that runs the deployed call, for example to read the health or toggle a setting.
Streaming and auto-reconnect
Server-side streaming methods (such as Health/Watch or Event/Stream) stay open and emit one message per received item.
To stop a running stream, send a message with msg.reset set to true, for example from an inject node. The node ends the call and does not reconnect.
Auto reconnect server-side streams on error keeps a stream alive: after an error or an unexpected end, the node tries to restore the connection at the interval set in Reconnect interval. It still reports the error of every failed attempt to a connected catch node and in the status of the node. The setting is on by default and appears only when a server-streaming method is selected.
Examples
To import an example flow of the node:
-
Open the Import dialog:
at the top right > Import, or Ctrl+I.
-
Select the Examples tab on the left.
-
Expand flows > node-red-contrib-blickfeld-qb2-method and choose an example.
-
Choose current flow or new flow and click Import.
- events_fetching
-
Imports the flow Fetch perception events, which streams the perception events with auto reconnect.
The Fetch perception events flow has an inject node that starts the stream, the method node, and a catch node that reports reconnect errors:
Its JSON:
[
{"id":"ex_events_inject","type":"inject","z":"f","name":"Start streaming","props":[],"once":true,"onceDelay":0.5,"topic":"events","x":200,"y":120,"wires":[["ex_events_method"]]},
{"id":"ex_events_method","type":"blickfeld-qb2-method","z":"f","name":"Event/Stream","device":"","fqdn":"qb2.local","key":"","method":"/blickfeld.percept_processing.services.Event/Stream","request":"","request-type":"*","response":"","response-type":"*","response-format":"json","timeout":"","autoReconnect":true,"reconnectInterval":"5","x":430,"y":120,"wires":[["ex_events_debug"]]},
{"id":"ex_events_debug","type":"debug","z":"f","name":"event","active":true,"tosidebar":true,"complete":"payload","x":650,"y":120,"wires":[]},
{"id":"ex_events_catch","type":"catch","z":"f","name":"stream errors","scope":["ex_events_method"],"uncaught":false,"x":210,"y":200,"wires":[["ex_events_error"]]},
{"id":"ex_events_error","type":"debug","z":"f","name":"reconnect error","active":true,"tosidebar":true,"complete":"error","x":440,"y":200,"wires":[]}
]
References
-
The API reference with all gRPC services, methods and messages
-
Blickfeld Qb protocol definitions on GitHub