Announcement

Collapse
No announcement yet.

ESP8266 OTA using the API sketch (code included)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • cowsr4eating
    replied
    Originally posted by enigmatheatre View Post
    FYI OTA update is available in Beta V.146 for normal and API sketches available in the updater.

    Greig.
    Thank you!!!!

    Leave a comment:


  • alphatech
    replied
    Edit: It looks like I needed to install Python 2.7.14 and a nice reboot. I was able to update the board over the air. This is a real cool feature, especially when I can not reach the shed anymore because the snow.

    Happy Holidays.

    Thank you for your help. I updated all my boards to the latest version and as you noted in your picture, I can see the board via IP address. When I compile it and try to upload is where I get that message. It looks like that is looking for python.exe.

    Thanks,
    Aldo
    Last edited by alphatech; December 19, 2017, 10:44 PM.

    Leave a comment:


  • randy
    replied
    Originally posted by aldo View Post
    Edit: I think I have it figured out. one question remains, how do I know which library I should install and which the program requires, I get this error when I compile the LCD program

    WARNING: library LiquidCrystal_I2C claims to run on [avr] architecture(s) and may be incompatible with your current board which runs on [esp8266] architecture(s).



    Edit: I was able to manage to update the boards ot at least one for now. I copied the old board code and replaced it with the new code by making sure I would not overwrite replace any of enigmatheatre code.
    By the way, what do you suggest for the default location for libraries and board code, could I store the code on a NAS so every pc has access to the board code?

    Can anyone please let me know how to update over the air with the new code when they have a chance?


    By mistake I updated yesterday to the release Beta V.146 prematurely. Absolutely not an issue, unfortunately I can not find any documentation on what to do to update my boards. Also, how do I use the great new feature OTA?

    Thanks,
    Aldo
    That error is normal on the NodeMCU boards, disregard it. The correct libraries to add are always the ones that you download from the config page of the version you are running. The rest of the stock libraries for 1.8.1 (the version shown on the config page) are used as well.

    The OTA update is done through the IDE, but you must have uploaded the OTA capable sketch by USB first. You will see the OTA boards listed when you select port under tools from the IDE.

    Click image for larger version

Name:	Capture.jpg
Views:	1
Size:	99.7 KB
ID:	1194453

    Leave a comment:


  • randy
    replied
    Originally posted by aldo View Post
    When I try to upload the sketch over the air, I get the following message, any help would greatly be appreciated.

    java.io.IOException: Cannot run program "python.exe": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:2 6)
    at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.j ava:129)
    at cc.arduino.packages.uploaders.GenericNetworkUploader.uploadU singPreferences(GenericNetworkUploader.java:99)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
    at processing.app.SketchController.upload(SketchController.java :709)
    at processing.app.SketchController.exportApplet(SketchControlle r.java:682)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2 190)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 8 more
    An error occurred while uploading the sketch
    Unless you have uploaded a OTA capable sketch (1.0.0.144 or later) by USB, you cannot do OTA upgrades. Prior to .144, the OTA code was not in the sketch. Once the OTA capable sketch is installed, you can use OTA for future updates.

    Leave a comment:


  • alphatech
    replied
    When I try to upload the sketch over the air, I get the following message, any help would greatly be appreciated.

    java.io.IOException: Cannot run program "python.exe": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:2 6)
    at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.j ava:129)
    at cc.arduino.packages.uploaders.GenericNetworkUploader.uploadU singPreferences(GenericNetworkUploader.java:99)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
    at processing.app.SketchController.upload(SketchController.java :709)
    at processing.app.SketchController.exportApplet(SketchControlle r.java:682)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2 190)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 8 more
    An error occurred while uploading the sketch

    Leave a comment:


  • alphatech
    replied
    Edit: I think I have it figured out. one question remains, how do I know which library I should install and which the program requires, I get this error when I compile the LCD program

    WARNING: library LiquidCrystal_I2C claims to run on [avr] architecture(s) and may be incompatible with your current board which runs on [esp8266] architecture(s).



    Edit: I was able to manage to update the boards ot at least one for now. I copied the old board code and replaced it with the new code by making sure I would not overwrite replace any of enigmatheatre code.
    By the way, what do you suggest for the default location for libraries and board code, could I store the code on a NAS so every pc has access to the board code?

    Can anyone please let me know how to update over the air with the new code when they have a chance?


    By mistake I updated yesterday to the release Beta V.146 prematurely. Absolutely not an issue, unfortunately I can not find any documentation on what to do to update my boards. Also, how do I use the great new feature OTA?

    Thanks,
    Aldo
    Last edited by alphatech; December 19, 2017, 12:44 PM.

    Leave a comment:


  • logbuilder
    replied
    Originally posted by enigmatheatre View Post
    FYI OTA update is available in Beta V.146 for normal and API sketches available in the updater.

    Greig.
    That's great! Thanks!

    Robert

    Leave a comment:


  • enigmatheatre
    replied
    FYI OTA update is available in Beta V.146 for normal and API sketches available in the updater.

    Greig.

    Leave a comment:


  • cowsr4eating
    replied
    Logbuilder,

    Thank you for the info! I've fallen in love with the NodeMCU over the arduino. I wish I had more than one analog pin, but still a reliable, compact product.

    With the OTA option I'm looking into using the Nextion serial touchscreen like this project uses:

    https://community.home-assistant.io/...lacement/25464

    This ends up being single gang with a customer 3D printed switch plate. If this works like I think I can replace my clunky UPB scene keypads with LCD touchscreens. The thing holding me back before was how to update .... OTA fixes that issue!

    Thanks again, and I hope this ends up in the standard and API plugin sketches in the future.

    Guy

    Leave a comment:


  • logbuilder
    replied
    Originally posted by zwolfpack View Post
    Looks like I'm SOL with the Sparkfun boards. Apparently the flash on these is too small to accommodate OTA.
    My understanding is you need twice as much memory as your sketch uses. I'm running only nodeMCUs which have enough memory.

    Leave a comment:


  • zwolfpack
    replied
    Looks like I'm SOL with the Sparkfun boards. Apparently the flash on these is too small to accommodate OTA.

    Leave a comment:


  • logbuilder
    replied
    Originally posted by vasrc View Post
    Haven't messed with C for a bazillion years ..
    Z
    Yea, me either but I did work in it for 15 years in deeply technical areas. I find it refreshing that the IDE is so vanilla. I seldom see anyone using pointers or dereferencing. Nice and mellow.

    Leave a comment:


  • vasrc
    replied
    Originally posted by logbuilder View Post
    I didn't have to set up anything in regards to partitions. I'm guessing it is handled in the ArduinoOTA library. I just set the board type to ESP32 Dev Module and compiled and flashed with cable. Then, it showed up in the IDE network ports just as expected. Tested loading several sketches OTA and no problem.

    Right now, I have my main sketch which all the nodes run. However, I do have to set board specific parms and compile for that target board. I need to clean that up. First step would be to isolate all those board specific defines to a .h that lives in each board's folder which gets included at compile. That would help a bunch when changing the base sketch such that all boards need to be updated now. That might be as far as I need to go but I see the value in a generic sketch. Intentionally loading from the IDE seems like a natural process. Not sure I want any reloading without my direction.

    Haven't thought this out enough but off the top of my head next step would be to get those board specific items in the eeprom on the board. Then a totally generic app could be loaded which looks in eeprom and tailors itself. I think that is where you are going when you mention NVS but not sure what that acronym means in this context (non-volatile storage?).

    To be honest, I'm just tickled I don't have to go to each device to do updates. I have them in three different buildings around my property and some in not so easy to get to locations.

    ETA: My ESP32 is a ESP-WROOM-32S V1.1 and I use the Arduino IDE.
    Not sure why it's being crabby, using both a Dev board as well as Adafruits new Huzzah board. Just downloaded the newest code and it's no better. Odd thing is the Pull OTA works, just not the generic arduinoOTA code. Quite a few comments online about others having the same problem, just no solutions I can find yet. Got to be something stupid, simple...

    Yup, NVS is non-volatile. Look at the Preferences code, it works really well, not as cryptic as EEPROM is (which is still there).
    I was also looking at having an Init sketch that burns in the defaults (to NVS) and let it go from there, but like I said, it's not easy (at least for me) to get it out of NVS (or EEPROM for that matter) and into the device prior to setup() (mainly for IP addr, and MQTT broker configs info).
    Primary problem seems to be replacing all of the #define values with variables. Not sure if it's Adruino or just C? Haven't messed with C for a bazillion years ..

    Z

    Leave a comment:


  • logbuilder
    replied
    Originally posted by vasrc View Post
    Doesn't work on my ESP32 (Rev 1) for some reason, keep getting the dreaded error[4]. Thinking my partitions aren't defined correctly as I don't see two OTA partitions. How do you partition yours?

    I think I'll just clear the flash memory and start over..

    Originally I had it retrieving the new bin from my webserver whenever I sent it a command (ie Pull vs Push). But I'm leaning towards pushing it now.

    My biggest headache is trying to figure out a way to pull the device config (ie IPaddr, MQTT broker, DeviceID, DigIn, DigOut, Analog pin #'s, etc) from the NVS when it starts up so I can send it generic sketches. Can't get it to work outside of setup().

    Z
    I didn't have to set up anything in regards to partitions. I'm guessing it is handled in the ArduinoOTA library. I just set the board type to ESP32 Dev Module and compiled and flashed with cable. Then, it showed up in the IDE network ports just as expected. Tested loading several sketches OTA and no problem.

    Right now, I have my main sketch which all the nodes run. However, I do have to set board specific parms and compile for that target board. I need to clean that up. First step would be to isolate all those board specific defines to a .h that lives in each board's folder which gets included at compile. That would help a bunch when changing the base sketch such that all boards need to be updated now. That might be as far as I need to go but I see the value in a generic sketch. Intentionally loading from the IDE seems like a natural process. Not sure I want any reloading without my direction.

    Haven't thought this out enough but off the top of my head next step would be to get those board specific items in the eeprom on the board. Then a totally generic app could be loaded which looks in eeprom and tailors itself. I think that is where you are going when you mention NVS but not sure what that acronym means in this context (non-volatile storage?).

    To be honest, I'm just tickled I don't have to go to each device to do updates. I have them in three different buildings around my property and some in not so easy to get to locations.

    ETA: My ESP32 is a ESP-WROOM-32S V1.1 and I use the Arduino IDE.

    Leave a comment:


  • vasrc
    replied
    Originally posted by logbuilder View Post
    Was curious whether the OTA code would work on the ESP32.

    Surprisingly, it worked fine with no changes.
    Doesn't work on my ESP32 (Rev 1) for some reason, keep getting the dreaded error[4]. Thinking my partitions aren't defined correctly as I don't see two OTA partitions. How do you partition yours?

    I think I'll just clear the flash memory and start over..

    Originally I had it retrieving the new bin from my webserver whenever I sent it a command (ie Pull vs Push). But I'm leaning towards pushing it now.

    My biggest headache is trying to figure out a way to pull the device config (ie IPaddr, MQTT broker, DeviceID, DigIn, DigOut, Analog pin #'s, etc) from the NVS when it starts up so I can send it generic sketches. Can't get it to work outside of setup().

    Z

    Leave a comment:

Working...
X