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

excellent, but not the epoch time I hope :-)

Guest's picture

Re: Emoncms overview

you're quicker than Lucky luck :-)

I will try it first thing tomorrow with some feedback.

Wim.

TrystanLea's picture

Re: Emoncms overview

No problem, I guess it is epoch time right: php function time(). Let me know if you have better ideas, i dont have strong preferences.

Guest's picture

Re: Emoncms overview

Hello Trystan,

I've made some test graphs in jpgraph (php). It works like a charm.

But, I thing there is a small bug in emoncms.
When I load 1 record via post.php (with a time in the json string), the record is double in the table feed_1. So it must be inserted twice. I tested it a couple of times but always double in the feed_1 table.

Any idea ?

Thanks a lot,
Wim

Guest's picture

Re: Emoncms overview

Hello Trystan.

The time enhancement works like a charm (loaded 3600 records (more than 5 months power data)).

I would like to ask for some enhancement requests:

1. when viewing in kwhd, you can't select 1 week, 1 month ... You always see everything, whats not clarifying on the graph (if data for several months). Is it possible to forsee this ?

I now use a commercial energy product (energy-lens). Very good, but from excel.

The purpose of my energy monitor is:

2. trend and forecast analyse, therefor I need to compare weeks and months (even years)> Graphs per month and weeks (consumed kwh) should be great.

3. look for defect machines (leaking electricity) and therefor I compare the average kwh/h for month (so fe. a graph with avg kwh/h for januari, avg kwh/h for febr...).

I think in sql it is not difficult for these data to group and order, but I don't know the application to show it (ajax?)

Is it something you also see the benefit in ?

Wim.

TrystanLea's picture

Re: Emoncms overview

Good ideas for features.

Viewing kWh/d in different time windows is definetly one that I would like to do soon. I will create a future features list above so that we can keep a note of these.

Trystan

Guest's picture

Re: Emoncms overview

hello,

I try to install the lastest emoncms version.
setup (tables) are ok
When I try to insert a feed (with the correct apikey), I get the following error:
Undefined variable: title in C:\wamp\www\emoncms\theme\theme.php on line 38

( ! ) Notice: Undefined variable: title in C:\wamp\www\emoncms\theme\theme.php on line 38

Call Stack

#

Time

Memory

Function

Location

1

0.0029

388472

{main}( )

..\index.php:0

2

0.0190

442576

theme_render_template( )

..\index.php:83

3

0.0204

490568

include( 'C:\wamp\www\emoncms\theme\theme.php' )

..\index.php:89

( ! ) Notice: Undefined variable: content in C:\wamp\www\emoncms\theme\theme.php on line 39

Call Stack

#

Time

Memory

Function

Location

1

0.0029

388472

{main}( )

..\index.php:0

2

0.0190

442576

theme_render_template( )

..\index.php:83

3

0.0204

490568

include( 'C:\wamp\www\emoncms\theme\theme.php' )

..\index.php:89

I can't figure out why.

ANy idea ?

PS: please keep up the fantastic work

THanks,
Wim

TrystanLea's picture

Re: Emoncms overview

Hello Wim, just so I can be clear do you get this error when you call the emoncms/api/post.php script? or when you are on the emoncms feeds page? Thanks Trystan

Guest's picture

Re: Emoncms overview

when I try your link : http://localhost/emoncms/api/post.php

I just get the string "crap"

Thanks

TrystanLea's picture

Re: Emoncms overview

 Sure, it will need a correct api key before it gives an ok. Which reminds me I should change the word 'crap' for something more suitable.