Update button value when using bridge

Hi!

I’m creating a project using bridge that have two nodes. Node A reads temperature and humidity and the nodeB turns on/off a relay based on the humidity readed by nodeA.

In nodeA i got this code to read and change change the state of relay in nodeB:

BLYNK_WRITE(V5) {
  int value = param.asInt();
  autoHumidifier = value;
}

void getBME() {
  if (enableBME) {
    float t = bme.readTemperature();
    float h = bme.readHumidity();
    float p = bme.readPressure() / 100.0F; // hPa
    float alt = bme.readAltitude(SEALEVELPRESSURE_HPA); // m

    changeColor(bme.readTemperature());
    // ADD A CHECK OF THE VALUES TO AVOID DATA CORRUPTION
    if (t > lastT + threshold || t < lastT - threshold) {
      // the reading is outside the admited limits, so, asume the value hasn't changed since last time.
      t = lastT;
    } else {
      lastT = t;
    }
    if (h > lastH + threshold || h < lastH - threshold) {
      // the reading is outside the admited limits, so, asume the value hasn't changed since last time.
      h = lastH;
    } else {
      lastH = h;
    }
    // Check if any reads failed and exit early (to try again).
    if (isnan(h) || isnan(t)) {
      //Blynk.notify("Failed to read sensor");
      //Serial.println("Failed to read sensor");
      return;
    } else {
      Serial.print("t");
      Serial.println(t);
      Serial.print("h");
      Serial.println(h);
      Blynk.virtualWrite(V8, bme.readHumidity());
      Blynk.virtualWrite(V9, bme.readHumidity());
      Blynk.virtualWrite(V10, bme.readTemperature());
      Blynk.virtualWrite(V11, bme.readTemperature());

      if(bme.readHumidity() < 45 && autoHumidifier == 1){
        bridge1.digitalWrite(12,HIGH);
      }else if(bme.readHumidity() > 55 && autoHumidifier == 1){
        bridge1.digitalWrite(12,LOW);
      }
    }
    DHTnextSampleTime = millis() + sampleInterval;
  }

}

BLYNK_CONNECTED() {
  bridge1.setAuthToken("*******"); // Token of the hardware B
}

And in the node B, I have this code:

BLYNK_WRITE(V1) {
  int value = param.asInt();
  digitalWrite(12, value);
}

I want to change the state of button in nodeB based on the bridged action by nodeA. In the documentation it’s said that:

Keep in mind that bridge.virtualWrite doesn’t send any value to mobile app. You need to call Blynk.virtualWrite for that.

But I’m not sure how I need to do that. Thanks!

Treat it the same as if from an App widget… only the state change of the virtual pin is coming from the other bridged device.

E.g. on Device A you use the command: bridge1.virtualWrite(vPin, value); where vPin is the pin being controlled via the BLYNK_WRITE(vPin) on Device B.

Right. You need to intrduce one more pin for sending value (button state) via bridge and from there doing Blynk.virtualWrite (in your Node B code) to update button in your app.
Another approach would be to have timer in your Node B that checks digital pin status and, if needed, updates app button state.

Thanks!

Can I update the value of V1 of nodeB (to change how the button looks) from nodeA?