Sunday, November 09, 2014

Airpi streamed dashboard

Hello guys,

Following my last post about Streametry. This weekend I have connected my Airpi mini weather station to the new try me online Streametry service and following the instructions from the Streametry blog I was able to setup a nice weather dashboard to visualize the data in real time.

Room weather dashboard
I also tricked the print.py into printLarge.py code to print large numbers on the terminal by using Figlet tool. So I can visualise some data through the mini 3.5 screen that I have for the raspberry pi hacks. Next weekend I will try to add the time and other values so I can see all data through the mini screen as well as from the dashboard.

To get this up and running you first need to buy and if you like electronics also build the Airpi shield kit.

Airpi room weather station
Then just follow the steps of Airpi web site to understand and setup the Airpi. At the time of writing the Xively service (dashboarding tool) is not automatically available after you register. Fortunately you can get same or even better results by using the Streametry service.

After the Airpi is working by printing values on the screen, then you just need to clone the streametry/Airpi forked project. The guys from streametry project implemented the streametry.py plugin and added the configuration into the outputs.cfg as well. In order to make this plugin work, all what you need to setup is the url value in the outputs.cfg.

To get the right URL you just need to prepare a new application in the try me streametry service. Just add an application name and click the button "Open" (for now no registration overheads, cool).
Then click the "REST" tab and copy the url of the "curl" command. Paste the url in the outputs.cfg file under the streametry section.

Try me streametry service
In streametry the url format follows a structure like "http://try.streametry.com/app/collection/id". The "app" value is what you typed in the previous step. The "collection" is whatever name you want to identify this family of data, for example I used "airpi" and the id is the specific identification for this device, i.e I used "room1" for this first airpi device. (Hopefully I will have airpis all around the hose, some day)

Once you have your url, just edit the outputs.cfg file accordingly. Then run the airpi.py and the values should be uploading to your streametry playgournd application. You may need to refresh the playground page and the new collection should be available in the step 1 collections drop down. The data should be visible in the JSON editor area to the left. At this stage you can have fun playing with the data by writing different queries on the right side query editor. For help take a look at the documentation and the examples button.

Freeboard icon
The last step is to configure the dashboard with the widgets that you like. At the top right of the playground page you will find the Freeboard icon. The streametry guys implemented the Freeboard plugin for Streametry so you can select the Streametry data source. Once you are in the generic dashboard just click the top middle "tool" icon and add a new Data Source. For example I used Airpi as name and the query should be the stream of you application, for me was "streametry("airpi"). The application name that you used in the url.

Then you only need to add or modify the freeboard widgets as you wish. The only important think to take care is the value field. In this field you need to configure what is the value or function that the widget should use to load values. You can use the playground query editor to validate functions and or you can define a specific value of the JSON data structure you want to use. I.e for temperature I used "datasources["Airpi"].room1.Temperature".

From here you can play as much as you want to get your beautiful weather dashbaord. ;-)

I hope it helps, all the best.

Leave me any comment if you need help.

Posted by Marc Andreu.

No comments: