Skip to main content

You can use Redis to store the data collected by Omni Edge. This is useful if you want to use Redis as a message broker or if you want to store the data for later use.

You can use this technique to make OPCUA Omni Edge interacts with NodeRed.

In this scenario, you would use NodeRed and any of its complementary nodes to connect to brownfield devices and collect the date. You can then push the data to Redis databoS

The OPCUA variable thas has been configured in the Omni Edge configuration file to be connected to the redis key will automatically updated with the corresponding value in Redis.

Using Redis with OPCUA Omni Edge

using raw data

# in redis-cli
SET MyFloat1 "3.14"
GET MyFloat1
# in redis-cli
SET MyFloatArray "[3.14, 2.71, 1.41]"
GET MyFloatArray

using JSON Encoded data in OPCUA JSON format

The data should be a DataValue format see: https://reference.opcfoundation.org/Core/Part6/v105/docs/5.4#:~:text=The%20OPC%20UA%20JSON%20DataEncoding,to%20qualify%20names%20with%20namespaces.

We recommand you use the @opcua/for-node-red package to assit you in creating data to OPCUA JSON format.

# in redis-cli
SET MyFloat1 "{\"UaType\": 6,\"Value\": 3000}"
GET MyFloat1

Configuration

Tips & Tricks

  • starting a redis-client associated with the redis container.
docker run -it --rm  redis-server /user/local/bin/redis-cli
  • starting a redis-client in a sperate container specifying the host and port of the redis server, you can check the data stored in Redis.
docker run -it --rm --network host redis:latest redis-cli -h localhost -p 16379

bindigs examples

  - node: /di:DeviceSet/own:MyObject/own:MyInt32
value: $redisGet("r1","MyInt32")
# on-write: $redisPut("redis1", $toOPCUAJson(value))

- node: /di:DeviceSet/own:MyObject/own:MyFloat1
value: $redisGet("r1","MyFloat1")

- node: /di:DeviceSet/own:MyObject/own:MyFloat2
value: |
(
$mb := $redisGetRaw("r1","MyFloat2");
{
"value": $mb.value / 10.0 + 3.14,
"statusCode": $mb.statusCode
};
)