Class ArduinoOTAClass' has no member named 'getCommand'

Folks,

I am finalizing a blog on the advantages of PlatformIO but must admit I am a bit in the dark…
I am very much able to deploy firmware on my NodeMCU-v2 devices - Lua or C based but cant get any example to work with PlatformIO. I download an example into the src directory and execute the command ‘pio run -nodemcuv2 -t upload’ command but always get the same error:

src/main.cpp: In lambda function:
src/main.cpp:35:20: error: ‘class ArduinoOTAClass’ has no member named 'getCommand’
if (ArduinoOTA.getCommand() == U_FLASH)
^
Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_noniso.o
*** [.pioenvs/nodemcuv2/src/main.o] Error 1

Any expert who can help me with this?

Thanks in advance!
-Tiest

Which example do you use? Please provide a link.

I found the same problem. In the documentation here:
http://docs.platformio.org/en/latest/platforms/espressif8266.html?highlight=ota#over-the-air-ota-update

The video that is linked mentions using

This example uses ArduinoOTAClass::getCommand()

Althous my library version of framework-arduinoespressif8266 is 1.20300.1 the ArduinoOTA.h and ArduinoOTA.cpp files seem to be from an older version (?) that doesn’t have getCommand defined.

getCommand was introduced here:
https://github.com/esp8266/Arduino/commit/c4f9f102ce2d8669b93fdaf348393ff47cccb99f

I replaced the platformio installed files ArduinoOTA.h and ArduinoOTA.cpp with the github version and now it compiles and runs perfectly.

Hi - I have been struggling with the exact same problem… Can somebody please update the framework-arduinoespressif8266 lib in platformIO?

Thanks

That is not our problem. Need to wait when new version of Arduino Core for ESP8266 will be released. Nevertheless, you can use temporary “development” version:

Sorry guys was enjoying some quality family time and not paying too much attention here… Happy new year all!
The example I used can be found here: Arduino/libraries/ArduinoOTA/examples at master · esp8266/Arduino · GitHub.

Let me check the link Ivan just provided to see whether I can resolve the problem. I’ll let you know the outcome.
If that does not work I’ll check out the workaround flinkebernt provided.

Thanks for everyone’s effort!

-Tiest

Tried both options but cannot seem to make this work.
@flinkebernt: how did you ‘replace’ the platformio installed files ArduinoOTA.h and ArduinoOTA.cpp?
I don’t see these files. Can you explain what you did to make this work?

I downloaded ArduinoOTA.h in libs and ArduinoOTA.cpp in src but getting new errors:

tiest@chrx:~/pio/ota$ pio run --target upload
[Thu Jan 5 21:29:57 2017] Processing nodemcuv2 (platform: espressif8266, board: nodemcuv2, framework: arduino)

Verbose mode can be enabled via -v, --verbose option
Converting main.ino
Collected 23 compatible libraries
Looking for dependencies…
Library Dependency Graph
|-- v1.0
| |-- v1.0
| |--
| | |-- v1.0
|--
| |-- v1.0
|-- v1.0
Compiling .pioenvs/nodemcuv2/src/ArduinoOTA.o
Compiling .pioenvs/nodemcuv2/src/main.ino.o
Archiving .pioenvs/nodemcuv2/libFrameworkArduinoVariant.a
Indexing .pioenvs/nodemcuv2/libFrameworkArduinoVariant.a
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Esp.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/FS.o
/home/tiest/pio/ota/src/main.ino: In lambda function:
/home/tiest/pio/ota/src/main.ino:35:20: error: ‘class ArduinoOTAClass’ has no member named ‘getCommand’
if (ArduinoOTA.getCommand() == U_FLASH)
^
src/ArduinoOTA.cpp: In constructor ‘ArduinoOTAClass::ArduinoOTAClass()’:
src/ArduinoOTA.cpp:34:3: error: class ‘ArduinoOTAClass’ does not have any field named ‘_rebootOnSuccess’
, _rebootOnSuccess(true)
^
src/ArduinoOTA.cpp: At global scope:
src/ArduinoOTA.cpp:95:60: error: no ‘void ArduinoOTAClass::setPasswordHash(const char*)’ member function declared in class ‘ArduinoOTAClass’
void ArduinoOTAClass::setPasswordHash(const char * password) {
^
src/ArduinoOTA.cpp:101:53: error: no ‘void ArduinoOTAClass::setRebootOnSuccess(bool)’ member function declared in class ‘ArduinoOTAClass’
void ArduinoOTAClass::setRebootOnSuccess(bool reboot){
^
*** [.pioenvs/nodemcuv2/src/main.ino.o] Error 1
src/ArduinoOTA.cpp: In member function ‘void ArduinoOTAClass::_runUpdate()’:
src/ArduinoOTA.cpp:317:8: error: ‘_rebootOnSuccess’ was not declared in this scope
if(_rebootOnSuccess){
^
src/ArduinoOTA.cpp: At global scope:
src/ArduinoOTA.cpp:345:33: error: no ‘int ArduinoOTAClass::getCommand()’ member function declared in class ‘ArduinoOTAClass’
int ArduinoOTAClass::getCommand() {
^
*** [.pioenvs/nodemcuv2/src/ArduinoOTA.o] Error 1

I would like to present this OTA capability in combination with platformio.org to a potential client… Any thoughts are welcome!

Thanks in advance,
-Tiest

I’ve just tried this example and it works for me fine.

pio run -d examples/espressif/esp8266-arduino-ota/
...
Archiving .pioenvs/esp8266/lib/libESP8266mDNS.a
Indexing .pioenvs/esp8266/lib/libESP8266mDNS.a
Linking .pioenvs/esp8266/firmware.elf
Calculating size .pioenvs/esp8266/firmware.elf
text	   data	    bss	    dec	    hex	filename
240408	   3136	  29896	 273440	  42c20	.pioenvs/esp8266/firmware.elf
Building .pioenvs/esp8266/firmware.bin
================= [SUCCESS] Took 10.97 seconds

Could you repeat the same on the NON-MODIFIED example?

Figured it out.
I created a subdirectory called ‘ArduinoOTA’ in the Lib directory. Next I copied the ArduinoOTA.h and ArduinoOTA.cpp into the newly created directory and NOT in the Lib directory.
After that pio run works flawless. Thanks for helping out! Great community here.

Thanks,
-Tiest

2 Likes

Necro-posting for history.

I’m having this very issue and it seems precisely the same as described above. It’s pulling down library ID “6178” when I add “ArduinoOTA” for an ESP-8266 in the platformio.ini file, however, this is not the correct one as listed here.

So, I “fixed” it, but it feels like something noted a few years ago would have been addressed otherwise by now. Am I all wet?

It’s possible, but is hard to tell since the OP didn’t post their platformio.ini. It looks like it was officially available in v2.4.0 of the core (although it was only mentioned in the v2.4.0-RC1 notes???), meaning post Jan 2018, unless they switched to the staging version.

Since ArduinoOTA is a builtin library, there’s no need to include it in your lib_deps list, and you probably shouldn’t, for exactly this reason - you don’t want PlatformIO to pull down a external library when it’s already provided by the platform+framework combo you’re using.

You sir, win the Internet. This is why “information” on the Internet should expire. :slight_smile:

Well, it was the same issue, except in this case I caused it by over-studying for the test.

Thank you!

1 Like

lol… yes indeed… stuff changes so rapidly with some of these board support packages, that stuff written only six months ago is already out of date! :laughing: One of the many reasons I love PlatformIO… can use both old AND new versions of libraries, board support packages, etc at the same time, and don’t have to worry about which one I’m using! :slight_smile: