github.com/binkynet/BinkyNet@v1.12.1-0.20240421190447-da4e34c20be0/Mqtt.md (about)

     1  # MQTT Command station protocol
     2  
     3  The MQTT command station communicates with elements on the track over the MQTT protocol.
     4  
     5  ## Messages 
     6  
     7  ### Locs 
     8  
     9  Direction: Computer -> Track
    10  
    11  Topic: `<prefix>/loc`
    12  
    13  Data: 
    14  ```
    15  {
    16      "address": "module/number",
    17      "speed": speedInSteps,
    18      "speedSteps": maximumSpeedStepsOfThisLoc,
    19      "direction": "forward|reverse",
    20      "functions": {
    21          "0": true,
    22          "1": true,
    23          "2": false
    24      }
    25  }
    26  ```
    27  
    28  TODO Functions 
    29  
    30  ### Power
    31  
    32  Direction: Computer -> Track, Track -> Computer
    33  
    34  Topic: `<prefix>/power`
    35  
    36  Data:
    37  ```
    38  {
    39      "active": true | false
    40  }
    41  ```
    42  
    43  ### Binary Sensors 
    44  
    45  Direction: Track -> Computer 
    46  
    47  Topic: `<prefix>/binary-sensor`
    48  
    49  Data:
    50  ```
    51  {
    52      "address": "module/number",
    53      "value": 0 | 1
    54  }
    55  ```
    56  
    57  ### Binary Outputs 
    58  
    59  Direction: Computer -> Track
    60  
    61  Topic: `<prefix>/binary-output`
    62  
    63  Data:
    64  ```
    65  {
    66      "address": "module/number",
    67      "value": 0 | 1
    68  }
    69  ```
    70  
    71  ### Switches
    72  
    73  Direction: Computer -> Track
    74  
    75  Topic: `<prefix>/switch`
    76  
    77  Data:
    78  ```
    79  {
    80      "address": "module/number",
    81      "direction": "straight|off"
    82  }
    83  ```
    84  
    85  ### Switch feedbacks
    86  
    87  Direction: Track -> Computer 
    88  
    89  Topic: `<prefix>/switch-feedback`
    90  
    91  Data:
    92  ```
    93  {
    94      "address": "module/number",
    95      "direction": "straight|off"
    96  }
    97  ```
    98  
    99  ### Clocks (4-stage)
   100  
   101  Direction: Computer -> Track
   102  
   103  Topic: `<prefix>/clock-4-stage`
   104  
   105  Data:
   106  ```
   107  {
   108      "period": "morning|afternoon|evening|night"
   109  }
   110  ```