OK guys, I have cracked this in a test bed scenario. I have rigged up a 5v version just with an LED and two way switching as per the original diagram at the start of this thread, with one of the switches replaced by a relay controlled by Blynk. I have managed to get the current detection feedback logic working great so that when the manual switch is toggled the app widget gets updated as well. This means that which ever switch is turned on or off (via app or physical switch) the app widget will reflect this correctly.
I have also added a little logic to ensure the correct state of any relay is re-instated in the event of a power failure or a reset of the arduino. This is essential when I plan to have at least 8chs or more, as you would not want everything to either go all off, or all on, in the event of power failure. This is achieved by storing the relay state in V31 shown in the code below and re-loading it from the server via the sync command, to re-instate it's status prior the the power failure/reset etc.
EDIT I should of also said the feedback for the AC is taken from L2 of either the relay or the physical switch. In the real word when this is complete that will feed the board I listed earlier in the thread converting the mains AC to a logic level which is read on pin 3 in my sketch ie. AC_Sens1_pin.
All comments greatly appreciated.
EDIT - forgot to tag you @Jamin
int RELAY1_PIN = 2; // Digital pin 2 for Relay1
int AC_Sens1_pin = 3; // Digital pin 3 for AC sensing1 signal
int feedback1; // Variable to store status of AC feedback1 presence
char auth = "xxxxxxxxxxxxxxxxxxxxxxx";
Blynk.syncVirtual(V31); //Get stored status of V31 from Blynk server at startup
timer.setInterval(200, AC1_detect); // Check AC1_detect for AC presence every 200 milliseconds
feedback1 = digitalRead(AC_Sens1_pin);
if (feedback1 == 0)
Blynk.virtualWrite(V2, 0); // update SWITCH widget state from AC input
Blynk.virtualWrite(V2, 1); // update SWITCH widget state from AC input
BLYNK_WRITE(V2) // Runs every-time switch widget V2 is toggled.
digitalWrite(RELAY1_PIN, !digitalRead(RELAY1_PIN)); // Toggle relay1
Blynk.virtualWrite(V31, digitalRead(RELAY1_PIN)); // Store relay1 state on V31 for re-sync if AC failure
BLYNK_WRITE(V31) // This runs on V31 re-sync at startup, and re-instates state
// of relay before power failure/rest etc
int V31_val = param.asInt(); // Get V31 value that is stored on Blynk server
digitalWrite(RELAY1_PIN, V31_val); // Set relay1 to state before power failure/reset etc