Hi,
I need to install almost 100 OpenEnergyMonitor kits in 100 different apartments.
I need to gather the following data:
- 2 Current clamps attached to the EmonTx V3
- an Encapsulated DS18B20 sensor attached to the EmonTx V3
- An EmonTH
I configured an EmonHub (Raspberry PI) to collect all these data and send them to the local emoncms intallation on the raspberry localhost/emoncms. Now I can see all these data under the "input" tab of the emoncms.
Now I need to send accumulated data to a remote server, by using a POST o something similar, every 15 minutes.
How can I do this? Is there a simple way by using EmonHub/EmonCms functionalities?
Thanks
Re: EmonHub: Send consumption data each 15minutes to a remote server
If you mean batch send the same data to a remote emoncms server, yes easily done.
Just create a second [reporter] in emonhub.conf with a unique name eg [[emonCMS2]] and set the url and apikey for the remote emoncms and also in the [[[runtimesettings]]] add "interval = 900" (900secs being 15mins) and you are done.
You may want to also lift the default batchsize from 100 so that the data frames collected over 15mins are sent in one batch rather than 2 if you have 102 frames for example. You can set a maximum batch size of upto 250 frames per post using for example "batchsize = 200", again in the reporters [[[runtimesettings]]]
Paul
Re: EmonHub: Send consumption data each 15minutes to a remote server
Thank you pb66, but I need to send 15minutes data to a remote server which is not an instance on the Emoncms.
I could do it anyway? Maybe it's better to find a way in order to send the data with a Http POST request.
Is there a way by using Emoncms feed?
Thank you for your support
Re: EmonHub: Send consumption data each 15minutes to a remote server
Mark, good / bad news. You can extend emonHub to do what you ask, but it won't work out of the box. It only has the ability to submit the data to emonCMS so far.
You'll need to extend emonhub_reporter so there is another concrete implementation; search for "EmonHubEmoncmsReporter" which is the part that submits JSON to emonCMS just now. If your Python isn't all that hot, someone may be able to help out.
Re: EmonHub: Send consumption data each 15minutes to a remote server
I'm not aware of an alternative method in emoncms, but emonhub is designed to be modular and adding a custom reporter may not be as difficult as you may think.
The current EmonHubEmoncmsReporter sends out a request in the form of
http://domain.tld/emoncms/input/bulk.json?apikey=12345&data=[[1399980731,10,82,23],[1399980736,10,82,23],[1399980741,10,82,23]]&sentat=1399980742
The bits in bold are hardcoded into the reporter, this structure can be whatever you want using the existing variables of url, apikey data and "sentat" is the current time stamp. the data is a list of frames each being a string of data unixtimestamp.nodeid,val1,val2,val3 etc.
So you could just make a EmonHubCustomReporter Class with just a custom _process_post() to rearrange the url structure and in emonhub.conf where the 2nd reporters setting are (as mentioned above) just set the "Type = EmonHubCustomReporter"
Re: EmonHub: Send consumption data each 15minutes to a remote server
Thank you PB66 I create a reporter and everything works.
I send data every 15 minutes so I receive many different data array like:
data=[[1399980731,10,82,23],[1399980736,10,82,23],[1399980741,10,82,23][1399980731,10,82,23],[1399980736,10,82,23],[1399980741,10,82,23][1399980731,10,82,23],[1399980736,10,82,23],[1399980741,10,82,23]]&sentat=1399980742
Is there a way to receive aggregated data? I mean only one array containing the sum of others value like:
data=[[1399980742,10,882,223]]&sentat=1399980742
Thank you in advance.
Re: EmonHub: Send consumption data each 15minutes to a remote server
Hi Mark
Glad to hear you got it working ok. there is currently no built-in functionality to do what you want and there are no plans to provide this at the moment.
You could however introduce something in your custom reporter but be wary of the fact the current "bunching" is based on whatever happens to be in the buffer after 15mins have passed and if there is any reason for the outgoing delivery to fail or get delayed the buffer size will increase. so if the target server is unreachable for 1 hour when it comes up the reporter will process over and hours worth of data in one hit (upto the "batchsize") So this "aggregating" would probably need to be implemented prior to buffering during the add() function.
Just a note or 2 about creating custom modules before you invest to heavily in something extremely specialized. The intention is to provide a proper "mechanism" for "dropping in" custom modules to emonhub but that's not here yet, in the meantime please be aware if you update emonhub via git it will try and overwrite your changes (so please keep a backup too) and any new code is not currently guaranteed to be compatible until we decide on the best way to do it, so please update with caution and be prepared to make some changes (with assistance) if required.
Paul