Can I have both individual buttons and the tagged button?

Well, sorry, I can’t figure it out on my end :stuck_out_tongue_winking_eye:

I think if a V3 could be incorporated in each sketch, then it would work, how would i edit my code to do this, any ideas?

In hindsight… since the Tags support vPins, then it should still work with digital, virtual or perhaps even a combo…

But until I setup some of my own devices and test it I just can’t explain.

thanks for your help so far, i’m lost with it now, i’ve tried combinations of things, the only working model i could get was using D2 pins of 2 identical devices esp-01 and 2 sonoffs D12 but not any variants like a D2 and a D12 because only one digital pin can be selected, i still think adding V3 in the sketch would work but i am not a coder so i am stuck.

@Gunner who else do you think may know?

Not really a case of me knowing who or what :stuck_out_tongue_winking_eye:

This is a public forum, so anyone reading it who has info and wishes to contribute… will do so.

It does seem that you would need a Virtual Pin for each button/timer/tag. For example V0 for Timer Widget, V1 for Button Widget, and V2 for Tag Button Widget.

This seems like it should be easy enough to implement, just copy your V0 (timer) function. Change V0 to V2, edit the notification to say what you would like when the Tag Button is pushed, and upload it to both of your devices. Then add a Button Widget to the APP assigned to V2 with the Target selected as the TAG.

For the existing Button Widget and Timer they should be set to the specific device they are controlling, as they are now.

Hope this helps.

thanks @Toro_Blanco i’ve got V2 successfully tagged meaning i can turn on and off the 2 different ESP devices using the V2 button and also the buttons all sync after some juggling around, the finished code is below.

here is the modified code adding V2
#define BLYNK_PRINT Serial
#include <ArduinoOTA.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

    #define GPIO (2)

    char server[] = "*************";
    char ssid[]   = "*************";
    char pass[]   = "*************";
    char auth[]   = "*************";  


    void setup()
    {
      pinMode(2, OUTPUT);
      digitalWrite(2, LOW); // LED OFF on bootup
      Serial.begin(115200);
      Blynk.begin(auth, ssid, pass, server);
      ArduinoOTA.setHostname("kitchenlamp"); // OPTIONAL
      ArduinoOTA.begin();
      Blynk.virtualWrite(V1, 0); // button set to OFF on bootup
    }


        BLYNK_WRITE(V0){      // Timer widget                     
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V1, 1); // button set to ON from timer
    Serial.println("Timer ON activated");
  }
  else{
    Blynk.virtualWrite(V1, 0); // button set to OFF from timer
    Serial.println("Timer OFF activated"); 
  }
  Blynk.syncVirtual(V1);      // sync virtualWrite 0 / 1 to button widget
}

BLYNK_WRITE(V1){      // Button widget in SWITCH mode                     
  if (param.asInt() == 1) {
    digitalWrite(2, HIGH);
    Serial.println("LED ON");
  }
  else{
    digitalWrite(2, LOW); 
    Serial.println("LED OFF"); 
  }
  
  }
BLYNK_WRITE(V2){      // Timer widget                     
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V0, 1); // button set to ON from timer
    Serial.println("Timer ON activated");
  }
  else{
    Blynk.virtualWrite(V0, 0); // button set to OFF from timer
    Serial.println("Timer OFF activated"); 
  }
Blynk.syncVirtual(V0);      // sync virtualWrite 0 / 1 to button widget
Blynk.syncVirtual(V1);      // sync virtualWrite 0 / 1 to button widget
}



void loop()
{
  Blynk.run();
  ArduinoOTA.handle();
}
1 Like

and the finished QR code

1 Like

Awesome glad I could help.

BLYNK ON!!