EmonESP does not connect to emonCMS

I am using an EmonTX with EmonESP. That worked so far for me. But now I just setup a RaspberryPi with emonCMS. The CMS is reachable on but if I try to connect my EmonESP with the CMS it always tells my that I could not connect.
Anything I should try?

Best Regards

Have a look at this thread. emonESP does not update emonCMS (debian AND Ubuntu - apache error 400)

Yes Brian, I’ve seen this thread but I am afraid that my problem is a different one because I dont have a space in any of my ct’s statements:

1 Like

@stephan20, the JSON is malformed as there is a leading comma


If you have set Emoncms log level to 1, do you not see any message in the log?

You can see it here


@Robert.Wall could you check this please?

@borpin, that is what I get in the emoncms.log with log level set to 1

I have noticed, that the time is not set up correctly. I am wondering why because I set the timezone to Berlin (don’t know if this is part of my problem right now)

No, the error you see (BTW, better to select and copy the text and paste it rather than a screenshot) is because the contents of the JSON (the bit between the {}s is malformed. You can test it at jsonlint.com.

Try that same URL, from a browser, without the leading comma, it will work.

Is there nothing on CT1? If so, move all your CTs up one and restart the TX.

As an aside, it is odd you are not connecting to the MQTT broker.

Finally, the time in the logs is always UTC. However you do need to go into the User Profile (Setup/ My Account) and set the Timezone.

Which sketch? Where do I start to look?

Sorry I though this might be an EmonESP issue and I though that was what you looked at on the other thread so thought this was related. Apologies if not.

@borpin, If I just copy and paste the statement without the leading comma in a webbrowser it is accepted by the emonCMS. What is some kind of weird for me is when I am posting to emoncms.org everything works fine.
Hmm… ct1 is up and showing values… I am using three ct’s. But it seems to be an undefined value above the first ct?!

Sorry, the inner workings of the EmonESP and The EmonTX are outside my skill set :smile:

No, the 3-phase error was a space in the print-to-output section dedicated to the ESP8266 of the 3-phase sketch. Though I could look at the output, I couldn’t physically test it because I don’t have (as I wrote there) an ESP8266. The problem is most of the possible formats want or require a space there, the ESP format is the oddball that must not have a space - and it got missed.

The comma you’re looking for probably comes from the emonTx sketch, but it’s not easy to find one in the wrong place amongst all the emonTx sketches that have been published.

We should make a good team, the workings of the RPi are outside of mine. :grin:

The oddity above is that the first key is undefined and should be CT1.

@Robert.Wall, the sketch that I am using on my TX is the emonTx_3Phase_PLL_V1.5, if this is a useful information for you…

1 Like

That is exactly what I needed to know. I am looking, but I cannot see why “CT1:” does not show:

  #if defined EMONESP && !defined SERIALOUT
    #if WIRES == 3-WIRE
    Serial.print(F("ct1:")); Serial.print(realPower1+realPower2);            // These for compatibility, but whatever you need if the receiver is configured to suit. 
    Serial.print(F("ct1:")); Serial.print(realPower1);
    Serial.print(F(",ct2:")); Serial.print(realPower2);
    Serial.print(F(",ct3:")); Serial.print(realPower3);
    Serial.print(F(",ct4:")); Serial.print(realPower4);
    Serial.print(F(",vrms:")); Serial.print(Vrms);

… etc

The sketch sends it:


so I really don’t know where it is disappearing.

(I was guessing you have a 4-wire system as you are in Germany.)

@Robert.Wall, yes, as I am in Germany we are using a four wire system. Does this affect the function of the sketch, even if there are just 3 live wires? I always thought the 3-phase sketch is exactly made for the the field of application that I am using in right now?!

Yes it is - AND for the 3-phase system where there is no neutral wire.

In your 4-wire system, you measure the voltage from L1 – N, and L2 is 120° later and L3 is 120° later than that.

In a 3-wire system, you can only measure the voltage L – L, so you treat L3 as the neutral and measure voltage L1 – L3, and then L2 lags 60° behind L1.

But because the ‘neutral’ or L3 carries part of the power, the individual power for L1 and L2 has no meaning in reality, and that is why it adds CT1 & CT2 powers and prints CT2 power = 0.

#define WIRES 4-WIRE or #define WIRES 3-WIRE is the switch that changes the timing and the print output.


@Robert.Wall, thank you for your explanation.
Actually I have set the switch to
#define WIRES 4-WIRE
I just looked into the last sketch I have uploaded to my TX. So that shouldn’t be the culprit

It defaults to 4-WIRE, and both are the same anyway up to “CT2:” and then 3-wire prints “0.0” and your prints a number.

So I think EmonESP is putting the comma on the front.

@Robert.Wall, could @stephan20 monitor what the TX is passing to the EmonESP to check? (I’m sure there is but…)

Sorry, I can’t help there. All I did to add the ESP output format was steal it from another sketch. If there’s an FTDI connector free, or a means to tap onto however the ESP connects to the emonTx, it might be possible to use the Arduino monitor to watch what’s going down the wire.