Connecting a Pachube sensor to Paraimpu with few clicks

IMPORTANT: This tutorial has been updated due to the recent Pachube Web site changes, please check the NEW VERSION.

Goal: register on Paraimpu a datastream from Pachube and then connect it to our twitter virtual actuator and configure the connection such as a tweet is posted only if a given condition is satisfied. Once the Pachube sensor is registered you can connect it to every Paraimpu actuator available in your dashboard.

First step: Please Log on Pachube and Paraimpu with the respective credentials. If you don’t have credential in one or both systems then create your profiles according to the respective procedures.

Second step:

On pachube select a feed, for instance

For that feed select a datastream, then click on *embed,history,triggers,etc* and you’ll get a form where you can see the URL for that data stream. In the example is

append a trailing “.json” to the URL to obtain

This URL will produce data as follows:


Third step:
Go on paraimpu and create a new pachube sensor from palette. Configure it as in the following picture

You’ll find your pachube API key under pachube -> profile -> settings
Then click register and the sensor is ready. After some minutes data will flow. At the moment (release nuntereggaepiu) the polling time is fixed in 120sec. In next releases this value will be fully configurable.

Fourth step:
Create a twitter actuator in the workspace, unless you already have one.

Fifth step:
Create a connection between the pachube datastream and twitter. To do that click the follow button on the sensor

and select the existing twitter in the list of available actuators

Sixth step:
Configure the new connection clicking on the *manage* wheel
The connection details will be showed
Filters and mappings are expressed by means of Javascript expressions. Given the JSON structure of pachube records the condition foo.current_value>=14 that only records with temperature greater or equal to 14 degrees are sent from sensor to actuator.
Similarly, the mapping is defined by a condition and by a string containing a template (expression between <% and %>)

Leave a Reply

© 2014-2015 Paraimpu Srl . Powered by Blogger.