Late on a Friday evening with only the dim glow of a monitor lighting the office, something came into being that could change the way we collect and view data forever. Birthed and executed by Initial State’s greatest minds, we are proud to present the public with the super simple Data Streamer.
Ever wanted to get information from your sensors to your laptop without extracting and reformatting and downloading countless helper programs? Want your script to broadcast certain messages or values as it executes in an environment more friendly than the command window? Never worked with a single-board computer before and want to just understand what on earth your code is doing? Well, you’re in luck because our streamer will allow you to do just that. We even show your data to you as easy to understand waves, bits, flags, and text. The best part? You can install our Streamer and run your first script (currently has to be Python) in less than 2 minutes!
You can find all of this handy-dandy information on our streaming page, but I’m going to give you all a quick overview. Because that’s exactly what this whole process is. Quick. You can check out a step-by-step video of going from sign-up to streaming in less than two minutes at http://support.initialstate.com/knowledgebase/articles/503371-from-login-to-live-data-stream-in-2-minutes-2-00.
In the command window of your device (laptop, Raspberry Pi, BeagleBone Black, any device with internet access…), type:
\curl -sSL https://get.initialstate.com/python -o - | sudo bash
And hit enter. You will be asked to enter your password. The install will execute and a prompt will ask if you’d like to get an example script. If you enter “y” the script will ask where you’d like to save the script (this is also your chance to rename it). It will then require your Initial State username and password. This allows the API to retrieve your Access Key so you don’t have to copy it into your script!
Once you get the “All done!” message, you can find your newly created file. You will see this:
##### # This is a custom 'getting started' script, made with care for firstname.lastname@example.org. # If you have any questions, please email us! email@example.com ##### # Import the ISStreamer module from ISStreamer.Streamer import Streamer # Import time for delays import time # Streamer constructor, this will create a bucket called Python Stream Example # you'll be able to see this name in your list of logs on initialstate.com # your access_key is a secret and is specific to you, don't share it! streamer = Streamer(bucket_name="Python Stream Example", access_key="YourAccessKeyAutopopulated") # example data logging streamer.log("My Messages", "Stream Starting") for num in range(1, 20): time.sleep(0.1) streamer.log("My Numbers", num) if num%2 == 0: streamer.log("My Booleans", False) else: streamer.log("My Booleans", True) if num%3 == 0: streamer.log("My Events", "pop") if num%10 == 0: streamer.log("My Messages", "Stream Half Done") streamer.log("My Messages", "Stream Done") ## This is just an example, try something of your own! ## ideas: ## - solve world hunger, one bug fix at a time ## - create the worlds first widget ## - build an army of bug-free robot kittens # Once you're finished, close the stream to properly dispose streamer.close()
Just run it and you will see a bucket with the name “Python Stream Example” pop-up in your Initial State log shelf for your visualization pleasure!
If you decide to decline the example script, the install will complete and all you need to know are 3 little snippets of code:
# Import the ISStreamer module from ISStreamer.Streamer import Streamer ************************************************** streamer = Streamer(bucket_name="Python Stream Example", access_key="YourAccessKey") ************************************************** streamer.log("ValueTitle", value) # Once you're finished, close the stream to properly dispose streamer.close()
And now you can choose to insert streamer.log whenever you’d like to send data to your bucket!
If you think that’s pretty neat and want to try it out for yourself, sign up here!
If you’re still not convinced, we also have documentation for our nifty API.