PC based application send data to EmonCMS

Is there written application (windows) that send data to EmonCMS. Purpose is to send data to EmonCMS, and node will get it from private feed. Or any fragment of code...

Jérôme's picture

Re: PC based application send data to EmonCMS

Not to my knowledge.

But you can use... a browser. See the input API help. Entering the right URL, including the API key, is a solution. Or logging in, then entering the right URL without API key.

Or you can easily setup a small script using a function to call the URL. That would be wget in linux shell scripts, or urllib2 in python, perhaps can you chose python, or use a windows function in a batch script.

The rest is specific to your own case, I guess, so I don't see how the application could be already written.

batulzii's picture

Re: PC based application send data to EmonCMS

using System.Net;

string url = "http://www.emoncms.org/input/post.json?json={power:200}";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Stream resStream = response.GetResponseStream();

 

How do you think about this code in C#? need write MS app.

ukmoose's picture

Re: PC based application send data to EmonCMS

This won't work unless you are logged in to EmonCMS as Jérôme says, you would need to add the apikey...

batulzii's picture

Re: PC based application send data to EmonCMS

Yes, it was as simple snippet. Done simple Windows application to send data to EmonCMS.

Thanks for helping!

Jérôme's picture

Re: PC based application send data to EmonCMS

Perhaps are you willing to share the code ? Some people here use windows as well and may be interested.

batulzii's picture

Re: PC based application send data to EmonCMS

Sure. Please, find attached. Only change API accordingly. I keepit simple and people can make own easy. This is RAR file, so please rename with .rar extension. I do not have zipper.

Comment viewing options

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