EliteG19s Webhook Guide

Use the webhook service to trigger any IRemoteControl command from simple HTTP requests. This guide expands on the summary in the main manual and walks through setup, payload formats, and tooling examples using curl, PowerShell, and Postman.

1. Enable the Webhook Listener

  1. Open %AppData%\EliteG19s\options.json.
  2. Locate the "Webhooks" section (create it if absent):
    {
      "Webhooks": {
        "IsEnabled": true,
        "Port": 32123
      }
    }
    
  3. Save the file and restart EliteG19s. On startup the app binds to http://localhost:<port>/.

Note: The listener currently binds to localhost only. To expose it outside the machine, use an HTTP reverse proxy or tunnelling tool and secure the connection yourself.

2. Endpoints and Payloads

Endpoint Method Purpose
/health or / GET Returns { "status": "ok" } when the listener is running.
/remote-control (or /) POST Execute an IRemoteControl command.

2.1 Request Format

Send JSON with at least a command property. Additional properties become command parameters. You may also nest them under parameters.

{
  "command": "SwitchScreen",
  "screenName": "Status"
}

2.2 Response Format

Successful responses:

{
  "success": true,
  "command": "SwitchScreen",
  "result": null
}

Errors return HTTP 4xx/5xx and:

{
  "success": false,
  "error": "Unknown command 'Foo'"
}

3. Command Catalogue

Every webhook command maps 1:1 to an IRemoteControl method. The tables below list every handler, the payload properties it understands, plus important value ranges. Unless stated otherwise commands return success: true with a null result.

3.1 Audio Output

Command Parameters Effect
VolumeUp None Raises master volume (small steps below 10%, larger above).
VolumeDown None Lowers master volume.
ChangeVolume delta (int -100..100) Adds delta/100 to master volume; hitting the limits clamps to mute/100%.
Mute None Toggles global mute (also syncs space-traffic chatter).

3.2 Playback Transport

Command Parameters Effect
StopMusic None Releases the current audio source.
PauseMusic None Pauses the active track/stream.
GoToNextTrack None Skips to the next queued item.
GoToPreviousTrack None Returns to the previous item.
ShuffleMusic None Toggles shuffle on the active provider.
MusicSkipForward None Jumps forward ~30 seconds when supported.
MusicSkipBack None Jumps backward ~30 seconds when supported.

3.3 Audio Sources

Command Parameters Effect
ListenToRadiostation station (string) Starts a radio preset defined in %AppData%\EliteG19s\options.json (RadioStations). Case-insensitive.
ListenToSpotifyPlaylist playlist (string) Plays a named Spotify preset from options.json.
ListenToPodcast podcast (string) Streams the newest episode of a configured podcast.
ListenToMusicFolder folder (string path) Recursively queues supported files under the folder and resumes the last position when available.
StreamMusicUrl url (absolute URI) Starts streaming from an HTTP(S) source.
ListenToPlaylist path (string path) Loads and plays a .m3u/.m3u8 playlist file.
WatchYoutubePreset preset (string) Removed: YouTube/Twitch presets are no longer supported. Use SwitchScreen with the WebBrowser screen and provide a URL instead.

3.4 Screen Control and Visualizations

Command Parameters Effect
SwitchScreen screen (string) Brings the named screen to the front on every display. Built-in choices include Status, Orrery, Menu, Options, Radio, Spotify, AudioVisualization, News, WhatsNew, Camera, GPS, Youtube, and Twitch (additional custom screen names from your setup will also work).
ShowAudioVisualization visualization (string) Loads an audio visualization. Accepted names (case-insensitive): Cassette, Orrery, Equalizer, Full Screen Cover Art, Full Screen Equalizer, Starfield, Waveform, Spectrogram.

3.5 Space Traffic Control and NPC Voices

Command Parameters Effect
ListenToSpaceTrafficControl enabled (bool/0/1) Enables or disables space-traffic chatter.
SpaceTrafficVolumeUp None Steps the chatter volume up.
SpaceTrafficVolumeDown None Steps the chatter volume down.
ChangeSpaceTrafficVolume delta (int -100..100) Adds delta/100 to the chatter volume.
NPCVolumeUp None Steps NPC speech volume up.
NPCVolumeDown None Steps NPC speech volume down.
ChangeNPCVolume delta (int -100..100) Adds delta/100 to NPC speech volume.

3.6 Logitech Button Simulation and Interactive Prompts

Command Parameters Effect
ButtonUp, ButtonDown, ButtonLeft, ButtonRight, ButtonMenu, ButtonOK, ButtonCancel None Simulates the named Logitech G19 button press.
Button button (string) Sends an arbitrary button by name; accepts Up, Down, Left, Right, Menu, OK, Cancel, or Mono0..Mono3.
SelectInteractiveOption option (string) Chooses an answer on interactive overlays (case-insensitive match).

3.7 Navigation, Orrery, and Waypoints

Command Parameters Effect
OrreryZoomIn, OrreryZoomOut, OrreryFaster, OrrerySlower, OrreryResetView None Adjust the Orrery screen zoom, time scale, or reset view.
MarkPosition None Stores the commander’s current location in the GPS manager.
NextWaypoint None Cycles to the next saved waypoint.

3.8 Shopping List and Commodity Search

Command Parameters Effect
FindCommodity commodity (string), isBuying (bool) Searches Inara for the best buy/sell location near the current system.
AddToShoppingList commodity (string), amount (int) Adds or updates a shopping-list entry; amount <= 0 removes it. Commodity names are fuzzy-matched.
ReadShoppingList None Speaks the current shopping list aloud.
ClearShoppingList None Empties the shopping list.

3.9 Status Queries

Command Parameters Effect
GetStatus None Returns a LocationDTO describing commander ranks, ship, system/station, planetary coordinates, power settings, and dozens of boolean flags (IsDocked, IsInSuperCruise, etc.).
GetWhatsPlaying None Returns an AudioMetadataDTO with station, artist, album, title, and base64-encoded coverArt.

3.10 Messaging and Logging

Command Parameters Effect
ShowMessage message (string) Displays a toast message on-screen.
Speak text (string), useCache (bool, optional, default false) Sends raw TTS to the ship board computer; cached requests reuse generated audio when useCache is true.
SpeakMessage key (string), args (array, optional) Speaks a localized Ship AI line. Provide args as a JSON array that fills format placeholders, e.g. "args": ["Jameson", 42].
Log message (string) Writes an informational line to log.txt when verbose logging is enabled.
LogError message (string) Writes an error entry to log.txt (always logged when logging is enabled).

Boolean parameters accept JSON true/false or 1/0. String comparisons ignore letter case unless noted. When a payload omits an optional property the handler falls back to safe defaults.

4. Working with curl

4.1 Windows PowerShell (curl.exe)

curl.exe http://localhost:32123/remote-control ^
  -H "Content-Type: application/json" ^
  -d "{\"command\":\"ChangeVolume\",\"delta\":15}"

4.2 Windows PowerShell (Invoke-RestMethod)

Invoke-RestMethod `
  -Uri http://localhost:32123/remote-control `
  -Method Post `
  -ContentType application/json `
  -Body (@{ command = "SwitchScreen"; screenName = "Status" } | ConvertTo-Json)

4.3 macOS / Linux curl

curl http://localhost:32123/remote-control \
  -H "Content-Type: application/json" \
  -d '{"command":"GetStatus"}'

5. Using Postman

  1. Create a new POST request with URL http://localhost:32123/remote-control.
  2. In the Body tab choose raw and JSON.
  3. Paste the payload, for example:
    {
      "command": "ListenToRadiostation",
      "name": "Radio Sidewinder"
    }
    
  4. Send the request and inspect the JSON response in the lower panel.
  5. Save the request in a Postman collection if you want reusable automations.

6. Status Checks and Logging

7. Troubleshooting

Symptom Fix
curl: (7) Failed to connect Ensure EliteG19s is running and Webhooks.IsEnabled is true. Confirm the port is open via the health endpoint.
HTTP 403 or 500 Inspect log.txt for details and verify the payload matches the expected parameter names.
Command succeeds but nothing happens Confirm the target feature (e.g., Spotify) is configured inside EliteG19s and the command name is correctly cased.
Need remote access Tunnel the localhost port (e.g., via SSH or ngrok) and secure it with authentication at the proxy layer.

8. Automation Platform Samples

8.1 Windows Task Scheduler (PowerShell)

Use a scheduled PowerShell script that posts JSON with Invoke-RestMethod. Below shows two ready-to-save snippets.

# Morning volume boost at 07:30
Invoke-RestMethod -Uri http://localhost:32123/remote-control -Method Post -ContentType application/json -Body (
  @{ command = "ChangeVolume"; delta = 15 } | ConvertTo-Json
)

# Shift the display to Status screen before play sessions
Invoke-RestMethod -Uri http://localhost:32123/remote-control -Method Post -ContentType application/json -Body (
  @{ command = "SwitchScreen"; screen = "Status" } | ConvertTo-Json
)

Assign each script to a basic task and run powershell.exe -File c:\Path\To\Script.ps1 as the scheduled action.

8.2 Node-RED Flow (HTTP Request Node)

Import the following flow to trigger webhook calls from inject buttons. Each inject node sends one JSON payload to /remote-control.

[
  {
    "id": "flow-root",
    "type": "tab",
    "label": "EliteG19s Webhooks"
  },
  {
    "id": "inject-volume",
    "type": "inject",
    "z": "flow-root",
    "name": "Volume +10",
    "props": [{ "p": "payload" }],
    "payload": "{\"command\":\"ChangeVolume\",\"delta\":10}",
    "payloadType": "json",
    "repeat": "",
    "once": false,
    "wires": [["http-elite"]]
  },
  {
    "id": "inject-spotify",
    "type": "inject",
    "z": "flow-root",
    "name": "Play Spotify Preset",
    "props": [{ "p": "payload" }],
    "payload": "{\"command\":\"ListenToSpotifyPlaylist\",\"playlist\":\"Morning Mix\"}",
    "payloadType": "json",
    "wires": [["http-elite"]]
  },
  {
    "id": "http-elite",
    "type": "http request",
    "z": "flow-root",
    "name": "EliteG19s Webhook",
    "method": "POST",
    "ret": "obj",
    "url": "http://localhost:32123/remote-control",
    "headers": [{ "key": "Content-Type", "value": "application/json" }]
  }
]

Deploy the flow, then click the inject buttons to test.

8.3 Home Assistant Automations (REST Commands)

Define reusable REST commands in configuration.yaml, then call them from automations.

rest_command:
  eliteg19s_switch_screen:
    url: "http://localhost:32123/remote-control"
    method: post
    headers:
      Content-Type: application/json
    payload: '{"command":"SwitchScreen","screen":"Orrery"}'

  eliteg19s_radiostation:
    url: "http://localhost:32123/remote-control"
    method: post
    headers:
      Content-Type: application/json
    payload: '{"command":"ListenToRadiostation","station":"Radio Sidewinder"}'

automation:
  - alias: "Daily Orrery Overview"
    trigger:
      - platform: time
        at: "20:00:00"
    action:
      - service: rest_command.eliteg19s_switch_screen

  - alias: "Start Evening Radio"
    trigger:
      - platform: state
        entity_id: person.commander
        to: home
    action:
      - service: rest_command.eliteg19s_radiostation

Reload Home Assistant commands and automations, then use any trigger (time or presence) to dispatch the payloads.

9. Next Steps