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.
- Inputs
- Input processing
- 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:
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=
Re: Emoncms overview
Points 1), 2) and 3)have not the .PNG archive to see what are you talking about. Points 4) and 5) are Ok. Pleaae can you fix that to understand the whole webpage?
Thank you very much
Re: Emoncms overview
Thanks for the heads up, should be fixed now.
Re: Emoncms overview
Hello Trystan,
I've made some test graphs in jpgraph (php). It works like a charm.
But, I think 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
Re: Emoncms overview
Hello WIm
Sorry for the slow reply, been away on holiday.
Just tested it here and it seems to work fine, only the one entry? Both with and without timestamp option.
All the best, Trystan
Re: Emoncms overview
Hello Trystan,
In my case ALL the entries are double in the feed_1 table.
I solved this with creating a unique index on feed_1 (time,data).
So now the insert will get (when inserting the same row a second time) a duplicate key.
Strange that you can't simulate this, because I used the lastest version with a clean install.
Best regards,
Wim.
Re: Emoncms overview
Hello T,
is there a way to also load the date/time with the post script.
I log the powerconsumption every hour (date,time,tottal kwh) on SD and once a month I read the SD on my computer in a .csv file.
So for me it should be interesting to bulk load this data into your tool/program/database.
Is there an easy way to do so (fe date/time as parameter in the post.php ?) It should be possible to resuse this also for other users, I think.
Best regards,
Wim
Re: Emoncms overview
Hello Wim
It doesnt exist at the moment, but good idea. Thinking about it, it would be really easy to do, What format is your timestamp data in?
Trystan
Re: Emoncms overview
this doesn't matter (I can change it easily).
By the moment its like this: "02/04/2011 14:00:00;0.329300000000018 " (day/month/year)
But this is easaly changeable.
I think -when you want to code this- you should use choose the frequently used format.
Thanks for consider/thinking of the change.
Re: Emoncms overview
Ok, just updated the github emoncms with the feature.
time can be specified using the time attribute:
emoncms/api/post.php?apikey=yourapikey&time=unixtimestamp&json={power:200}
Re: Emoncms overview
Good to hear that you can change it easily, shall we go for unix timestamp to start with, probably the most robust.