Skip to main content

Router

The Signal Router is a hopit Edge service to connect Targets and handle all read and write operations. It read signals from one or more Sources and write them to one or more Destinations.

The Router service can handle multiple Signal Routes.

Time synchronization

The read time is synchronized between all routes, so routes with the same scrape interval are always read at the same timestamp.

Connection Losses

On connection losses, the Router buffers the signals. The amount of saved signals can be controlled with the BufferSize parameter for each Target.

Configuration

Signal Routes can be added via the Edge web interface at https://localhost:5050/Routes:

Sample Dashboard

or via the Device Twin.

At least one Source- and one Destination Target are required for a Signal Route.

The Router Service has an overall Enable flag and a List of SignalRoutes.

A Signal Route has a Name, an Enable flag, at least one Source and at least one Destinaton.

A Source, where signals are read from, has the following parameters:

  • TargetName: The name of the Target to read the signals.
  • Signals: A List of Signal names to read. See the Target documentation for the naming syntax for specific Targets.
  • Conditions: A Condition consists of a Signal name and a Value. The Router will forward the Signals of this Source only, if the Signal equals this Value.
info

On discoverable Targets, Regular expressions can be used to read signals. A Discovery must be executed before to have a up-to-date signal list.

A Signal is handled as Regex, if it starts and ends with a /.

Example

To read the signals GVL.Weight1 and GVL.Weight2 from a Target, a single Regular expression could be used: /GVL\.Weight\d/. This can be tested with appropriate web tools (e.g. regexr.com)

To read all signals from a Target, you can use /.*/.

Destinations have the parameters:

  • TargetName: The name of the Target to write the signals.
  • ScrapeInterval: The interval to trigger the Sources to read the Signals.
  • ScrapeTrigger :
    • Periodic: Signals are sent periodically.
    • OnChange: Only the Signals, which changed while the previous cycle are sent.
    • OnChangeFull: All Signals are sent, if at least one Signal changes.
  • Constants: Name/Value pairs to add to each sent message.
  • Properties:
    • For Azure Targets: Name/Value pairs added as Properties in the Azure message.
    • For MQTT, Magenta and ThingsBoard Targets: A topic property defines the MQTT topic to publish the Signals. Default topic is /telemetry.
  • SignalMap: Name/Value pairs to replace signal names before sending it to the destination Target.
info

For the SignalMap, Regular expressions can be used to rename symbols. A SignalMap entry is handled as Regex, if its name starts and ends with a /.

Example

To rename the signals GVL.Weight1 and GVL.Weight2 to Extruder-Weight1 and Extruder-Weight2, a single Regular expression could be used with the name /GVL\..*/ and an the value Extruder-.

For more complex renaming, Capturing groups can be used. To rename the signals to Extruder-Weight-1 and Extruder-Weight-2, the name /GVL\.(.*)(\d)/ and value Extruder-${1}-${2} can be used for the SignalMap.

This can be tested with appropriate web tools (e.g. regexr.com)

Example

To illustrate the functionality of the Router service, the configuration of a simple Signal Route is shown.

It reads the Signals GVL.Line1.Weight and GVL.Line1.Temperature from a Target named Beckhoff and a Signal named Power,2,12,ir,r from the Target PV Inverter every 30s. If a value changes, it sends this value together with a Constant Timestamp and a Property Location = Belgium to the Target IoT Hub. Before sending, it renames the first two signals to Line1.Weight and Line1.Temperature.

Corresponding Edge configuration and Device Twin definition to activate the ADS Target service:
https://localhost:5050/Targets
ADS Target Settings
info

To delete a Route via the Device Twin, it have to be set to null.

caution

To delete a Route via the Azure IoT Hub Device Twin, it must be available in the desired section before setting it to null. Otherwise this null property will not be sent to the Edge device. This is the standard behaviour of the Azure IoT Hub.