Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Can't complile EmonESP code using platformio

Wanted to try logging to the serial monitor, so trying to compile the esp code using platformio. Is this what you are using ? Or the Arduino platform? As per the readme, I pulled the code, entered the EmonESP folder. If I try just a pio run i am told that there is no emonesp environment, which is true. There is no definition for one in the platformio.ini file - there is in the upstream project. Since this is an Esp32 I changed the default to emonesp32 which does exist and tried to compile again with pio run I then get compile errors

compilation terminated.
*** [.pio/build/emonesp32/src/web_server.cpp.o] Error 1
src/energy_meter.cpp: In function 'void energy_meter_loop()':
src/energy_meter.cpp:175:29: warning: variable 'totalVoltage' set but not used [-Wunused-but-set-variable]
   float voltageA, voltageC, totalVoltage;
                             ^
In file included from src/http.cpp:32:0:
/Users/chris/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/WiFiClientSecure.h:29:1: error: expected class-name before '{' token
 {
 ^
/Users/chris/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/WiFiClientSecure.h:105:18: error: type 'Print' is not a base type for type 'WiFiClientSecure'
     using Print::write;
                  ^
src/http.cpp: In function 'String get_https(const char*, const char*, String, int)':
src/http.cpp:63:12: error: 'class WiFiClientSecure' has no member named 'print'
     client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host +
            ^
src/http.cpp:75:28: error: 'class WiFiClientSecure' has no member named 'readStringUntil'
       String line = client.readStringUntil('\r');
                            ^
*** [.pio/build/emonesp32/src/http.cpp.o] Error 1

Hello @Jay11, is this the latest master branch from github.com/openenergymonitor/EmonEsp?

There is no file src/energy_meter.cpp in the EmonESP repository EmonESP/src at master · openenergymonitor/EmonESP · GitHub perhaps you are using another related project?

I am looking at this open source project.
https://github.com/CircuitSetup/Split-Single-Phase-Energy-Meter

Hello @Jay11 as this is an adaptation by CircuitSetup, it’s not really something we can help with unfortunatly, you could try sending them a message here Contact – CircuitSetup or opening an issue on their github repository perhaps?