Skip to content

MSCONS Rule Action

The ELEMENT-IoT Platform is abled to send reading values as MSCONS E-Mails.

MSCONS is a EDIFACT format used for exchanging reading values from energy meters and defined in these documents:

Action configuration

When selecting the "Send MSCONS" action in a rule, the event has to be "Reading added". Any other event type will not work because of the missing payload.

To send MSCONS some values are needed beforehand:

  • Sender "Marktpartner-ID"
  • Receiver "Marktpartner-ID"

Currently only the MSCONS format VL - Verrechnungsliste with the codes 7 - Prozessdatenbericht and 9 - Original is available.

The other inputs can be selected for your needs:

  • "Prüfidentifikator"
  • "Ablesegrund"
  • "Erfassungshinweis"
  • "Mengenangaben"

If the MSCONS E-Mail is just a test, use the "Test transmission" flag which will include the according code in the MSCONS.

S/MIME Encryption

To use encryption for MSCONS, the public X.509 certificate of the receiver is needed. The receiver will need the public ELEMENT X.509 certificate to validate the received data. A download link to the public ELEMENT X.509 certificate is provided.

The file ending of a X.509 certificate is most likely either .crt, .cer or .pem.

In a nutshell, this is how the S/MIME encryption works:

  1. ELEMENT will sign the MSCONS data using its own private key.
  2. ELEMENT will encrypt the signed MSCONS data using the public certificate of the receiver.
  3. E-Mail is send to receiver.
  4. The receiver will decrypt the signed MSCONS data using its own private key.
  5. The receiver will validate the signature with the ELEMENT public key.

To use encryption check the "Encrypt E-Mail with S/MIME" checkbox, then a text input will appear. Paste the certificate of the receiver in this box.

The expected format is a text that will start with -----BEGIN CERTIFICATE-----. If the text does not start this way, its most likely the wrong file.

If the file does not contain readable text, its in the binary DER format. Converting a DER encoded file cert.crt to a PEM encoded textfile cert.pem can be done using the following OpenSSL command:

openssl x509 -in cert.crt -inform der -out cert.pem -outform pem

There are some websites that can do that online.

Reading fields

This action rule will send a obis value via MSCONS. For this the according Reading needs to have a field for that obis value.

The expected field name is: reading.data.obis_value

If no value could be found in the reading data, no MSCONS E-Mail will be send.

A example parser for OBIS 1-1:1.8.0 and 1337 kWh would look like this:

defmodule Parser do
  use Platform.Parsing.Behaviour

  def parse(_event, _meta) do
    %{
      :obis => "1-1:1.8.0",
      :obis_value => 1337,

      # Alternative
      "1-1:1.8.0" => 1337
    }
  end
end

Device Profile

For transferring MSCONS data, some device specific values are needed. These have to be provided in a device profile.

The technical name of the profile has to be mscons and the following fields are required:

  • Field name zaehlpunktnummer
  • Type: string
  • Required
  • Example: DE00056266802AO6G56M11SN51G21M24S
  • Field name zaehlernummer
  • Type: string
  • Required
  • Example: 44600637
  • Field name obis
  • Type: string
  • Required
  • Example: 1-1:1.8.0

The following screenshot shows the expected profile.

MSCONS Profile

Dynamic Fields

Some fields can be provided at different places of ELEMENT.

The possible sources and their order is:

  1. Reading data
  2. Device profile
  3. Rule settings

Example

The value for the field ablesegrund will first be searched in reading.data. If not found the device.fields.mscons will be used. As a last resort, the value from rule settings will be used.

This feature can be used to write application logic specific parsers.

Available fields

Field name Default Search order
zaehlpunktnummer no Reading data, Device profile
zaehlernummer no Reading data, Device profile
obis no Reading data, Device profile
pruefidentifikator "13002" Reading data, Device profile, Rule settings
ablesegrund "COT" Reading data, Device profile, Rule settings
erfassungshinweis "MRV" Reading data, Device profile, Rule settings
mengenangabe "Z18" Reading data, Device profile, Rule settings
status_kategorie no Reading data, Device profile, Rule settings
status no Reading data, Device profile, Rule settings
status_liste "108" Reading data, Device profile, Rule settings
status_hinweis no Reading data, Device profile, Rule settings

Special handling of obis_value

If the value of obis is "1-0-1.8.0" and the field data["1-0-1.8.0"] exists, it will be used instead of data.obis_value. If the field is missing, the default field data.obis_value will be used.

STS (Statuszusatzinformation)

For a STS structure contained in the resulting MSCONS, the field status_kategorie needs to be set. Depending on the value status and status_liste, or status_hinweis can be set.

Validation and logs

The MSCONS definition has some requirements on the data. Required fields will be checked. Format of values like length and allowed symbols will be checked.

In case there is a format error or missing values, the MSCONS E-Mail will not be send. Check the log of the rule in case of problems.