On Apr 29, 2025, at 12:23?PM, p.lavers via groups.io <p.lavers@...> wrote:
When a point/turnout is changed in JMRI connected to the layout using MQTT it publishes a message whose topic is of the form ../turnouts/ T101 I have a number of arduino nodes controlling points and would like something like ../turnouts/node2/T101. so the node can subscribe only to topics that are relevant. I have worked out how to add and persist custom properties to the turnout object but how do I change the published MQTT topic to reflect these.
There¡¯s a script in jython/MQTT that might be a starting point for doing this: jython/MQTT/SetMqttPrefix.py
That lets you specify a specific prefix for all turnouts created after it¡¯s run. So you could make a version of this that provides a specific prefix for an Arduino, then creates that Arduino¡¯s turnouts. After that, you then run a version of the script that changes to a 2nd Arduino¡¯s prefix and creates more turnouts. Etc.
Bob
¡ª
Bob Jacobsen
rgj1927@...