SECS/GEM Messages
SECS Message Basics
From the SECS-II standard:
SECS-II defines the method of conveying information between equipment and host in the form of messages. These messages are organized into categories of activities, called streams, which contain specific messages, called functions.
Each SECS message specifies a stream and a function. Specific SECS messages are often referred to in this format: S(number)F(number). For example S1F13 refers to SECS message Stream 1, Function 13.
Requests and Responses
There are two kinds of messages:
- Request: sometimes called the primary message. These originate from the Host, which in the context of Ignition, is the Ignition Gateway. Requests are odd-number functions, such as S1F1.
- Response: sometimes known as a secondary message. These originate from the Equipment. Responses are even-number functions, such as S1F2
Thus, the Host can send an S1F1 Request, which establishes if the Equipment is on-line. If so, then the Equipment will respond with an S1F2 Response, which signifies that the Equipment is on-line. Each request can only have a single response message, or no response message if none is needed. This Request-and-Response pattern is the basis of the module, and the standard.
SECS Message Format
Every SECS message is a JSON formatted string, which contains a header. The header contains the stream, function, and if the message expects a response message. Optionally, the SECS message can have a body, which consists of a list of one or more data items. Each data item can also be a list of other data items. This forms the basis for which all SECS messages should look like, regardless of if they are a request or response.