This is a bare bones project to turn your ESPHome devices into lights for StepMania. It's not in a very polished state yet, so you'll fare better if you have a knowledge of Python + Linux.
This also targets a relatively niche intersection of the IoT and rhythm game community. If you feel right at home with all this stuff, we should probably hang out. :P
When you configure a new device, create a light component called main_light. This will be used to turn the light off completely when StepMania starts and exits.
You can then use other light components or partition components to create individual lights. As long as you give them a name from the following list, they will be picked up automatically.
marquee_upper_leftmarquee_upper_rightmarquee_lower_leftmarquee_lower_rightbass_leftbass_right
player_1_menu_leftplayer_1_menu_rightplayer_1_menu_upplayer_1_menu_downplayer_1_startplayer_1_selectplayer_1_backplayer_1_coinplayer_1_operatorplayer_1_effect_upplayer_1_effect_downplayer_1_1- so on and so forth
player_1_19
These repeat for player_2.
This is an example ESPHome configuration for a D1 Mini with the RGB Shield, which has 7 WS2812B LEDs in a circle. The center LED is set to blink with the start button on the cabinet, and the LEDs around it flash with the bass lights.
esphome:
name: itglights1
platform: ESP8266
board: d1_mini
wifi:
ssid: "your_password"
password: "your_password"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Itglights Fallback Hotspot"
password: "fallback_password"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "itglights"
reboot_timeout: 0s # This is necessary so the device doesn't reboot when there is nothing controlling it
ota:
password: "itglights"
light:
- platform: partition
name: "player_1_start"
segments:
- id: main_light
from: 0
to: 0
- platform: partition
name: "bass_right"
segments:
- id: main_light
from: 1
to: 6
- platform: fastled_clockless
chipset: WS2812B
id: main_light
pin: D6
num_leds: 7
rgb_order: GRB
name: "main_light"
gamma_correct: 1.8
color_correct: [70%, 70%, 70%]
Edit your Preferences.ini file, and
- set the
LightsDriver=line toLightsDriver=SextetStreamToFile. - set the
SextetStreamOutputFilename=line to a path StepMania can write to, e.g.Save/StepMania-Lights-SextetStream.out
If you're on Linux, create the named pipe.
mkfifo /path/to/stepmania-5.0/Save/StepMania-Lights-SextetStream.outIf you're not on Linux or want more info, check the SextetStream lights documentation.
Install the required dependencies.
pip3 install -r requirements.txtMake a copy of the sample configuration file in the script's folder.
cp config.yml.sample config.ymlOpen the configuration file, and set stepmania_sextet_file to the path of the SextetStream named pipe.
Under the lights section, add entries for each of your devices. password should correspond to the API password in the ESPHome device configuration.
Start the script.
python3 main.pyYou have to start the script first in order for StepMania to run! If nothing is reading the SextetStream file, StepMania will get stuck.
Now you can launch StepMania. Enjoy the light show!