Get data from emoncms

Hi guys,

a simple problem.

How can I access data in emoncms from an external script?

Looking at feed API help I found two solutions:

http://192.168.0.20/emoncms/feed/list.json

and I have the list of all feeds, or, if I just want the last data from one feed it seems I could use

http://192.168.0.20/emoncms/feed/get.json?id=2&field=

but, what do I have to place on field????

whetever I put, the answer is always 0!

 

Please help!

Thanks

 

Robert Wall's picture

Re: Get data from emoncms

jb79's picture

Re: Get data from emoncms

Hello!

What about this? xyz is the feed id that you want to read.

http://192.168.0.20/emoncms/feed/value.json?id=xyz

 

Jérôme's picture

Re: Get data from emoncms

ilnandonazio's picture

Re: Get data from emoncms

hi again,

thanks fot the tips, I'm quite there.

I was able to read the istantaneus value thanks to you, I did a script to calculate 5 minutes average of a feed and to locally upload the result in a new feed. This script runs every 5 minutes called by crontab. It calculates the average of the last 5 minutes and upload the data. m Everything is perfect.

Bur not I have another issue again.

In another script I need to read the average feed, and do some calculations.

i read the entire day feed calling this url.

http://192.168.0.20/emoncms/feed/data.json?id=3&apikey=xxxxxxxxx&start=1...

Start time is the last midnight occurred.

It works, but, the time I receive back in the data, is not exactly every 5 minutes, likes i see in emoncms graphs, but time is something different. I guess it is because on first script, due to calculation delays etc, the upload time is always in a small delay. But emoncms round this up.....

Is there a way to have exactly the same data (time and value) i see in emoncms graphs?

 

Thanks

 

 

 

ukmoose's picture

Re: Get data from emoncms

Have you tried setting the time of the 5 minute average value when you send it to emoncms?  You can do this by adding the time to the URL when you post data (see the "input api help"  on the input page for the format).

 

 

 

 

mharizanov's picture

Re: Get data from emoncms

Also check my post on in-memory SQL analysis of emoncms feed, you can do averaging of feed data and easily post to another feed using this approach

 

http://harizanov.com/2013/12/in-memory-sql-analysis-of-emoncms-feed/

jsokhn's picture

Re: Get data from emoncms

Hello,

i have a problem with the get.json

if i put http://emoncms.org/feed/list.json?apikey=xxxx i get all the feed with the details of the feeds

if i want the time of one feed

http://emoncms.org/feed/get.json?apikey=xxxxxx&id=52380&field=time i have 0 as a result

thanks

joe

 

pb66's picture

Re: Get data from emoncms

jsokhn's picture

Re: Get data from emoncms

It work perfectly thanks Paul!!

[Please DO NOT double-post - Moderator (RW)]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.