Can I have both individual buttons and the tagged button?

Hi @Dmitriy i have followed the docs, created a teg with 2 devices, assigned the tag to a button. what pin numbers do i assign because i also have the 2 devices assigned to individual buttons so in the tagged button the original pins show as BUSY? so does it mean i cannot have both individual buttons and the tagged button?

@jasperdog Please don’t “reopen” old topics… Start with a current topic of you own and provide details of your issue. Thanks.

ok @Gunner thanks, i didn’t know whether to open a new topic or ask the question in the original post.

Generally if the topic is a month or less… and your question is related and not a “Me Too” tag on… then asking a clarifying question is generally fine.

But if you have a similar, but independent, issue… it is best to do a lot of reading and comparing notes from other topics, then detailing your issue and asking clear questions in your own topic

And on that note :wink: Can you clarify your issue/question… I don’t quite follow what you are trying to do… aside from the fact that if you are using direct pin control (from the App), then only one widget at a time can use a pin.

If you want to control a single pin from multiple methods… use virtual pins and code the physical pin action on the device.

ok here we go.
2 devices are identical in hardware both ESP-01 using GPIO2 controlling 2 lamps
kitchenlamp
bedroomlamp
TAG is named kitchenbedroom

the app side layout 2 buttons with 2 timers

the codes are identical except for the tokens so i’m only showing one code.

#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
}


// WeMos on board LED is active LOW
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{

screenshots of app buttons and timers and the button containing the TAG of the 2 devices namely kitchenlamp & bedroomlamp.

the final screenshot is of the BUSY vpins.

i’m guessing that i need to incorporate V3 in my code to use in the TAG button?

Hmm… based on the Docs for Tags…


Tags

Tags feature allows you to group multiple devices. Tags are very useful in case you want to control few devices with 1 widget. For example, imagine a case when you have 3 smart bulbs and you want to turn on all those bulbs with one single click. You need to assign 3 devices to 1 tag and assign tag to button. That’s it.

Tag widgets also support state syncing. So you can get state of widget from your hardware. However you can’t update state of such widgets from hardware.


You have you two devices, so create a tag, link both devices and a button to the tag… yes… simple :stuck_out_tongue: I think… I haven’t tried it yet :smiley:

that is what i have done

Based on your QR… when in the edit of the Kitchen Bedroom Button, click on Target and select the option under My Tags.

Then when pressing that button, it should activate same vpPins on both devices

what pin goes in the pin field

Same pin as the other two devices… edit… oh I see… busy… hold on please, your call is important to us… :wink:

OK, in all three buttons you need to select the tag as the target… try that first, then you can select V0 in the third combo button, then go back and sort out the tags?? Kitchen to Kitchen device, Bedroom to Bedroom device, combo to both tagged devices

solved it’s the GPIO D2 pin that needs selecting instead of the V pins which show as busy, the only drawback so far is that it doesn’t sync with the VO button and light it up when the TAG button is ON and lit up.

i see a problem with this, it means that all hardware devices need to be the same i.e because not all ESP boards used D2

Oh, that makes sense… Tags are a way of directly controlling digital pins from the App.

But if using virtual pins, then all of that control can be handled in code, which is how I always do it, thus not familiar with Tags and such :stuck_out_tongue:

Well, thanks for helping me out with a question I didn’t have, for a situation I never use… but learned from anyhow :rofl:

As you chose different devices, how the pin labels are displayed also changes to match the device… and again, when using only virtual pins, none of the pin labeling (in the App) even matters as all the logic is handled on the sketch side.

actually i think its your way of coding that i need to go with so it doesn’t matter what esp board is used it will always work

i just tried making another TAG by selecting 2 different devices knowingly that one was an esp-01 and the other a sonoff meaning i can’t select D2 as the TAG pin because one is D2 and the other is D12 so it couldn’t be done

so how could i adapt my code to manage this?

OK, I am a bit unsure of the workings :stuck_out_tongue_winking_eye:

Try setting the digital pins and respective devices in each rooms button, but in the third combo button, select the tagged devices but DONT set any pin… will that still work?

i tried that and it does not work because of the timers, the digital pins show as busy