Skip to content

Instantly share code, notes, and snippets.

@ShayBox
Last active October 8, 2023 02:35
Show Gist options
  • Save ShayBox/b2b3229f69f9d4a304ecc9fb9ebf84e3 to your computer and use it in GitHub Desktop.
Save ShayBox/b2b3229f69f9d4a304ecc9fb9ebf84e3 to your computer and use it in GitHub Desktop.
Mi Band 5 to VRChat OSC

I couldn't get Pulsoid to work with Zepp Life (new Mi Fit), and HypeRate only supports Mi Band on iOS
Install Notify for Mi Band, Tasker, Termux (F-Droid/GitHub), Termux Tasker (F-Droid/GitHub)
Enable Tasker support in Notify, enable External access in Termux
Install Python in Termux, then install python-osc with pip
Create an Intent task for com.mc.miband.heartRateGot, Create a Termux action to python, provide the script in args and use %value to pass the heartrate to the script
Here's my script, change the IP to your computers LAN address, the port is correct for VRChat.
I would test it on your computer first to make sure you have OSC working, use the debug window.

import sys
from pythonosc import udp_client

client = udp_client.SimpleUDPClient("127.0.0.1", 9000)

rate = int(sys.argv[1])
rates = [float(i) for i in f"{rate:03d}"]

prefix = "/avatar/parameters/"
vrcosc = "VRCOSC/Heartrate/"

client.send_message(prefix + "HR", rate)
client.send_message(prefix + vrcosc + "Enabled", bool(True))
client.send_message(prefix + vrcosc + "Normalised", rate / 240)
client.send_message(prefix + vrcosc + "Hundreds", rates[0] / 10)
client.send_message(prefix + vrcosc + "Tens", rates[1] / 10)
client.send_message(prefix + vrcosc + "Units", rates[2] / 10)

If you'd like help my Discord is Shay#2000
I won't help setup a prefab on your avatar, I recommend using VRCOSC's Heartrate prefab or HRtoVRChat prefab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment