Enter: The New Initial State Streamer

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.

single-board computer, streaming, log data, wireless data transfer, initial state, visualize, visualization, collect data

 

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 rachel@initialstate.com.
# If you have any questions, please email us! support@initialstate.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.

14 comments On Enter: The New Initial State Streamer

  • Pingback: Use a Raspberry Pi to Help You Bake a Turkey | Initial State ()

  • Pingback: Tutorial: Turn your Raspberry Pi into a Hamster Fitness Tracker | Initial StateInitial State | ()

  • Pingback: IoT 101 Project: Stream Temperature from your Raspberry Pi | Initial StateInitial State | ()

  • Pingback: Upcoming Feature Teaser - Real-Time Updating | Initial State ()

  • I have installed the streamer with the example script. When I run it nothing shows up in my log.

    • Hi Jim!

      Hmm, if the bucket is showing up, then it is not an error with your access_key, and it shouldn’t be a streamer problem. One way to see what is happening with the streamer is to place “debug_level=2″ inside of your Streamer constructor like so:
      streamer = Streamer(bucket_name=”Python Stream Example”, access_key=”YourAccessKeyAutopopulated”,debug_level=2)

      Once the script finishes, you can see exactly what happened when the script tried to ship the events. If you let me know what errors/strange outputs you see it would really help me pinpoint the problem. Also, are you using the automagically generated script from the curl command or did you manually create it?

      Sorry for the issue! We’ll figure this out.

  • Hello,
    I have a problem in all my streaming trials. every time it points to the line ” From ISStreamer.Streamer import Streamer ” in the example script

    Any suggestions?

    Best regards,
    salem

    • Make sure you have “from ISStreamer.Streamer import Streamer” in that line (case sensitive including that “from”). If you get an error saying that it cannot find the ISStreamer module, make sure the module got installed without any errors (run the “\curl -sSL https://get.initialstate.com/python -o – | sudo bash” command and ensure there are no errors).

      • I’m getting the same error. I ran the curl command for the install and it was successful and I chose to install the example script and then ensured that the “from ISStreamer.Streamer import Streamer” line is correct. Whenever I run it I get the following:

        Traceback (most recent call last):
        File “is_example.py”, line 8, in
        from ISStreamer.Streamer import Streamer
        Import Error: No module named ISStreamer.streamer

        This is taking place on a raspberrypi 2 with python 3.2

        • Hi Gavin,

          Did you manage to find a solution to the problem. Have the same problem on Raspberry Pi3 with Python 3.4.2 ……

          • John, what do you see when you do pip list in your bash? I’m curious if the module was installed only for a different python version.

            Many times, python v3 is symlinked as python3 and python v2 is symlinked to python. Additionally, pip3 and pip are symlinked to their respective pythons. Shoot over the following info from these commands when you get a chance:
            – pip list
            – pip3 list
            – python –version
            – python3 –version

  • Hi David.

    Thank you for the response :-). In reference to the pip and python version,
    ………………………………………………………………………………………………….
    pip list,
    argparse (1.2.1)
    chardet (2.3.0)
    colorama (0.3.2)
    gpiozero (1.1.0)
    html5lib (0.999)
    ISStreamer (0.1.1)
    lxkeymap (0.1)
    mcpi (0.1.1)
    ndg-httpsclient (0.3.2)
    numpy (1.8.2)
    pexpect (3.2)
    picamera (1.10)
    pifacecommon (4.2.1)
    pifacedigitalio (3.1.0)
    Pillow (2.6.1)
    pip (1.5.6)
    pyasn1 (0.1.7)
    pygame (1.9.2a0)
    pygobject (3.14.0)
    pyOpenSSL (0.13.1)
    pyserial (2.6)
    reportlab (3.1.8)
    requests (2.4.3)
    RPi.GPIO (0.6.2)
    RTIMULib (7.2.1)
    sense-hat (2.1.0)
    setuptools (5.5.1)
    six (1.8.0)
    spidev (3.0)
    urllib3 (1.9.1)
    wheel (0.24.0)
    wsgiref (0.1.2)
    ………………………………………………………………………………………………….
    pip3 list, ( No ISStreamer in the list I noted )
    chardet (2.3.0)
    colorama (0.3.2)
    evdev (0.6.0)
    gpiozero (1.1.0)
    html5lib (0.999)
    mcpi (0.1.1)
    numpy (1.8.2)
    pgzero (1.1)
    picamera (1.10)
    pifacecommon (4.2.1)
    pifacedigitalio (3.1.0)
    Pillow (2.6.1)
    pip (1.5.6)
    pygame (1.9.2a0)
    pyserial (2.6)
    python-apt (0.9.3.12)
    python-debian (0.1.27)
    requests (2.4.3)
    RPi.GPIO (0.6.2)
    RTIMULib (7.2.1)
    sense-hat (2.1.0)
    setuptools (5.5.1)
    six (1.8.0)
    spidev (3.0)
    urllib3 (1.9.1)
    wheel (0.24.0)
    …………………………………………………………………………………………………………………
    python –version,
    2.7.3
    …………………………………………………………………………………………………………….
    python3 –version,
    3.4.2
    …………………………………………………………………………………………………………….

    PS I am new to Python and Raspberry environment.
    Interesting to note that the ISStreamer is not listed in the pip3 list.

    Regards
    John

  • David,

    I managed to get it working from the Python 2.7.9 shell based on what was detected with the pip listing above that you requested. What would be then the options to get it working from pip3? Would like to get it working in pip3 as the program will start with bootup to do measurements.

    Regards
    John

  • sudo pip3 install ISStreamer

Leave a reply:

Your email address will not be published.

Site Footer