{"id":25220408,"url":"https://github.com/adridevelopsthings/open-interlocking","last_synced_at":"2025-04-05T11:21:13.463Z","repository":{"id":109344085,"uuid":"539123955","full_name":"AdriDevelopsThings/open-interlocking","owner":"AdriDevelopsThings","description":"An open source self hosted interlocking (simulation)","archived":false,"fork":false,"pushed_at":"2023-01-22T17:09:32.000Z","size":142,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-10T21:53:11.426Z","etag":null,"topics":["golang","interlocking"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdriDevelopsThings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-20T17:57:03.000Z","updated_at":"2024-05-07T19:23:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a258b88-9b71-45ce-af9a-02350f27d2f7","html_url":"https://github.com/AdriDevelopsThings/open-interlocking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fopen-interlocking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fopen-interlocking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fopen-interlocking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fopen-interlocking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdriDevelopsThings","download_url":"https://codeload.github.com/AdriDevelopsThings/open-interlocking/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247326583,"owners_count":20920872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","interlocking"],"created_at":"2025-02-10T21:53:13.309Z","updated_at":"2025-04-05T11:21:13.441Z","avatar_url":"https://github.com/AdriDevelopsThings.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# open-interlocking\nAn open source self hosted interlocking (simulation). For example you can use opinterlockingerk to connect it to your model railway or railway in minecraft.\n\n## Translation table\nThe language of this project is english but you could know some german words:\n| German word | English word                                                                            |\n| ----------- | --------------------------------------------------------------------------------------- |\n| Stellwerk   | interlocking                                                                            |\n| Vorsignal   | distant signal                                                                          |\n| Weiche      | railroad switch                                                                         |\n| Bloecke     | blocks (blocks are occupiable parts of a track)                                         |\n| Subbloecke  | subblocks (one subblock per block for each direction (the same block will be reserved)) |\n| Fahrstrasse | a connection between two signals over railroad switches and blocks                      |\n| Gleisbild   | track diagram                                                                           |\n\n\n## Templating\n\nYou need to create a template file in which you explain how your track diagram should look like.\n\nGive attention to this:\n- Your distant signal names must start with 'V', your signal names must start with 'S', your railroad switch names must start with 'W', your block names must start with 'B' and the name of your subblocks must be the block name with lowercase letters added\n- letter V, S, W and B must be followed by a number\n\nThe file has the following syntax:\n\n```yaml\n\n# define distant signals\ndistant_signals:\n    V1:\n\n# define signals\nsignals:\n    S1:\n        distant_signals:\n            - V1 # that means distant signal V1 is at the same location as S1\n    S2:\n\n# define railroad switches\nswitches:\n    W1:\n    W2:\n\n# define blocks\nblocks:\n    B1:\n\nsubblocks:\n    B1a: # subblock for Block B1\n        start: W1 # the subblock starts with railroad switch W1\n        end: S1 # the subblock ends with signal S1\n    B1b: # subblock for Block B1\n        start: W2\n        end: S2\n\nrelations:\n    signals:\n        S1:\n            following: W1\n        S2:\n            following: W2\n            previous: B1a\n    switches:\n        W1:\n            previous: S1\n            following_straight_blade: B1\n            following_bending_blade: B2\n\n\n```\nThis example won't work as it's only to show how the file should be written. You want an example? Go to [examples directory](examples).\n\n\nAlso we have a yaml schema:\n1. Your yaml file must have the `open-interlocking.yaml` or `opinterlockingerk.yml` file suffix.\n2. If this doesn't work (because your client won't load the schema from schemastore.org) you can tell your yaml autocomplete extension the schema manually: [template.schema.json](template.schema.json)\n\n## Api\n\n### Authorization\n\nYou must authorizate you with a Bearer token. Generate a new token by running open-interlocking with `-g -c [GIVE_THE_TOKEN_A_COMPUTER_NAME]`. You can supply a permission by adding ``-p permission`` (regex). The default permission is `.+`.\nPut the token in the ``Authorization`` header field.\n\nThe following permissions are available:\n| Permission         | Description                                                          |\n| ------------------ | -------------------------------------------------------------------- |\n| state/ack          | Acknowledge a state of a signal, distant signal or switch with POST. |\n| occupy             | Occupy blocks                                                        |\n| connection/set     | Set a connection between two signals                                 |\n| connection/desolve | Desolve a connection between two signals                             |\n\n\nThere is a swagger/openapi specification: open-api.yml.\n\n| Method | Path                            | Description                                                                                              | Response                                   |\n| ------ | ------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ |\n| GET    | /:kind/:name                    | Get the current state of a signal, distant_signal or switch                                              | true or false                              |\n| POST   | /:kind/:name                    | Acknowledge the current_state. (first GET the state, be sure you set the signal before acknowledging it) | true or false (state)                      |\n| GET    | /connection/:signal1/:signal2   | Get the connection between signal 1 and signal 2. (signal1 and signal2 are the name of the signal)       | take a look at the open api specification. |\n| POST   | /connection/:signal1/:signal2   | Set a connection between these two signals.                                                              | take a look at the open api specification. |\n| DELETE | /connection/:signal1/:signal2   | Desolve the connection between these two signals.                                                        | take a look at the open api specification. |\n| POST   | /block/occupy/:from/:to/:action | Occupy the block 'to' (switch or block e.g. W1 or B1) (action = join or leave)                           | 'success'                                  |\n\n### RailroadConnection state\nconnection.state is integer with this value:\n| Integer | State                                                             |\n| ------- | ----------------------------------------------------------------- |\n| 0       | Connection ain't set                                              |\n| 1       | Connection waiting until the switches acknowledged                |\n| 2       | Connection waiting until the signals/distant signals acknowledged |\n| 3       | Connection set                                                    |\n| 4       | Connection desolving                                              |\n\n### Block / Switch reserved\nblock.reserved / switch.reserved is integer with this value:\n| Integer | State                                                     |\n| ------- | --------------------------------------------------------- |\n| 0       | Block is not reserved                                     |\n| 1       | Block is reserving (waiting until the connection is set ) |\n| 2       | Block is reserved for a connection                        |\n| 3       | Block is occupied by a train                              |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadridevelopsthings%2Fopen-interlocking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadridevelopsthings%2Fopen-interlocking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadridevelopsthings%2Fopen-interlocking/lists"}