Fetching Datafeed FROM pachube
-
Hi, I see most of the pachube stuff already written in the HOWTO is on getting data from Mango to Pachube.
How do I get data from pachube into Mango?
I have a pachube API key, entered into the datasource. In data point, I can put the feed ID as a number. The datastream ID, I'm not so sure. Do I put the URL, or just the stream name? And how do I fetch out the current value data point from the other data in that stream?
thanks for any help!
-
Pachube feeds are (typically) multi-valued, i.e. many values - usually indexed from 0 to n-1 - for a single timestamp. Mango is single valued, so you use the datastream id (the value index) to determine which value in the feed you want for the point.
-
So for an example, here is the URL:
https://api.pachube.com/v2/feeds/47944/datastreams/YAMBUKWF
The feed ID is: 47944
Data type: Numeric
StreamID is: current_value
Settable: NoIs that correct?
BTW. I'm not actually getting a connection to external data sources at the office, but at home its OK. We have a proxy set up at work under IE-Connection Settings-Lan-Proxy I have to enable. Would that cause a problem for Tomcat or Java and connectivity to the external net?
-
I can't access the data stream. It asks for a password.
Re proxy, see the HTTP settings on the system settings page.
-
I guess you need to be logged in to Pachube. Have a look at:
http://pachube.com/feeds/47944?page=13
If I do a http request on https://api.pachube.com/v2/feeds/47944/datastreams/YAMBUKWF
I get returned:
{"at":"2012-05-04T06:45:09.734405Z","max_value":"31.9","min_value":"-0.6","unit":{"symbol":"W","type":"derivedSI","label":"Watt"},"id":"YAMBUKWF","version":"1.0.0","current_value":"6.3"}
The datapoint I'm interested in is current_value
-
Mango always gets the current value. (It can easily determine things like min and max itself.) Your feed id is 47944, and your data stream id will be YAMBUKWF.
-
That works now, thanks!