emonESP does not update emonCMS (debian AND Ubuntu - apache error 400)

I followed the steps LinuxInstall for Debian with PHP7
All went fine but when data arrives on the emonESP i don’t get a connected state and data doesn’t arrive at emonCMS.

when i check the apache logs: (tail /var/log/apache2/access.log) - - [24/Feb/2019:10:10:56 +0100] "GET /emoncms/input/post.json?json={ct1:62.13,ct2: 0.0,ct3:-44.47,ct4:0.00,vrms:238.85,t1:300.00,t2:300.00,t3:300.00,t4:300.00,t5:300.00,t6:300.00,pulses:0,psent:26,psuccess:0,freeram:27160}&node=TX1&apikey=xxxxxxxxxx" 400 0 "-" "-"

When i enter{ct1:452.50,ct2:%200.0,ct3:-67.37,ct4:0.00,vrms:235.50,t1:300.00,t2:300.00,t3:300.00,t4:300.00,t5:300.00,t6:300.00,pulses:0,psent:6,psuccess:0,freeram:26488}&node=TX1&apikey=xxxxxxxxx

in a webbrowser, data enters emonCMS properly.

log apache: - - [24/Feb/2019:10:12:52 +0100] "GET //emoncms/input/post.json?json={ct1:452.50,ct2:%200.0,ct3:-67.37,ct4:0.00,vrms:235.50,t1:300.00,t2:300.00,t3:300.00,t4:300.00,t5:300.00,t6:300.00,pulses:0,psent:6,psuccess:0,freeram:26488}&node=TX1&apikey=xxxxxxxxxx HTTP/1.1" 200 204 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"

all devices in same subnet network.

EDIT: added a new VM with Ubuntu server, procedure with PHP7.2 till the end… And same problem with posting data with error 400.

some kind of bug with emonESP? Check log below. when CT2 is 0.0 there is a space before and not a %20

I think you may have found it.

Could you set the debug level to 1 in the settings.php and see what appears in the emoncms log please.

Brian, thanks.
I was still testing and found the issue with the space.
When i edited the src.ino for the emontx-3phase line 942 ’ Serial.print(F(",ct2: 0.0"));’ to ’ Serial.print(F(",ct2:0.0"));’ the problem is solved :slight_smile:

Ok great, can you raise an issue please?

I’m looking at the other end as I think the URL should be decoded to ensure that it is handled by the API.

Hi @Lesley.Persyn, I edited the post to make the logs etc go on a single line so easier to see (even though they disappear) and also masked your API key (which is always a good idea).

I’ve posted a corrected version. Thanks @Lesley.Persyn for spotting that, I don’t have an ESP8266, so I have never been able to perform actual tests on that particular configuration. Simsala has extensively used it on a 4-wire system - and that section of code is for 3-wire systems only.

1 Like

Interesting it works with the leading comma. See this thread.

The sketch has moved to 1.6.