Archived page - for new setup overview see home energy monitor build step 5

Emoncms overview

Create an account

Emoncms has multi-user functionality built in, so the first step after installation is to create/register your account via the GUI.

Inputs, input processing and feeds

There are 3 parts to the flow of sensing data in emoncms. Rather than just log incoming data straight away, the idea is to have the option to process this input data as it comes in and then log/store it. 

  1. Inputs
  2. Input processing
  3. Feeds

At the moment using input processing you can:

  • Multiply the input by a scalar
  • Add an offset
  • Multiply the input with another input
  • log the input to a feed
  • convert a power input to kwh per day and log to a feed
  • convert a kwh increment to kwh per day 
    and log to a feed
  • count the length of time an input is 1 or 0 per day (useful for counting the length of time a solar HW pump is on for)
  • convert accumulated kwh updates to kwh per day and log to a feed

See full input processing descriptions here.

1) Sending a JSON string

The first step is to send some data to emoncms, this is done by sending a HTTP request with the data in the url to the emoncms API. For example:

emoncms/api/post?apikey=YOURAPIKEY&json={power:200.2}

The data needs to be sent in json form with a tag for the variable you want to send and the variable value, for example: {testA:200} or 2 variables {testA:200,testB:400} and so on for as many variables as you want to send.

You also need to include your apikey that can be found at the top of your feeds page.

Try copying the example URL at the top of the feeds page into your browser to see this stage in action.

2) The variables should now appear in inputs:

3) Click on the arrow to bring up the input configuration box.

Lets create a log of the input (a feed). Click on the drop down menu and select log and in the arg edit box enter a name for the log you would like to create. Then click add.

4) The feed should now appear in the feeds list and the data will be logging.


5) Standard Visualisations

Once you have been logging for a little while, click on the drop down menu to see your feed visualised. The following options are available:

Raw data = level of detail, for viewing really large datasets (power data over long windows of time)
Bar graph
realtime = the graph auto updates every 5s so that you can watch data coming in!

These visualisations can also be embedded outside of emoncms using the embedd link.

6) Get at your data for external use via the API using the following API call:

emoncms/api/getfeed?apikey=YOURAPIKEY&feedid= &start= &end= &resolution=
Guest's picture

Re: Emoncms overview

Hello Tristian,

when I try to insert a feed (fe your test):
http://localhost/emoncms/api/api.php?apikey=f16aa42df1d43bd7f940c1c661294b93&json={testA:200,testB:400}

Thanks

TrystanLea's picture

Re: Emoncms overview

 Aha, could the problem be the script name api.php, can you change it to post.php and see what happens. I did leave the old file name link in there by mistake and have fixed since.

Guest's picture

Re: Emoncms overview

indeed. so simple. Thanks for the quick response

Luis's picture

Re: Emoncms overview

Hi Trystan:

I tried to configure a new feeds from inputs. First the page show two errors at any time:
Notice: Undefined variable: out
C:\wamp2\www\emoncms\components\feedComponent\feedComponent.php on line 145
Notice: Undefined variable: input in
C:\wamp2\www\emoncms\components\feedComponent\feedComponent.php on line 146

I think I have some wrong configuration.

The page seem to be ok (forgeting the errors) until I append the second Feed (when I have only one feed there isn't problem), then the feed page in step 2 don`t do anything and erease the feed selected from step 1.

I think this error is related to $input variable. But I haven`t idea where is the real problem.

Thanks.
Luis

TrystanLea's picture

Re: Emoncms overview

Hey Luis

Thanks for doing this bug flagging! I see the first problem with undefined variables. The quick fix is to remove the variable:

$input in  $out .= '<h3>2) Input Configuration: '.$input.'</h3>';

I will make a list of these changed that I will fix the next update, but that particular line is not your real problem and as you say the page works skipping that notice.

I will look at the main problem now

Trystan

 

TrystanLea's picture

Re: Emoncms overview

I've just re-tried feed creation here and it seems to work fine.

When you tried the API url did you see both testA and testB in the input list?

Then when you click on the > button for testA you entered for log say: nameA. Did this created a feed called nameA?

Then when you click on the > button for testB you entered for log say: nameB. What exactly happened at this point, did feed nameA just disappear? 

Thanks, Trystan

Luis's picture

Re: Emoncms overview

Hi Trystan:

When I tried the API url I see testA, testB, and 3 sensor that I have connected to Arduino board.I send data from python script this way:
data = {'Tint':float(sensores[0]),'Text':sensores[1],'HR':sensores[2]}
base_url =
'http://192.168.1.60/emoncms/api/api.php?json='+json.dumps(data,separators=(',',':'))
f = urllib2.urlopen(base_url)

Then, when I click on the > button for HR and enter for log "HR sensor" . This create a feed called HR sensor and all is OK.

Then, when I click on the > button for testA (or other sensor) and enter for log "nameA", the page reload, feed nameA isn't created and I see the page with list of sensors, and only one feed "HR sensor".

TrystanLea's picture

Re: Emoncms overview

Hmm, interesting, I wonder if this is a browser compatibility issue or something of that sort, Glyn tried creating a feed the other day but had trouble and then when I tried on my computer it was fine, I will try a couple of different browsers and on windows see if we can shed any light on this.

TrystanLea's picture

Re: Emoncms overview

Aha! I get the problem in chrome and internet explorer on windows, so that must be it! Now I wonder how to fix it...

Luis's picture

Re: Emoncms overview

Yes, it works on Mozilla Firefox over Windows 7. But not in Chrome.