Introduction
The MQTT file defines topics that must be available on the bus's MQTT bridge and which will be bridged to or from Ruter's own broker. A template is provided that the operators or suppliers must use to create a new configuration for each specific bus. The file also specifies the URL of Ruter's broker for reference only.
This file must be checked daily after 16:00 and all changes must be made on all buses before they start running the following day. Ruter has a deadline before 16:00 to post changes.
The HTML pages provided in packages may depend on changes in the topics, as we may add new topics to support new features or change existing topics to point to new versions of the broker.
In practice, operators will receive advanced notice that topics will be changed through a beta channel. Moreover, topics are not expected to be updated often.
Example
Here we show an example of two topics, one to and one from Router.
{ "timestamp": "2018-09-17T10:57:00Z", "broker": "", "topics": [ { "topic": "+/json", "direction": "out", "qos": 2, "localPrefix": "apc/", "remotePrefix": "ruter/{operator}/{vehicleid}/itxpt/ota/apc/" }, { "topic": "json", "direction": "in", "qos": 2, "localPrefix": "infohub/dpi/journey/", "remotePrefix": "{operator}/ruter/{vehicleid}/itxpt/ota/dpi/journey/" } ] } |
Content
The examples of S3 in AWS include all topics defined in the tender. In addition, there are some extra with "desc": "non-standard". These are topics that DPI will need and are examples of how we would like to expand the topics.
Mapping
The file follows the format used for the configuration of Mosquitto. The fields are mapped below. If other MQTT bridges are used, mapping is for guidance only.
NB!
If the topic is "", it must be printed as "" in the mosquitto file.
According to the mosquitto.conf format, + is a wildcard for a level in the topic name. This is used to account for e.g. several doors indicated by a number.
Bridge Configuration
Based on Mosquitto, we recommend that the JSON information be used to define the bridge to Ruter in a separate file.
With Mosquitto, the configuration is set up in /etc/mosquitto, and /etc/mosquitto/conf.d is used to define addition to the basic configuration:
/etc/mosquitto
mosquitto.conf
conf.d
ruter-bridge.conf (generated from the definitions in mqtt.conf)
The mosquitto.conf file must contain at least:
... listener 1883 # tcp listener 9883 # websockets protocol websockets ... include_dir /etc/mosquitto/conf.d |
The ruter-bridge.conf will look like:
# # Ruter MQTT Bridge # connection bus-to-authority-bridge try_private false address 34.250.54.9 bridge_attempt_unsubscribe true bridge_protocol_version mqttv311 start_type automatic restart_timeout 5 bridge_insecure true username <username> password <password> cleansession true notifications false allow_anonymous false # # Bridged Topics - from mqtt.json # # topic type in/out qos shortroute longroute topic json out 2 signon/ ruter/alpha/000000/itxpt/ota/signon/ topic json out 2 signoff/ ruter/alpha/000000/itxpt/ota/signoff/ topic json out 2 avl/ ruter/alpha/000000/itxpt/ota/avl/ topic +/json out 2 apc/ ruter/alpha/000000/itxpt/ota/apc/ topic json out 2 stopsignal/ ruter/alpha/000000/itxpt/stopsignal/ # non-standard topic +/json out 2 telemetry/ ruter/alpha/000000/itxpt/telemetry/ # non-standard topic json out 2 infohub/dpi/diagnostics/ ruter/alpha/000000/itxpt/dpi/diagnostics/ # non-standard topic json in 2 infohub/dpi/journey/ alpha/ruter/000000/itxpt/ota/dpi/journey/ topic json in 2 infohub/dpi/externaldisplay/ alpha/ruter/000000/itxpt/ota/dpi/externaldisplay/ topic json in 2 infohub/dpi/eta/ alpha/ruter/000000/itxpt/ota/dpi/eta/ topic json in 2 infohub/dpi/nextstop/ alpha/ruter/000000/itxpt/ota/dpi/nextstop/ topic json in 2 infohub/dpi/arriving/ alpha/ruter/000000/itxpt/ota/dpi/arriving/ topic json in 2 infohub/dpi/deviation/ alpha/ruter/000000/itxpt/ota/dpi/deviation/ topic json in 2 infohub/dpi/announcement/ alpha/ruter/000000/itxpt/ota/dpi/announcement/ topic json in 2 infohub/madt/notification/ alpha/ruter/000000/itxpt/ota/madt/notification/ topic json in 2 infohub/dpi/connections/ alpha/ruter/000000/itxpt/ota/dpi/connections/ # non-standard topic json in 2 infohub/dpi/digitalsignage/ alpha/ruter/000000/itxpt/ota/dpi/digitalsignage/ # non-standard topic json in 2 infohub/dpi/audio/ alpha/ruter/000000/itxpt/ota/dpi/audio/ # non-standard |
Handling
Schema
A JSON schema will be defined for this configuration file.