This API runs on any supported device with a DCC-EX EX-CommandStation connected via USB. DEJA.js can replace JMRI as a lightweight replacement that runs in modern environments.
- π§ NodeJS application that runs on a π» Mac/PC/Linux/Raspberry Pi that is connected to a DCC-EX EX-CommandStation
- π₯ Use π°οΈ DEJA Throttle to connect to DEJA.js and send DCC Loco commands to your track
- π DEJA.js is written in JavaScript - the most popular programming language in the world*
- β¨ Replace JMRI. DEJA.js is π modern, β‘ blazing fast, it's requirements are simple π―, and you'll never look back π!
-
π¦ Install & Configure DCC-EX CommandStation connected via USB to a π» Mac/PC/Linux/Raspberry Pi
-
π¦ Install NodeJS 20+ on the same π» Mac/PC/Linux/Raspberry Pi
$ nvm install 21
Create a .env
file in this directory.
$ touch .env
Copy & Paste the values below into the.env
file.
LAYOUT_ID=[your-layout-name]
VITE_MQTT_BROKER=wss://test.mosquitto.org
VITE_MQTT_PORT=8081
ENABLE_MQTT=true
ENABLE_WS=true
VITE_WS_PORT=8082
VITE_WS_ID=DEJA.js
Replace your-layout-name
with a descriptive name of your layout. Only use lowercase letter, numbers, and dashed. No spaces. No special characters. No emoji.
LAYOUTID=[my-basement-empire]
LAYOUTID=[idaho-crossing]
LAYOUTID=[something-unique]
LAYOUTID=[apple-munchkin-fairy]
LAYOUTID=[My B@sement "Empire"!]
LAYOUTID=[ID_cross]
LAYOUTID=[my-basement-empire]
(already used!)
LAYOUTID=['ππΆπ§']
-
π Install & Run
Clone this repository and open a terminal in the projet root.
$ npm i -g pnpm $ pnpm install $ pnpm run start
-
π€οΈ Open a Supported Throttle and connect to the DCC-EX CommandStation via DEJA.js
// TODO: imporove with examples, MQTT Explorer instructions
action | payload | notes | ||
---|---|---|---|---|
connect | {Object} serial: {String} |
Returns: { 'action': 'connected', payload: { path: {String}, baudRate: {String} } } |
example: { serial: '/devv/ttyusb2301' } |
--- |
dcc | {String} |
send raw DCC command (omit < and > ) |
||
getStatus | {Object} { action: 'status', payload: { isConnected: {Boolean} } |
|||
listPorts | {Object} { 'action': 'listPorts', [ports] } |
Returns array of available USB ports | ||
power | {Integer} |
Toggle track power. 1 = ON, 0 = OFF | ||
throttle | {Object} address: {Integer} speed: {Integer} |
Forward = positive speed , Reverse = negative -speed |
||
turnout | {Object} turnoutId: {Integer} state: {Boolean} |
Toggle DCC-EX Turnout | ||
output | {Object} pin: {Integer} state: {Boolean} |
Toggle DCC-EX Output | ||
function | {Object} address: {Integer} function: {Integer} state: {Boolean} |
Toggle DCC-EX Locomotive Function |
- Convert to TypeScript
- Write Unit Tests
- Support Turnouts
- Support Outputs