EmonESP Disconnecting V2.2.3


I have just updated my Huzzah. I tried “check for updates” but I just got a message “connecting” and nothing happened.

I therefore tried to compile latest source using Arduino IDE but that produced a compile error which I am still trying to solve.

As I wanted to get back into operation I decide to look at platform.io even though I use Windows.

As @glyn.hudson has said this was quick and easy and everything seemed to work ok.

I restarted the huzzah and for a while everything was OK but then it stopped posting data.

I logged in direct to the emonESP web page and it showed “connected : No”

The puzzling thing is that the Write apikey*: field was blank. If I hit save it says “Please enter valid Emoncms apikey”

I enter the key, hit save and it all starts working. Then after a random time it stops and shows “connected : No”

And the api key field is blank. Any ideas how to fix this?

I once tried to install platformio but it moved directories about and generally screwed up my system, so as far as I’m concerned, it’s malware.
What was the compiler error that you had with the Arduino IDE?

1 Like

This is malformation, PlatformIO is certiantly not malware and does not move directories around. I’m happy to help guide anyone though the setup progress. By all means use the workflow that you are most comfortable with.

Great, nice work getting up and running.

PlatformIO really excels which library management and replicate build environment. All libraries are automatically installed at exactly the correct version therefore you can be 100% sure that the version you compile is exactly the same as every other developer working on the project.

This is very strange behaviour. Can you try and capture the serial debug output when this happens so we can see what’s going on? Stopping posting may be an Emoncms issue or a power supply issue.


I had seen your comments about platform.io and as I use the Arduino IDE for other things I installed platform.io on a different PC so it would not cause any problems for my Arduino set up.

There are a number of compile errors but they all seem to refer to one thing.
Unfortunately it is beyond my current knowledge to know precisely what it means. I have downloaded the latest ESPAsyncTCP library which as far as I can make out is the same one used by the platform installation

D:\MicroProcessors\ArduinoCode\libraries\ESPAsyncTCP-master\src\ESPAsyncTCP.cpp: In constructor ‘AsyncClient::AsyncClient(tcp_pcb*)’:

D:\MicroProcessors\ArduinoCode\libraries\ESPAsyncTCP-master\src\ESPAsyncTCP.cpp:77:28: error: invalid conversion from ‘long int ()(void, tcp_pcb*, pbuf*, long int)’ to ‘tcp_recv_fn {aka signed char ()(void, tcp_pcb*, pbuf*, signed char)}’ [-fpermissive]

 tcp_recv(_pcb, &_s_recv);


In file included from D:\MicroProcessors\ArduinoCode\libraries\ESPAsyncTCP-master\src\ESPAsyncTCP.cpp:27:0:

D:\MicroProcessors\ArduinoCode\hardware\esp8266com\esp8266/tools/sdk/lwip/include/lwip/tcp.h:318:18: error: initializing argument 2 of ‘void tcp_recv(tcp_pcb*, tcp_recv_fn)’ [-fpermissive]

void tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv) ICACHE_FLASH_ATTR;


D:\MicroProcessors\ArduinoCode\libraries\ESPAsyncTCP-master\src\ESPAsyncTCP.cpp:78:28: error: invalid conversion from ‘long int ()(void, tcp_pcb*, uint16_t) {aka long int ()(void, tcp_pcb*, short unsigned int)}’ to ‘tcp_sent_fn {aka signed char ()(void, tcp_pcb*, short unsigned int)}’ [-fpermissive]

 tcp_sent(_pcb, &_s_sent);

I have Arduino IDE and PlatformIO installed side-by-side on the same PC with with issues. I use them both. I would highly recomend using PlatformIO to compile emonESP as its fairly complex and the library dependances are version specific.

Currently we specify [email protected] this will be automatically installed at the correct version if using platformio.


How do I capture the debug serial output? I have 3 huzzahs, 2 shop supplied and the 3rd is a standard using ribbon cable connection. It is this one I updated first as it is the least critical installation. Is there any way to revert to an earlier version of EmonESP using the platform.io?

I don’t think it is an Emoncms issue as the other 2 huzzahs are reporting without problem. I also think it unlikely to be power supply as the huzzah had worked perfectly on the same emonTX until I upgraded the firmware.

Just out of interest, should OTA update be available on version V2.2.3.

There is nothing in the website view to suggest there is. Also I find it strange the api key appears in readable text when you hit save.

Compare this to the old version which also shows what happens when you hit update. The connecting message just sits there.

Capturing serial while the unit is connect to an emonTx would be tricky since you need to us a USB to UART cable @115200 baud.

The automatic OTA update has never worked correctly. This has been removed in the newer version.

You can use git checkout in your local repo folder to revert to a particular version e.g.

$ git checkout 2.2.2

However, if your not customising the FW I would recomend download the pre-compiled .bin files from the [emones releases page and uploading using esptool. This way you be sure you are running the compiled production FW.

With the unit in bootloader mode:

$ esptool.py erase_flash

Reset the unit, and put back into bootloader then upload both the flash and spiffs at the same time:

$ esptool.py write_flash 0x000000 firmware.bin 0x300000 spiffs.bin


I am not sure of that syntax for esptool.py applies to Windows. I guess you need to declare the com port.

However I do have a FTDI cable and I may be able to monitor the serial port. For the moment I have started again from scratch.
I deleted the EmonESP directory and cloned again.

This time I everything went as per instructions (Previously I had a real job to do the first login from my phone. It took repeated attempts to reach

So far I am still receiving data into emoncms.

This is a known issue (Now can't build with Core 2.3.0? · Issue #60 · me-no-dev/ESPAsyncTCP · GitHub) with the 2.3 version of the ESP8266 core (which you shouldn’t be using due to the KRACK vulnerability)

Try installing the ESP8266 core from Git: GitHub - esp8266/Arduino: ESP8266 core for Arduino

1 Like


Many thanks

Now compiling without errors.

1 Like

Just to confirm everything working perfectly.

2 more Huzzahs updated with platform.io.

I am assuming there must have been some corruption when I first set up the emonESP directory.

Just out of interest is there anyway to verify an esp upload using platform.io?

Fantastic, nice work :smiley:
What version are you running now?

If the upload finishes successfully then the upload has been complete. What do you mean by verify the upload?

Version 2.2.3.

By verify I mean checking the upload was successful . I believe PIC upload with verify reads back the data and compares received data to sent data. If it matches OK if not Fail.

Great! Is 2.2.3 working well for you? I’ve not any issues, however the thread title suggests you have had disconnecting issues after updating to 2.2.3. Is this true? Have these been resolved now? Was the issue at your end?