First of all, you shouldn’t be using delays in your Blynk code. Delays block all code execution during the delay period and so in effect they cut the device off from Blynk during this period, making it unresponsive during the delay period. If your delays are long enough then the Blynk server will think the device is MIA and mark it as offline, and the device itself will go offline when it hasn’t heard from the Blynk server.
Also, you’re using 38400 baud for communication with your ESP-01 using a SoftwareSerial ’virtual’ COM port. Your Uno doesn’t have enough processing power to consistently emulate a COM port at this baud rate.
On to your issue…
The BLYNK_WRITE(vPin) callbacks are only triggered when the value of the virtual pin changes on the server, so in Auto mode there is no looping process that takes readings and compares them to your target value and takes the appropriate action based on this info.
To get around this you need to create a timed process using BlynkTimer which called your automatic code, maybe once every 5 seconds. This timed function should start by doing a check to see if your device is in Auto or a Manual mode. To achieve this, your auto/manual switch simply needs to set a global variable to the appropriate value.
Reading material…
Using timers to call a function…
Option to use Timeout Timers if a delay() equivalent is needed, and discussion on auto/manual mode…
Info on baud rates when using SoftwareSerial…
Also, if you’re using one of the paid subscriptions then you might want to think about using the Segmented Switch widget to give you auto/manual on/manual off settings with a single switch.
Pete.