Channel switching itself off not as expected

I’m sure I’ve missed something obvious here.

I have a button on the dashboard assigned to channel 3. I would like to use is as an “all off” (switches off [digital output] channels 1 and 2 and itself).

I get a bounce action where sometimes it works but mostly it comes back on after it switches itself off… Code sample below. Running on an ESP8266

CAYENNE_IN(3)
{
  CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
  if (getValue.asInt() == 1) {
    Cayenne.virtualWrite(1, 0);
    digitalWrite(1, 0);
    Cayenne.virtualWrite(2, 0);
    digitalWrite(2, 0);
    Cayenne.virtualWrite(3, 0); //switch itself off
  }

the entire code might help a bit.