Skip to content

7. Format and Examples

Chris edited this page Jun 16, 2024 · 57 revisions

Message Format sent from Rocrail text fields, Node-RED or other sources via MQTT

Format (MQTT payload):

ZZAMSG#Targets#Template#Station#Track#Destination#Departure#Train#TrainType#Message#Spare1#Spare2#

The field separator can instead of '#' also be another character like ',' or ';' or a combination of up to 3 characters incl. space. Just make sure you don't use a character that can also be part of your message or field texts. The separator can be configured on the Configuration Website.

  • ZZAMSG: Identifier for relevant MQTT messages
  • Targets: Identifier for displays e.g. D01 = Display01, D02=Display02, ..., can include more than one Display e.g. D01D02
  • Template: Identifier for Template, T0 = Template 0, T1 = Template 1, ... T9, can include only one Template e.g. T0

Content Fields

  • 0 - Station - Name of the station where the display is located
  • 1 - Track - Track number
  • 2 - Destination - Destination city
  • 3 - Departure - Departure time
  • 4 - Train - Train number
  • 5 - TrainType - Train Type for Logo selection, e.g. ICE, IC, ...
  • 6 - Message - Flexible message to display e.g. static in the middle of the display, as a ticker at the top, ...
  • 7 - Spare1 - For future features, not in use at the moment
  • 8 - Spare2 - For future features, not in use at the moment

Rocrail Dynamic Text Variables can be used. Some of them have been tested, but by far not all.

Roc-MQTT-Display specific Command Variables

  • NTP Time - {ntptime}
  • NTP Date - {ntpdate}
  • Rocrail Time - {rrtime}
  • Rocrail Date - {rrdate}

All variables can also be used in scroll text messages.

This Excel based Message Builder Tool can help understanding the message format and creating messages.

Roc-MQTT-Display Architecture

Templates

Some standard templates are ready to use. They can be modified as you need them. For back to back displays there is a template for each side (A and B).
Share your templates with the community. If you think you have configured a great template I'm happy to add it to the repository and wiki. Simply download it from the web interface of your controller and share it via GitHub Issues function.
There is also an import function to import templates. When importing a template make sure to set the TPLID to a valid value T0, T1, .., T9. The existing template with that ID will be overwritten.

Example template in JSON format

{"TPLID":"T0","TPLNAME":"Train Announcement - Side A","TPLSIDE":0,"TPL0FONT":2,"TPL0MAXWIDTH":116,"TPL0FONT2":3,"TPL0DRAWCOLOR":1,"TPL0FONTMODE":1,"TPL0POSX":0,"TPL0POSY":0,"TPL0SCROLL":0,"TPL1FONT":1,"TPL1DRAWCOLOR":1,"TPL1FONTMODE":1,"TPL1POSX":0,"TPL1POSY":30,"TPL2FONT":2,"TPL2MAXWIDTH":116,"TPL2FONT2":3,"TPL2DRAWCOLOR":1,"TPL2FONTMODE":1,"TPL2POSX":20,"TPL2POSY":29,"TPL2SCROLL":0,"TPL3FONT":4,"TPL3DRAWCOLOR":1,"TPL3FONTMODE":1,"TPL3POSX":100,"TPL3POSY":8,"TPL4FONT":5,"TPL4DRAWCOLOR":1,"TPL4FONTMODE":1,"TPL4POSX":93,"TPL4POSY":17,"TPL5LOGOX":0,"TPL5LOGOY":0,"TPL6FONT":6,"TPL6MAXWIDTH":116,"TPL6FONT2":1,"TPL6DRAWCOLOR":1,"TPL6FONTMODE":0,"TPL6POSX":0,"TPL6POSY":8,"TPL6SCROLL":1,"TPL6BOXX":22,"TPL6BOXY":0,"TPL6BOXW":90,"TPL6BOXH":10,"TPL6DRAWCOLOR2":0,"TPL6FONTMODE2":1,"TPL6BOX2X":91,"TPL6BOX2Y":0,"TPL6BOX2W":127,"TPL6BOX2H":10}

  • T0 - Train Announcement - Side A
  • T1 - Train Announcement - Side B
  • T2 - Local Train - Side A
  • T3 - Local Train - Side B
  • T4 - Message Only, 1 Line - Side A
  • T5 - Message Only, 1 Line - Side B
  • T6 - Stationname, 1 Line - Side A
  • T7 - tbd
  • T8 - tbd
  • T9 - ScrollText96x16

Example Messages

Description MQTT message Output on Display
1. Standard train announcement on Display 01 ZZAMSG#D01#T0##1#Hamburg Hbf#15:12#ICE 251#ICE####
2. Standard train announcement on Display 01 with scroll message ZZAMSG#D01#T0##1#Köln-Bonn#10:22#IC 53#IC#5min Verspätung###
3. Standard train announcement on Display 01 and 02 with scroll message ZZAMSG#D01D02#T0##2#Berlin Hauptbahnhof#11:45#ICE 597#ICE#Vorsicht an der Bahnsteigkante###
4. Message and Track only, in the middle ZZAMSG#D01#T1##2#####Zugdurchfahrt###
5. Use a Rocrail variable ZZAMSG#D01#T0#Bhf01#1#####%lcid%###
6. Show NTP Time, Track, Logo ZZAMSG#D01#T4##1####DB#{ntptime}###
7. Show Rocrail Time ZZAMSG#D01#T4##1#####{rrtime}###
8. Stationname ZZAMSG#D01#T6#Gartenstadt#########
9. Clear Display D01 and D02 ZZAMSG#D01D02###########
10. Local Train D01 with Logo ZZAMSG#D01#T2##1#Sternschanze#10:22#U2#U####
11. Dynamic NTP time and Rocrail temperature in scroll message ZZAMSG#D01#T0##1#Berlin Hauptbahnhof#23:05#ICE 597#ICE#Es ist {ntptime} %temp%°C###
12. One line scrolltext only display 96x16 as "Fahrgastinformation" display ZZAMSG#D01#T9#######Achtung Zugdurchfahrt###

These are some examples how to integrate Roc-MQTT-Display with Rocrail. All other sources that can generate and send the required MQTT messages will work as well, e.g. Node-RED.

Roc-MQTT-Display Architecture