ESP 8266 control my 433mhz power plug´s Smarthome

Hi Sven

I built pretty much the same last year and included some code to prevent the transmitter from continuously sending an ‘on’ or ‘off’ signal every loop cycle

The code just sends one signal if the button state changes.

Don’t know if it helps with the stability issue but you could try.

CAYENNE_IN(1)
{
state = getValue.asInt();
//CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL, ACTUATOR_PIN, value);
digitalWrite(ACTUATOR_PIN, state);
Serial.print("State: ");
Serial.println(state);

//Check switch status if it is 1 and then activate the remote switch
//Only one activation event will do, the switchstatus variable will take care of that.
if( state == 1 and switchstatus == 0){
mySwitch.send(329041, 24);
}
// Below it sets the switchstatus to 1 the in the first cylce after the button was pressed. (will be reversed if the button is set to off)
if( state == 1 and switchstatus == 0)
switchstatus =1;
delay (200);

//Check switch status if it is 0 and de-activate the remote switch
//Only one de-activation event will do, the switchstatus variable will take care of that.
if( state == 0 and switchstatus == 1){
mySwitch.send(329044, 24);
}

if( state == 0 and switchstatus == 1)
switchstatus =0;
delay (200);