I have a small project using 2 temp sensors up and running using ESP8266 (LOLIN). It’s configured to work with OTA and all is fine.
BUT…after several hours the device goes offline. The only way to recover is to delete the device on the mobile phone (using the Blynk.app) and re-add this device (so go through the complete configuration again)
Then it works again for several hours before going offline again…
I tried already by using another ESP8266 → same problem.
I have another ESP8266 (identical board) in a different OTA project (simular, also temp sensors connected) and this stays nicely online!!!
Also, if I run this project without using OTA…everything works fine, the device stays online!
Output from the board after went offline in the cloud:
07:10:45.957 → / _ )/ /_ _____ / /__
07:10:45.957 → / _ / / // / _ / '/
07:10:45.957 → ///_, /////_
07:10:45.957 → /__/ v1.2.0 on ESP8266
07:10:45.957 →
07:10:45.957 → #StandWithUkrainehttps://bit.ly/swua
07:10:45.958 →
07:10:45.958 →
07:10:45.958 → ----------------------------------------------------
07:10:45.958 → Device: Blynk Zwembad Filtratie-6H9P
07:10:45.958 → Firmware: 0.1.0 (build May 5 2023 06:59:48)
07:10:45.958 → Platform: ESP8266 @ 80MHz
07:10:45.958 → Boot ver: 6
07:10:45.958 → SDK: 2.2.2-dev(38a443e)
07:10:45.990 → ESP Core: 3.1.2
07:10:45.990 → Flash: 4096K
07:10:45.990 → Free mem: 27952
07:10:45.990 → ----------------------------------------------------
07:10:45.990 →
07:10:45.990 → >[431] INIT => WAIT_CONFIG
07:10:46.068 → [504] Hold the button for 10 seconds to reset configuration…
07:10:46.068 →
07:10:46.068 → Waiting for time
07:10:46.068 → .[2215] AP URL: blynk.setup
You’ve referred to this as being an OTA issue, but I think you mean that it’s a dynamic provisioning problem - the device is losing its WiFi credentials. Is this correct?
Unfortunately, the snippet of code you’ve posted doesn’t really help, because it doesn’t tell us which pins your sensors are attached to.
One thing that is clear is that you’ve not un-commented a board type as you should, so the custom board configuration in the Settings.h tab is being used.
My guess is that you are using GPIO0 (pin D3 on a Wemos D1 Mini - if that what you mean by a LOLIN board) for something, and this is being pulled LOW for > 10 seconds and this is clearing your credentials.
You should read this, and refer to the actual Settings.h tab in your sketch (the default settings have changed since this was written)…
Do you really need the dynamic provisioning functionality of Blunk Edgent?
Once again, you seem to be mixing-up OTA and Dynamic provisioning.
If you don’t mind hard-coding your WiFi SSID and password in your sketch then there are much simpler ways to enable the use of Blynk.Air OTA than using the Edgent example.
That comment tells me you haven’t really read and understood the link I provided, but that’s irrelevant if you move away from Blynk and simply add-in the Blynk.Air code to a regular Blynk sketch.
ok, I mixed up OTA and Dynamic provisioning (I had to look this one up!)
Call me stupid, but I started with this only 3 weeks ago
Can you please provide (like you said) the simpler way to enable he use of Blynk.Air OTA as I can find only documentation that starts from the Edgent example.
This can’t be your complete sketch, because you’re calling a function from within your void loop called maintainDisplay() that doesn’t exist in the sketch.
Depending on what is in this maintainDisplay() function you could be breaking several Blynk golden rules, but you certainly shouldn’t have this in your void loop, it should be called with a Blynk Timer.
You should probably get your time from the Blynk server too, instead of using an NPT server.
Having Blynk.virtualWrites in your void setup inst a good idea, they very rarely work as expected. You’d be better putting them in a BLYNK_CONNECTED() function to run once once the Blynk connection is actually established correctly.
As far as integrating Blynmk.Air OTA is concerned, you just put these three lines up at the top of your sketch with the other #includes and global variable definitions…
include <Update.h>
#include <HTTPClient.h>
String overTheAirURL = "";
and just tag the rest of the code on to the end of your sketch.
You should also add this near the top of your sketch…
#define BLYNK_FIRMWARE_VERSION "x.x.x"
and replace “x.x.x” with numbers like “0.0.1” that you increment in your sketch before compiling it and attempting to deploy via OTA.
I even didn’t know that you could integrate Blynk in node-red
I had the project close to ready in node-red with a Raspberry Pi4 but as I fell in love with the way you can control everything from anyware by using Blynk…I switched to Arduino.
All of this millis() comparison stuff is very messy, especially when you do nested calls.
You’d be far better using a BlynkTimer to call a function which checks if your various on/off schedules are active or not.
It seems that you aren’t using the Blynk Time Input widget to input your start/stop times?
If your already using Node-Red then I’d probably use Node-Red as my rules engine, with the BigTimer contrib to manage your schedule and use MQTT messaging to communicate with your device (no Blynk code).
Then I’d use Blynk as the primary UI to see the current status, switch between auto and manual override and maybe input changes to your schedule.