Power monitoring with an XTM18S and MQTT

Thank you a lot!
I’m not an expert on this subject (as you will see in the future) and probably I’ll need a lot of your help

:wink:

Don’t worry about that, that’s watch this forum is about!

1 Like

First problem:

Where can I found the RemoteDebug.h file to compile with my Arduino IDE?

I’ve found it but now there a lot of error messages :frowning:

I’ve just copied this remotedebug.h in the same folder as your MAID-EM.ino (renamed from .cpp)


Arduino:1.8.5 (Windows 10), Tarjeta:“Generic ESP8266 Module, 80 MHz, 40MHz, DOUT, 115200, 1M (64K SPIFFS), ck, Disabled, None”

Archiving built core (caching) in: C:\Users\Pedro\AppData\Local\Temp\arduino_cache_314431\core\core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_dout,UploadSpeed_115200,FlashSize_1M64,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____0b55ce40479f8ac3afe1807f39bfd4e9.a
sketch\MAID-EM.ino.cpp.o: In function `String::operator+=(char const*)’:

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::begin(String, unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::setResetCmdEnabled(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showTime(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showProfiler(unsigned char, unsigned int)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showDebugLevel(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showColors(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::begin(String, unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::setResetCmdEnabled(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showTime(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showProfiler(unsigned char, unsigned int)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showDebugLevel(unsigned char)’

C:\Users\Pedro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `RemoteDebug::showColors(unsigned char)’

sketch\MAID-EM.ino.cpp.o: In function `std::_Function_base::_Base_manager<void ()()>::_M_init_functor(std::_Any_data&, void (&&)(), std::integral_constant<bool, true>)’:

c:\users\pedro\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional:1983: undefined reference to `RemoteDebug::begin(String, unsigned char)’

sketch\MAID-EM.ino.cpp.o: In function `setup’:

D:\borrar\MAID-EM/MAID-EM.ino:330: undefined reference to `RemoteDebug::handle()’

sketch\MAID-EM.ino.cpp.o: In function `loop’:

D:\borrar\MAID-EM/MAID-EM.ino:386: undefined reference to `RemoteDebug::handle()’

D:\borrar\MAID-EM/MAID-EM.ino:386: undefined reference to `vtable for RemoteDebug’

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compilando para la tarjeta Generic ESP8266 Module.

Este reporte podría tener más información con
“Mostrar salida detallada durante la compilación”
opción habilitada en Archivo -> Preferencias.

Are you using Arduino IDE or Platformio?

EDIT: I can see from the errors that you are using Arduino… Sorry…

Arduino IDE

Which board are you using?

I don’t use Arduino IDE, i prefer PlatformIO. But when i test code with NodeMCUand Arduino IDE i use “NodeMCU 1.0” in the board configurations.

1 Like

Board: SonOff Basic

Unfortunately, same error :frowning:

Arduino:1.8.5 (Windows 10), Tarjeta:“NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)”

You can´t use Sonoff boards for this. The code was written for boards like NodeMCU, Wemos D1 and the like. Sonoff boards are very specific and dont have all the gpio

But I’m using the @timseebeck original code “without much” problems… but I’m looking for your “lights” and higher frequency

And how are you connecting the XTM energy meter? What do you mean by:

I’m using the @timseebeck original code “without much” problems

1 Like

image
Conexion exactly as to Wemos D1 mini because there is a free PIN in the SONOFF. Electric power to SOnoff more easy because I can connect it to 220V in parallel with the feed to XTM18S.

About @timseebeck… I have only have problems not connecting to MQTT in some cases (one every 10 times, for example)

Well, the code wasn’t intended for Sonoff but if it works and you only have errors on the Remote Debug library, try removing all references for it on the code.

1 Like

I’ve just installed ATOM and Platformio and I think with the same problem related with RemoteDebug.h that I’m using

It’s my first PlatformIO project :frowning:
Would it be correct “your include libraries code” with my files in the folder?

It can be a problem on the file structure. Give me some time to debug the code and i’ll get back to you. OK?

1 Like

Thank you

I’ve comment the DEBUG lines and recompiled and upload from Arduino IDE… and IT WORKS!

But there are errors as in the original code :frowning:

The current data are fine because I don’t have yet connected to the SonOff. Would it be the reason for the error?

Can you post the errors please?

1 Like

It seems “an error” upon disconnection from the broker but the broker (mosquitto) is working very well with a Meterological Station

I had a similar problem when developing the code but don’t remember the cause. Anyway i’ll make some debugging on the code to try to find out what the problem is. Can you see the web interface or the error appears quickly?

1 Like