¿ªÔÆÌåÓý

Locked Re: MQTT Connection in JMRI


 

Folks,
As of JMRI vers 4.15.5, more flexibility has been added to the MQTT topic with more flexibility to come and the payload can have a JSON string or plain text.

So the direction we are going is for JMRI not to set a standard but be flexible to allow the user to use what standard they like. ? That doesn't necessarily mean setting a standard is a bad idea, it only means we want to expand JMRI's MQTT capabilities for people to use now.? This thread is over 130 messages long, message format standards where discussed with no firm consensus emerging. That discussion can continue independently.

JMRI turnouts have state of Closed or Thrown (excluding Unknown or Inconsistent). The payload JMRI publishes is the state to which the turnout is being set, though uppercase.
Whilst normally a turnout is set from JMRI, any MQTT client could publish the command to change the turnout in which case JMRI will see the message and update its state accordingly.
This means an esp32 device that drives a turnout could have a local manual switch (or sensor), change the turnout and publish the state change to tell JMRI that it has been changed.
JMRI will accept payload in plain text, e.g "THROWN" or a JSON string that contains "state":"THROWN". It will ignore other items in the JSON string, it only cares about the state.

At present, MQTT in JMRI is limited to turnouts only but will expand to other device types including sensors. Obviously a sensor would use a very similar process as updating a turnout state not triggered by JMRI so the work is nearly done already.


Regarding throwing multiple points together, I have two turnouts thrown together, wired in parallel from one Digitrax DS64 output so there is only one DCC address. The strategy I have used is to define one of them in JMRI as a virtual turnout and logix defined so whenever either one gets thrown, the other will as well. That approach can also be used for non-DCC technologies.

- Dave Mc.

Join [email protected] to automatically receive all group messages.