Publish User's Scoresaber information to MQTT data can be used in HomeAssistant, OpenHAB or any other tool that can read MQTT topics
- Install Python + paho-mqtt libary:
apt install python3-paho-mqttorpip install paho-mqtt - Put the python file
scoresaber2mqtt.pyin/usr/local/bin - Put the config file
/etc/scoresaber.iniin/etc - Edit the config as needed
I usually run the script manually first and check with an MQTT Tool if the metrics are updated correctly.
This tool does the job for me: https://github.com/thomasnordquist/MQTT-Explorer
After that you need to call the script regulary to keep the metrics up to date.
I recommend using an unpriviledged user and crontab entry for that:
# Get Scoresaber ranking every 5 minutes
*/5 * * * * /usr/local/bin/scoresaber2mqtt.py
currently the following values are being exposed:
id, name, profilePicture, country, pp, rank, countryRank, histories, permissions, banned, inactive
mqtt:
sensor:
- name: "Scoresaber Rank Global"
state_topic: "games/beatsaber/rank"
- name: "Scoresaber Rank Country"
state_topic: "games/beatsaber/countryRank"
- name: "Scoresaber PP"
state_topic: "games/beatsaber/pp"
unit_of_measurement: "pp"