I have an iSpindel (tilt-type hydrometer) that send the values it captures up to Ubidots for storage. I'm sure there will be a few other brewing devices out there that use Ubidots too.
I quite frequently download and delete data values from Ubidots. For example, I will download all my temperature and gravity reading from the start of fermentation to the end and put them in my brew log; I usually delete all the values once I have done this too. Unfortunately, it is quite cumbersome handling large numbers of values in Ubidots (I may have several thousand readings after a long fermentation) because you can only download/delete 100 values at a time through the Ubidots web interface and the the API is difficult because you have to convert dates to epoch timestamps and format long urls.
To make it easier for myself I have put together a little script to do it for me and thought I would share it here to give a little back to the forum. It is written in PowerShell so will run on all recent(ish) versions of windows. Right-click the link below and select "Save link as..", or whatever the equivalent is in your browser, to download it. It is a plain old text file.
http://haslenet.co.uk/wp-content/upload ... s.v3.7.txt
This script is designed to make working with data stored in Ubidots a little easier. It allows you to:
1. Request a list of all your devices from Ubidots and select the devices you want to work with.
2. Request a list of all variables on the devices selected, and select the variables you want to
work with from each device
3. Choose whether to work with all values from the varibales selected or choose a specific date-time range.
4. Lets you work in local time and converts it to Unix epoch timestamp for you
5. Download and save all variable values selected (optional)
6. Converts Unix epoch timestamp to local time for all values
7. Delete all variable values selected (optional)
8. Handles Ubidots paging - Ubidots will only return 100 results per page by default - so that you can deal
with all your data at once
9. Handles Ubidots request rate limits, session and gateway timeouts so that you can process a large number
of requests at once.
1. Download and save the file 'Ubidots.v.x.x.txt' to your local computer
2. Open the file with a text editor and find the line '`$apiKey = `"Your-UbidotsAPIkey`"' (it is just below
this message in the file). Replace <Your-UbidotsAPIkey> in the line with your own Ubidots API key
3. If you are not using the free version of Ubidots then you will also need to replace the variable in the
line '`$baseUri = `"https://things.ubidots.com/api/v1.6`" with the correct URL for your version of Ubidots
4. Save the file.
5. Browse to the file you have just saved and rename it from 'Ubidots.v.x.x.txt' to 'Ubidots.v.x.x.psi'
6. Right-click the file and select 'Run with PowerShell'
7. Several message boxes will be presented to you you when you run the script. Check the title at the top
of each box and any text in the box carefully before selecting any options and continuing.
Warnings and Disclaimer
The script will (optionally) delete the selected values so read all the prompts that appear carefully
The script will convert all Unix epoch timestamps in Ubidots to your local time when saved locally
I have created this script for my own use and am sharing it for the convenience of other.
If you choose to make use of it then you do so entirely at your own risk.
I hope this is useful to a few of you. If you have any suggestion on how to improve it then let me know and I will do it if it's not too time consuming.
If you use Beersmith, Promash, Beer Engine, or whatever, this is the place to discuss pros, cons, tips and tricks
2 posts • Page 1 of 1