From Pachube to Cosm

As Pachube was recently acquired and relaunched under the name Cosm, many readers wondered whether my Pachube samples still work with Cosm.

I tried out the HelloPachube sample of my book, using my old API key and my original Pachube sample feed ID. The sample program was otherwise unchanged, and Gsiot.PachubeClient was completely unchanged, i.e., still sending to api.pachube.com.

 

Fortunately, this worked fine without problems.

 

I then tried to create an entirely new Cosm account "gsiot". As Cosm looks quite a bit different from Pachube, this can be a bit confusing.

 

You need to create a "secure sharing key" first, this will be the API key. You can find the key management page through the "Keys" icon, see the left red oval marker below:

After you have clicked on "Create", you will see an API key that you can copy into HelloPachube.

 

The other red oval marker above indicates where you can change some account settings.

 

After I had created a new Cosm feed and restarted HelloPachube with the API key and feed ID, this worked right away. How can I know? One, the Output window in Visual Studio told me that Cosm returned status code 200, which means OK. Two, the "voltage" datastream showed a value, in this case 0.15 V. Three, the "Last updated" mark (red oval marker in the screen shot below) showed that something happened (although confusingly, the displayed time seems to randomly jump between time zones).

Note: only the "voltage" datastream is updated, the "number" datastream is not used in the HelloPachube sample!

So yes, to my relief the code still works with Cosm!

PS

Only two things changed in the API: it is now api.cosm.com instead of api.pachube.com, and the HTTP header is now X-ApiKey instead of X-PachubeApiKey.

 

For the human-readable (HTML) pages, it is now cosm.com (without www!) instead of www.pachube.com.

Write a comment

Comments: 3
  • #1

    Valentin Genev (Wednesday, 19 June 2013 20:47)

    And now it is xively.. Is it a way I can work with it also?

  • #2

    Cuno (Wednesday, 19 June 2013 20:55)

    Yes, it should work "as is" with the Cosm version as well. Actually, the fully correct thing to do would be to replace all occurrences of "api.cosm.com" by "api.xively.com", in HelloCosmSockets (two instances) and in Gsiot.CosmClient (one instance). I'll do that it in the next release of the samples.

    Best regards

    Cuno

  • #3

    Valentin Genev (Sunday, 11 August 2013 20:44)

    Didn't see the reply since now, but I haven't actually had time to dig into this :) now I can try it. Thanks alot!

Companion Web site for the book
Getting Started with the Internet of Things
By Cuno Pfister
Publisher: O'Reilly Media