Emonlight and emoncms

Hi,

I am new with emoncms and try to get it working. I read the helps but i don’t understand how to configure it with emonlight.

I installed emonlight on de Raspberrypi image of emoncms.
The configfile of emonlight is:


sources = ({
    # gpio pin for pulse signal reading
    pin = 4;
    # number of pulses equivalent to 1 kWh
    pulses-per-kilowatt-hour = 1000;
}, {
    pin = 6;
    pulses-per-kilowatt-hour = 1000;
}, {
    pin = 24;
    pulses-per-kilowatt-hour = 1000;
}, {
    pin = 25;
    pulses-per-kilowatt-hour = 1000;
});
servers = ({
    url = "http://192.168.0.251";
    protocol = "emoncms";
    map = ({
        pin = 4;
        node-id = 17;
        api-key = "1";
    }, {
        pin = 6;
        node-id = 17;
        api-key = "2";
    }, {
        pin = 24;
        node-id = 19;
        api-key = "1";
    }, {
        pin = 25;
        node-id = 19;
        api-key = "2";
    });
});
data-log = "/home/pi/data/emonlight/emonlight-data.log"
data-store = "/home/pi/data/emonlight/emonlight-data"

Running emonlight I get the following output:

    
pi@emonpi(rw):/$ sudo emonlight
read config from /root/.emonlight
log data to /home/pi/data/emonlight/emonlight-data.log
source 0: read last_time=2016-12-01 11:12:49, pulse count=2 from /home/pi/data/emonlight/emonlight-data
source 1: read last_time=2016-12-01 11:12:49, pulse count=68 from /home/pi/data/emonlight/emonlight-data
source 2: read last_time=1970-01-01 00:00:00, pulse count=0 from /home/pi/data/emonlight/emonlight-data
source 3: read last_time=1970-01-01 00:00:00, pulse count=0 from /home/pi/data/emonlight/emonlight-data
test buzzer pin -1

queued 2016-12-02 08:59:37.219355733: DT=78408.049179, P=3(1), Power=0.000000, Elapsed kWh=0.000000
queued 2016-12-02 08:59:35.644263565: DT=78405.981077, P=69(1), Power=0.000000, Elapsed kWh=0.000000
queued 2016-12-02 08:59:32.964023804: DT=1480669172.964024, P=1(1), Power=0.000000, Elapsed kWh=0.000000
queued 2016-12-02 08:59:33.718437700: DT=0.754164, P=2(5), Power=4773.498181, Elapsed kWh=0.002000
queued 2016-12-02 08:59:36.064829605: DT=2.345421, P=3(14), Power=1534.905730, Elapsed kWh=0.003000
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /input/bulk.json was not found on this server.</p>
<hr>
<address>Apache/2.4.10 (Raspbian) Server at 192.168.0.251 Port 80</address>
</body></html>
**send failed: HTTP response 404 : "http://192.168.0.251http://192.168.0.251/input/bulk.json?time=1480669173&apikey=1&data=[[0,19,4773.498181,0.002000,2],[1,19,1534.905730,0.003000,3],[3,19,1534.905730,0.003000,3]]"**
queued 2016-12-02 08:59:39.011924853: DT=2.946113, P=4(25), Power=1221.948950, Elapsed kWh=0.004000
queued 2016-12-02 08:59:41.634206161: DT=2.621362, P=5(34), Power=1373.331713, Elapsed kWh=0.005000
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /input/bulk.json was not found on this server.</p>
<hr>
<address>Apache/2.4.10 (Raspbian) Server at 192.168.0.251 Port 80</address>
</body></html>

A yous can see I get an error (bold printed). May it is the way emoncms must be configured, I have no clue at all.

Can anyone point me to the right direction?

Thanks in advance

The url quoted in that error message has a couple of defects, aside from the apikey not being a valid size (32chars) the “http://192.168.0.25” is repeated and the “emoncms/” sub-directory is missing.

We are not familiar with “emonlight” it is not an official OEM software nor is it widely discussed on these forums, although it has been mentioned on the old forum. You may need to open an issue on github for specific emonlight support.

You could try editing the url in the config to

url = “http://192.168.0.251/emoncms”;

and setting each api-key = to the full readwrite emoncms apikey found on the “My Account” page of your emoncms server. As for the double IP, hopefully hat’s a typo in the error reporting rather than the url itself, after making the 2 edits suggested, try it again and if you get a similar error message copy the url from the error report without the duplicate IP etc and paste it into a LAN connected PC’s browser to see if the url works.

Also once you have put your full apikey in the config, be sure to check any logs or file you might post and edit so as not to reveal your apikey on the forum.

.

Thanks very much, i’ll try your suggestions…

Thanks for the support!

It was solved by adding “emoncms” to the url (and of course changing the api key to the right one).

Great! Add a new user to the user count…