Want some silly badges? Of course you do!
Do you want the raw sensor data from your Beddit but it's locked away with no API? Well have I got a bash script for you.
Beddit (now Apple owned) are shutting down their cloud services so this is a quick hacky script to allow you to download all your sleep data in raw format. The output is in JSON and came from a lot of reverse engineering the Beddit app itself.
Once you've run this, you will get something like the following
- Go into the folder you wish to empty the raw data into
- Clone Repo/Download Script
- Change the BEDDIT_USERNAME to your Beddit account username
- Change the BEDDIT_PASSWORD to your Beddit account password
- Change any other variables you see fit
- Run the script (see below)
- Wait as it creates you a login token and downloads data
$ bash ./get_beddit_cloud_data.sh
By default, it will create a folder called "raw_export_files" in the working directory. You can amend this
This is clunky and could be optimised so many ways. It is crude for a reason, they can turn off these APIs at any time. Its all large JSON files. I've split the maximum limit of sessions/sleep records to 200 but if you go beyond about 300 on the Sessions data, it will timeout and you will get nothing. 60s max execution time it looks like.
Q: How do I use it
A: See the instructions above. Everything is commented so go nuts.
Q: Will it work on Mac/Linux
A: Yes, if you make sure you have bash, curl and sed; you should be all set
Q: Why didn't you mention windows?
A: Eh, no time to test! Feel free to convert it to powershell but you might as well use the Bash on Windows
Q: Why did you make this?
A: Apple turned a great product into a pretty unusable product by turning off all syncing features and they don't even know how to replace a faulty device.
Q: It has a lot of JSON... gonna combine anything or interpret it?
A: Nah, just want my data
Q: Any plans on adding [insert feature name here]?
A: Unlikely, it's just a quick fix for a problem and the API will go down soon so this project will die at that point.
Q: How did you figure this out?
A: Was annoyed with slow syncing and spent a 20 hour caffeine filled explore of their API. Can't say much but it holds up to my abuse testing
I would say if I've helped you, feel free to donate some magic internet money over to: bitcoin:1NEJcdBSbmGnsihKUiK5h4XrQ8rA3r4tgk
MIT License
Copyright (c) 2018 Luna Frankland
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.