grunig-nodes
v1.2.22
Published
Grünig Nodes Library
Downloads
1,057
Maintainers
Readme
Description
These are nodes for Grunig.
All the nodes require an additional node for the functions (mqtt-node, opcua-client, influxdb out, modbus-read).
Every node (except for the OpcUa-Read) also requires an function node with the code in the node-description to get the right format for node-input.
There is an example flow for the relevant nodes.
Node-Red:
relevant Nodes
Reads data from Modbus and puts it in MQTT
Transfer of Values
The values Payload, Communication, and MachineID must be passed through a Function Node.
Code:
let value = msg.payload; msg.payload = {}; msg.payload.Value = value; msg.payload.MachineID = flow.get("fMachineID"); msg.payload.Communication = flow.get("fCommunication"); return msg;
MQTT Path
Here must be the MQTT path where the data should be written.
Example:
Error
Format
The desired format can be selected.
payload
Only the payload value is output.
Example:
Main_Warning = 0
unit
The payload value and a unit are output.
Example:
ProgramNumber = {"value":0,"unit":"#"}
Communication
It can be selected whether the values are set to 0 if there is no active connection to the machine.
Value should be retained if connection is lost:
ignore
Value should be set to 0 if connection is lost:
consider
Data x
Here come the variable names after the Topic-Path.
The square brackets must specify the array in which the value is stored.
This usually corresponds to the last two digits of the Modbus address.
Digit example:
Modbus address: 32110 --> last two digits = [10]
Input:
Main_Warning [10]
Format = unit
If the format is unit, then the unit must be specified in another square bracket.
Example:
ProgramNumber [30] [#]
Example Path
The path is constructed as follows:
"GRUNIG/MachineID/" + MQTT Path + Data x
In the example, we have Error as the MQTT Path and Main_Warning as Data x.
This means, in the example, the value will be written to this path in the MQTT broker:
GRUNIG/MachineID/Error/Main_Warning
Reads OpcUa data and puts it in MQTT
Path
Here must be the path of the OpcUa variables (with "." at the end).
Example:
ns=6;s =:: Industry40:Interface.State.
Value
Here a specific value can be entered to be written to the variables.
If the value should be taken from the payload, leave it empty.
Data x
Here come the names of the variables that come after the path in the OpcUa server.
The data type of each variable must be written in square brackets "[ ]" after the variable name.
Example:
bCommunication [Boolean]
Permissible Variables
| Type | Description | |---------------------|--------------------------| | Int8 | 8-Bit Integer | | Int16 | 16-Bit Integer | | Int32 | 32-Bit Integer | | Int64 | 64-Bit Integer | | UInt8 | 8-Bit Unsigned Integer | | UInt16 | 16-Bit Unsigned Integer | | UInt32 | 32-Bit Unsigned Integer | | UInt64 | 64-Bit Unsigned Integer | | Byte | Byte | | SByte | Signed Byte | | Float | Floating Point Number | | Double | Double | | Boolean | Boolean | | String | String | | LocalizedText | Localized Text | | DateTime | Date and Time | | Int8 Array | Array of Int8 | | Int16 Array | Array of Int16 | | Int32 Array | Array of Int32 | | UInt8 Array | Array of UInt8 | | UInt16 Array | Array of UInt16 | | UInt32 Array | Array of UInt32 | | Byte Array | Array of Byte | | SByte Array | Array of Signed Byte | | String Array | Array of Strings | | Float Array | Array of Floats | | Double Array | Array of Doubles | | Boolean Array | Array of Booleans | | ExtensionObject | Extension Object | | ExtensionObject Array | Array of Extension Objects |
Writes MQTT to InfluxDB or OpcUa to MQTT
Transfer of Values
The values
Payload
andMachineID
must be passed through a Function Node.Code:
let value = msg.payload; msg.payload = {}; msg.payload.MachineID = flow.get("fMachineID"); msg.payload.Value = value; return msg;
Path Construction
The path is constructed as follows:
"GRUNIG/MachineID/" + Topic-Path + Data x In the example, we have /State as the Topic-Path and MachineState as Data x.
This means, in the example, the value will be written to this path in the MQTT broker:
GRUNIG/MachineID/State/MachineState
Topic-Path
Here comes the path from MQTT, even if >write InfluxDB is selected.
Example:
/State
Action
You can choose whether to write to MQTT or to InfluxDB.
Format
If write MQTT is selected in Action, then the format can be chosen here.
Format Example: Alarm message
"value": "1", "description": "ALARM_STATE_ACTIVE"
Format Example: Unit
"value": "5", "unit": "s",
Type
If write InfluxDB is selected in Action, then the type can be determined here.
Example: State
MachineState: 1 "_type": State
Data x
Here come the variable names after the Topic-Path.
Example:
MachineState
Reads the MQTT from the input JSON and puts it in InfluxDB format. Reads the Alarm-Input Bitwise.
Alarm List
This is where alarm messages are specified.
"Enable": true, "Alarm": "Main A00", "Message": [ "Error 0", "Fehler 0" ]
Enable
The Enable parameter is used to disable individual alarms.
true: Alarm is triggered
false: Alarm is not triggered
Alarm
Name of the alarm.
"Main A00"
Message
The first string contains the error message in English.
"Error 0"
The second string contains the error message in German.
"Fehler 0"
Path MQTT
This specifies the path from the MQTT broker for the alarms.
Error/Main_Warning