Things you need
Backend Setup
- Get your MongoDB URI, it should be something like this:
mongodb+srv://<username>:<password>@xxx.xxxxx.mongodb.net/<database>?retryWrites=true&w=majority
- Deploy the server and start it with
npm start
.
Frontend Setup
- Rename
.env.template
to.env
. - Edit
.env
toNEXT_PUBLIC_SERVER_URI=https://your_servers.uri
. - Build and deploy.
Phone Setup
This was all tested with a Mi Band 4.
This setup only works with Android Devices.
- Setup your Mi Band on Notify for Mi Band.
- Create a new profile on Tasker.
- On Event/Trigger Intent Received type
com.mc.miband.heartRateGot
. - Create a Task:
- Variable Set: Name
%heartRate
To%value
. - HTTP Post:
- Server:Port = Your server's URL.
- Path =
/send
. - Data / File =
hr=%heartRate
. - Content Type =
application/x-www-form-urlencoded
.
- Variable Set: Name
How does this work?
Everytime your Mi Band registers your Heart Rate it will trigger a Tasker event, in this case it will send an HTTP POST request to your server (backend) that will store the value of the Heart Rate and the time (Epoch) of the request in MongoDB. By opening the website (frontend) it will request your heart rate values to the server which will respond with data gathered from the database.