Skip to content

NekuSoul/MqttTheSpire

Repository files navigation

Logo

MqttTheSpire

This is a small mod for Slay the Spire 2 that publishes live statistics of your current run to an MQTT broker, allowing you to integrate it into Home Assistant and such.

What this can do so far

  • Sends a small number of events to an existing MQTT broker (like Mosquitto).
  • Basic connection options for a MQTT broker.
  • Customizable MQTT topic prefix.

What this does not (yet) do

  • Support for more complex MQTT configurations.
  • Support for automatic Home Assistant sensor discovery.
  • Support for lots of more potential events that are available in the StS2 API.

If there's a specific thing you'd like to see tracked, feel free to open an issue.
Similarly, if there's something preventing you from connecting to a MQTT broker, also open an issue.
Pull requests are also welcome.

Installation

Important: You will need to have a working MQTT broker running before you can use this mod.

Otherwise, the nstallation is similar to the manual installation process of any other mod.

  1. Download the latest release.
  2. Extract the archive and copy 'MqttTheSpire' folder to [STS2-Install-Dir]/mods/.
  3. Edit the config file. (See below)
  4. Start the game.
  5. ???
  6. Profit.

If the game shows that the mod loaded with errors, there's a high likelyhood that the connection to the MQTT broker could not be established.

Configuration

The mod is configured using the config file. While the file is a simple JSON file, do not change the extension to .json. Otherwise, the game will try to load the config.json file as a mod (and fail).

  • Host: The address of your MQTT broker (default: localhost).
  • Port: The MQTT port (default: 1883).
  • User: Username for the MQTT broker (optional).
  • Password: Password for the MQTT broker (optional).
  • Topic: The base topic for all published messages. (default: slay_the_spire_2)

Currently available MQTT Topics

All topics are prefixed with the value of Topic from the config (e.g.: slay_the_spire_2/run/total_floor).
Important: Topics are not immediately published when the game starts. Starting a run should publish most of these, though.

Subtopic Description Example
run/start_time Timestamp when the last run started. (yyyy-MM-dd HH:mm:ss). 2026-03-22 16:52:47
run/ascension_level The current ascension level. 4
run/player/character The character ID being played. IRONCLAD
run/game_mode Current game mode. Standard
run/total_floor Total floors climbed. 16
run/room_type Type of the current room. Elite
run/player/gold Current gold amount. 379
run/player/max_hp Maximum HP. 72
run/player/current_hp Current HP. 37
run/player/current_block Current Block. 8

A few additional notes

  • This mod has been exclusively developed and tested on Linux so far, using the native version of the game. While it should work on any platform, it is not guaranteed. If you get this mod working (or not), I'd appreciate feedback.
  • This mod makes use of MQTTnet for the actual communication with the MQTT broker.
  • Unlike a lot of other mods currently out there, this mod exclusively uses hooks already provided by the StS2 API and does not rely on Harmony at all. This should make it relatively stable against future updates, but given the game just released into Early Access, who knows.
  • If you liked this mod, also check out The Guy Mod, a fun custom character for the original Slay the Spire.

License

See LICENSE file. (MIT)