how to upload to emoncms

443 views
Skip to first unread message

mwall

unread,
Jul 29, 2017, 6:19:33 AM7/29/17
to weewx-user
On Saturday, July 29, 2017 at 5:27:56 AM UTC-4, Stefan Klammer wrote:
Now i have another question. I want to feed the data into my own emoncms server. But i can't find a description what the token parameter in the config file has to look like.

Is there any more information available?

stefan,

follow the emoncms instructions to install emoncms:

https://github.com/emoncms/emoncms

once emoncs is installed, log in.  under the setup->apikey menu you will see the 'write api key'.  copy that and place it in the weewx configuration file like this:

[StdRESTful]
    ...
    [[EmonCMS]]
        url = http://192.168.0.2/emoncms/input/post.json
        token = acd5ed8g4a0b412ffc8ca603e65a5767

then restart weewx.

see the weewx-emoncms readme for more options.

https://github.com/weewx/weewx/wiki/emoncms

after one archive interval, you should see data in the 'inputs' page in emoncms.  then, in emoncms, save the 'inputs' into 'feeds', then you can do all kinds of plotting and indicators and time comparison and timeseries comparisons with your data.

emoncms is a bit cumbersome when you have more than a couple hundred observations, but it is really nice for residential monitoring and other small-scale applications.

m


dashboard-sample.png

Damon S

unread,
Aug 15, 2017, 6:14:33 AM8/15/17
to weewx-user
I inserted what you have written here in my weewx.conf file after installing the weewx-emon extension, with my IP and token of course, but it will not post to my local emoncms server, I know the emoncms server is working as it is logging inputs from my solar inverter.
This is running on a rpi3
Using  tail f /var/log/syslog it shows,
"Aug 15 22:05:37 raspberrypi weewx[14060]: restx: EmonCMS: Failed to publish record 2017-08-15 22:05:00 NZST (1502791500): Failed upload after 3 tries"

mwall

unread,
Aug 15, 2017, 7:01:45 AM8/15/17
to weewx-user
On Tuesday, August 15, 2017 at 6:14:33 AM UTC-4, Damon S wrote:
I inserted what you have written here in my weewx.conf file after installing the weewx-emon extension, with my IP and token of course, but it will not post to my local emoncms server, I know the emoncms server is working as it is logging inputs from my solar inverter.
This is running on a rpi3
Using  tail f /var/log/syslog it shows,
"Aug 15 22:05:37 raspberrypi weewx[14060]: restx: EmonCMS: Failed to publish record 2017-08-15 22:05:00 NZST (1502791500): Failed upload after 3 tries"

in the weewx configuration file, set debug=2 then restart weewx.  this will provide more detail about the upload failures, and it will show you exactly what weewx is trying to upload to emoncms.
 

Roger Campbell

unread,
Jul 17, 2018, 2:03:07 AM7/17/18
to weewx-user
I stumbled on this information when wondering if I could post weewx data to my local emoncms host. I tried it and it works well for me however it would be fabulous if this info was in your emoncms wiki on git.

The one thing I am struggling with is how to get metric data  (deg C, mm) but with wind speeds in mile per hour into emoncms, I am sure it is quite simple but I have so far failed to get it right. Can you offer any help with this?

gjr80

unread,
Jul 17, 2018, 5:06:25 AM7/17/18
to weewx-user
Hi,

Have a look at the comments up front in emoncms.py, included in the commments are instructions/example settings for setting the upload units. Depending on your install emoncms.py will be in /usr/share/weewx/user or /home/weewx/bin/user.

Gary

mwall

unread,
Jul 17, 2018, 7:33:40 AM7/17/18
to weewx-user
On Tuesday, July 17, 2018 at 2:03:07 AM UTC-4, Roger Campbell wrote:

The one thing I am struggling with is how to get metric data  (deg C, mm) but with wind speeds in mile per hour into emoncms, I am sure it is quite simple but I have so far failed to get it right. Can you offer any help with this?


the wiki has an example of how to specify units for each observation:


for wind speed you will want something like this:

[StdRESTful]
    [[EmonCMS]]
        ...
        [[[inputs]]]
            [[[[windSpeed]]]]
                units = mile_per_hour

the uploader defaults to the unit system of your weewx database, then you can override that with the unit_system directive.  you can then override units of individual observations as shown.  see the weewx documentation for the unit names.

m

bgra...@umw.edu

unread,
Feb 19, 2021, 10:47:08 AM2/19/21
to weewx-user
Hello,
This is an old thread but may be the best place to jump in. I have a weewx server on my local network which sends data to my remote web page (grattans.org/wx) and also sends data to my emoncms rpi on the local network using the weewx extension. All has been working well for the past couple of years. Recently, I noticed the following error message in the weewx.log file (debug=2):

Feb 19 10:15:26 n4mrv weewx[86166] DEBUG weewx.restx: EmonCMS: Failed upload attempt 3: Server returned '<br />#012<b>Notice</b>: 
 Undefined variable: jsondataLC in <b>/var/www/emoncms/Modules/input/input_methods.php</b> on line <b>60</b><br />#012ok'
Feb 19 10:15:26 n4mrv weewx[86166] ERROR weewx.restx: EmonCMS: Failed to publish record 2021-02-19 10:15:00 EST (1613747700): Failed up
load after 3 tries

Not sure how long this has been going on because it IS uploading data to the emoncms rpi correctly and on time (15 minute archive time). The entry in weewx.conf is:

[[EmonCMS]]
        token = 3bff21xxxxxxxxxxxxc226b634

I probably should not complain as it's working but am just curious what is going on here. I'm not a programmer and don't understand what the cause of the error might be. I don't try to upload to emoncms.org, only to my local rpi.

Thanks in advance if anyone can explain where my config error might be.

Bob
Reply all
Reply to author
Forward
0 new messages