Does anyone know if when using a NodeMCU ESP8266 in the Arduino IDE, I should be able to update it via WiFi if it’s connected?
I can control it once the program is uploaded, but I want to UPDATE the program via WiFi as well 
Does anyone know if when using a NodeMCU ESP8266 in the Arduino IDE, I should be able to update it via WiFi if it’s connected?
I can control it once the program is uploaded, but I want to UPDATE the program via WiFi as well 
Review OTA examples… means Over The Air… 
@John_Sullivan Thats what I figured but in IDE I selected that option and it errored out. I’ll dig deeper, probably something I need to add to Sketch. Thanks for the info! Let’s me know it is possible.
I’m updating my ESP8266 over the air - though I’ve taken the route of running an http server on my dev computer which serves up new firmware and using the httpUpdate function.
@Tom_Lawton I’m using @Jason_Coon 's sketch that allows changing things via a web browser, it’s running a web server as far ask I can tell. I’ve added the appropriate OTA things from the example sketch. I can get it all to compile but when I try and upload I get a error about expecting a byte-type not a string or something like that. I can’t seem to find much about that via Google. Any thoughts?
Post your code and I’ll test it out. I use OTA in every single one of my ESP8266 projects and haven’t had any issues other than the board sometimes not wanting to show up as an available port (I think that is more of an issue with my laptop when it goes to sleep, loses network connection and then Arduino IDE can’t see the boards until I quit out of the IDE a few times and give it time to find the available boards again).
@Brian_Lewis You bet. Not really my code, it’s pieced together from others…but hey isn’t alot of code! lol. I’m sure it’s my environment…but would love the confirmation. Let me get it together and I’ll post.
@Brian_Lewis here is a link to the code I’m using. Of course put your ssid and password in. Let me know if all is good on your end. I was getting an error when uploading to remote ESP. ESP shows up on network, selected it instead of COM etc. shrug https://www.dropbox.com/sh/y1w2o4o60ysv10j/AABNpH3ZyyDoWrnu0eWweKhxa?dl=0
Working just fine for me. First attempt I received a “NO ANSWER” but the second attempt worked great. What version of the Arduino IDE and ESP board definitions are you using? Can you post the error log when attempting to upload new code. Also, just a suggestion, there is a way to name the board. If you are planning on having more than one project with OTA enabled you may want to use that feature and also use the password feature. Not for security but to prevent yourself from uploading code to the wrong board. I set the password to be the same as the board name for my projects.
@Brian_Lewis Yea I was wondering about the password, didn’t seem to be for security but your idea makes sense on that.
IDE 1.8.5
ESP8266 NodeMCU 1.0 12E Board
So I upload sketch to ESP via USB. Power down restart IDE. Load up the sketch again, select network path (IP for ESP under PORT) then OTA. Sketch compiles but when it tries to upload it errors with "TypeError: a bytes-like object is required, not ‘str’
I installed Python and added to system path. I was getting error about that before. What else am I missing? Thanks for any thoughts. Google didn’t turn much up on the bytes error.
Check which version of the ESP board definitions you are using in the Boards Manager. Tools -> Boards -> Board Manager (at the top of the list). Maybe you are on an older version that has an issue. I’m on 2.4.0-RC2
@Brian_Lewis I’m on 2.0.0 and updating to 2.3.0 but I don’t see an option for 2.4 RC2…your cutting edge!
I’ll see if that helps!
@Brian_Lewis that was it! I changed to 2.3.0 it threw an error about pins and wouldn’t compile…so I added the #define FASTLED_ESP8266_RAW_PIN_ORDER I had read before about and now it compiles and uploads…quite quickly I might add! Thanks so much for letting me know your ideas to help figure this out.
That’s great news. If you want the 2.4.0-RC2 version you just need to add the line below to the board manager URL list. The main reason why I use that version is because Espressif included a fix for the KRACK vulnerability that was hot news not too long ago and since these devices are on 24/7 I don’t need someone trying anything nefarious with my network (not that I’m super worried about it but if it’s available I may as well use it).
https://github.com/esp8266/Arduino/releases/download/2.4.0-rc2/package_esp8266com_index.json
@Brian_Lewis gotcha. I need to read up on some of that. I watch http://twit.tv and Security Now. You might like it! I will probably pick up another router and have the esp’s connected to it rather than my main network eventually. Thanks again for the help! Excited to now be able to mount the power box permanently and keep things up to date!
Just be sure to mount the board to where you can still access it if needed. You never know when you’ll need to hook a USB cable to it to fix a bad OTA upload.
@Brian_Lewis oh for sure. I don’t mean it will be 15’ high in the attic in the back corner
I just need to mount the weather box out near the gutter on the side of the house. Will run an outlet up in the eave one day I think but for now an extension cord will work.
I have a couple ESP-12E NodeMcu V3 module and found out that yes you can. Here is some info on this topic.
http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html