As promised a few weeks ago, we're going to be rolling out a whole host of new features that take Pachube to a whole new level. The Pachube dev team has been hard at work the past few weeks and we're delighted to announce the first of these new features, something we've been planning for months: triggers.
Also known as webhooks ("User-defined HTTP callbacks for push, pipes and plugins") and notifications, we're calling them triggers because we want to make clear that they enable Pachube datastreams actually to plug into and provoke (i.e. trigger) remote actuators, devices, scripts, buildings, etc. Skip here for a short tutorial on using triggers or read on for why you should be using them!
Up until now, Pachube has largely been a "pull" service: you've been able to send data to us as and when you want (i.e. "push" to us) or have us request data from you as necessary (i.e. we "pull" from you), but in order to get data out of Pachube you had to repeatedly poll (i.e. you could only "pull" from) Pachube to discover datastream changes. With the introduction of triggers, Pachube is now just as good at receiving (and storing) data as it is at acting upon (and sending out) data to remote devices, actuators and buildings: just what a "patchbay" should be!
With triggers, you set up conditions on datastreams (on anyone's datastreams, not just your own), and when those conditions have been satisfied (e.g. change of value, value is greater than threshold,value equals etc.) Pachube will push (by HTTP POST) a notification to the URL of your choice. This might be a php script that sends an email; or that posts to twitter; or connects to an SMS gateway to send a message to your mobile phone; or it might be a microcontroller that is able to act on the HTTP POST to actuate some physical device (like a lightswitch, a garage door, a window louvre, etc.).
You might build an alarm system: put a trigger on a datastream that measures temperature in your home and, when the temperature exceeds a certain amount, have it send you an SMS, switch on a alarm light in your office and switch off the heating system in your home. Or create a quick PHP script that sends you an email when your electricity consumption exceeds a certain amount. Or draw inspiration from BERG London and build a toy that stands to attention when your lover comes online by using the Status2Pachube Pachube.app combined with a trigger to alert to changes of online status, pointing at an Arduino hacked with an inexpensive toy. Triggers also make PachTweet even more useful: now it's much easier to use Twitter (private) direct messages to trigger physical artefacts and devices remotely.
See a short tutorial on creating triggers here for further information on adding and using triggers via Pachube feed pages; or skip the web interface and use the API to create your triggers.
For us, this is a major leap forward towards our vision of providing a planetary "patchbay" -- we're closer than ever to being able to plug anything into anything else!
In other news, we've also:
- made it much easier to access history, archive, PNG graph and Flash graph code from individual datastreams, by providing an "embed,history,triggers,etc" link for each datastream.
- updated the feed registration/edit page so that you can now add and specify units using the web interface -- long-requested, it just took us a while to get round to implementing it!
Do let us know what you think!

Re: Triggers bring 'push' capabilities to Pachube
Congrats! Looking forward to try this.
Re: Triggers bring 'push' capabilities to Pachube
We're looking forward to see what you make of them!
Re: Triggers bring 'push' capabilities to Pachube
@support: http://community.pachube.com/triggers#comment-644
Re: Triggers bring 'push' capabilities to Pachube
First of all, congratulations with this impressive application. A great step towards the Internet of Things.
What I wanted to ask: the application now focuses on reading data from sensors. Are you also thinking about the other direction, i.e. manipulating the real world through the Pachube interface?
Re: Triggers bring 'push' capabilities to Pachube
Yes, of course, that's why it's called "Pachube" (i.e. "patchbay"...) and that's exactly what 'triggers' are all about! The reason that sensors have tended to predominate is that (a) they're much easier to comprehend conceptually; (b) it's much easier to understand technically how they 'connect' to the web and (c) because their data is coming inwards to the website, they are much more evident on the website itself. However, there is just as much data going outwards. Interestingly, we are getting many many thousands of API requests per hour (i.e. far more is going on machine-to-machine than people accessing the website) but we have no real track on exactly what type of systems the data is going outwards to, we don't have a great handle on what kind of physical manifestations these are having in the physical world. (That's why we released this video: http://community.pachube.com/node/225 which shows how much data we're getting both inwards and outwards). Having said that we do know that there are people triggering physical objects remotely, switching on and off lights, actuating building control systems, making remotely coupled devices, etc.
Re: Triggers bring 'push' capabilities to Pachube
Even better! Thx for your quick response.
Re: Triggers bring 'push' capabilities to Pachube
I've created a simple Sinatra web app that I've pushed up to http://www.heroku.com to handle the trigger and send me an email. Fork away and extend. http://github.com/kitplummer/pachutarget
Re: Triggers bring 'push' capabilities to Pachube
Is it possible to have the trigger go just once, so that the first time the value goes below 100 or above 900, send an alert, but not all the times the value bounces between 0 and 100 or 900 and 1024, for example?
Re: Triggers bring 'push' capabilities to Pachube
Hate to say this but I suspect we'll be wanting a bit more control for example
TriggerFireState
State = Always //fires for every update where condition is true
State = OnCondition //fires when condition is true
OnCondition = N times //will fire for n instances
OnCondition = N times/Min,hr,day /fires only n times per time period
State = off //doesn't fire
etc.
Just a rough draft
Re: Triggers bring 'push' capabilities to Pachube
Perhaps it could be simplified slighty:
- Have a 'trigger' value, and a 'reset' value.
- Have the ability to set how many alerts should be sent for a trigger.
- Have the ability to specify how far about the alerts should be.
- Have the ability to specify sleep times (no alerts during a predefined time).
For example, if you had a sensor with had a trigger value of 100, you might set the reset value of 95. This way, if the live value is teetering between 99 and 100 you wont get heaps of alerts.
Just some food for thought to add to the discussion.
Re: Triggers bring 'push' capabilities to Pachube
I got around my current problem of too many notifications as the state changed but didn't hold at a fixed value by modifying the value that is read before sending - if the number is below some threshold, send 0, if above, send a fixed high value. That way I only get the trigger once for each time it changes state.
Maybe this can be done already, but I think it would be useful to be able to specify the message sent for a given value of trigger level - so for me if the value changes from high to low - I send a message saying 'the device is off' and if going from low to high ' the device is on'.
Re: Triggers bring 'push' capabilities to Pachube
The plan in the short term is to enable an option for a trigger to "fire once" or "fire continuously"; but it would be good to get in some hysteresis options too. We'll see if we can add those to the next update.