Raspberry Pi + EmonCMS ??

Hello 

I want to use a Raspberry Pi with EmonCMS to monitor my electrical consumption.

I don't want to use an external HDD (like this tuto : http://emoncms.org/site/docs/raspberrypihdd)

Is it possible ? 

And how to do this ?

Today, I have web server + MySQL on the Pi. I use teleinfo to extract datas of my electric meter.

glyn.hudson's picture

Re: Raspberry Pi + EmonCMS ??

The read only gateway forwarder should do exactly what you want

http://emoncms.org/site/docs/raspberrypigateway 

 

These are pre built so card image available for download and we sell ready to go sd cards in the shop

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

Thank you for your answer glyn :)

With this solution, is it possible to save datas in SQL table (SD card) and send this datas to EmonCMS ?

glyn.hudson's picture

Re: Raspberry Pi + EmonCMS ??

No, the reason for this read-only file system on the SD card solution is that we found that logging data to the SD card 24/7 caused the card to fail after about 3 months hence the move to a HDD solution for users who want to log data locally. This blog post should explain http://openenergymonitor.blogspot.com/2013/12/setup-emoncms-on-raspberrypi-with-hard.html

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

Ok, it's true.

So with your solution (OEMGateway), the datas are sent directly to EmonCMS and I can monitor my consumption with graph ?  

But I don't know how EmonCMS works exactly. I don't find any tuto...

Robert Wall's picture

Re: Raspberry Pi + EmonCMS ??

Go to the EmonCMS website, click "Guide". Then look under "Using emoncms".

When you send your data to emonCMS (you must create an account, get your APIkey from Input Help and set that in your Raspberry PI to give it permission to write into the database) "Inputs" are created automatically. You can then process the data (say convert °C to °F, or Power to kWh) and send it to a "Feed". A "Feed" is stored in the database and you can then draw a graph from that.

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

Thanks you, it's ok now, I can connect to EmonCMS with my Raspberry Pi.

How to send data automatically from my teleinfo (USB) to EmonCMS ?

I use script to save data to my Database.

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

Is it possible to use emoncms.org url in my PHP script to send data ?  (URL with datas + key)

Jérôme's picture

Re: Raspberry Pi + EmonCMS ??

Not sure I understand the question, but in emoncms.org, go to the "inputs" page and see "API help" link.

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

I've a PHP script which save energy data from my electric meter to my SQL database. Now, I want to send these datas to emonCMS.org.

I have the link in "API help", it works when I click on it.

But I want to use it in my PHP script. 

Is it possible to do this ?

Jérôme's picture

Re: Raspberry Pi + EmonCMS ??

The examples provided in the API help page should help you create appropriate http requests in your PHP script to send the data to emoncms.org.

 

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

Thank you for your answer jerôme.

I can use this URL : http://emoncms.org/input/post.json?json={power:200}&apikey=*****************************

But, how can I send many datas ?  (like power, intensity,...)

It's necessary to use many URL for all datas or can I put all datas in one URL ?

Robert Wall's picture

Re: Raspberry Pi + EmonCMS ??

The API Help page shows JSON, CSV and bulk data formats. You might find that a search engine will help you to find more information about the first two.

You can easily type in your web browser a string that you think might work and test it, before writing it into your script.

gloops100's picture

Re: Raspberry Pi + EmonCMS ??

Yes I know Robert, but I don't know how to put many variable in URL with JSON...

I look for it...

asez73's picture

Re: Raspberry Pi + EmonCMS ??

Form a bash script you could use curl this way, on a single line:

curl http://emoncms.org/input/post.json?time=1396607593.66&node=0&json={RaspberryPi:ADCO:0**********,OPTARIF:2,ISOUSC:45,HCHC:006611999,HCHP:009297403,PTEC:1,IINST:002,IMAX:045,PAPP:00390,HHPHC:3,MOTDETAT:000000}&apikey=e1***************

where *** are specific to your data, api keys and so on.

Note that:

  1. ?time= must be immediately after post.json? otherwise the timestamp won't be correctly treated
  2. apikey= must end the request
  3. a python script for getting the teleinfo data is there
  4. I have a modified version of this script able to send the data properly formatted, through urllib2 python's module. However it still requires some cleanup before publishing. More precisely, using request rather than urllib2 is a real need and the api keys and so on are hardcoded in it.
  5. I use python to grab permanently those data from the teleinfo link and it works pretty much well. Power outage, unreachable ntp server and unreachable emoncms server are still to be solved. This happens regularly and really breaks the emoncms chronology and thus scramble all the computed feeds.
  6. &node= should be placed before the json= string, furthermore, the value must be lower than 32

 

Comment viewing options

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