Controlling output using RemotXY and push button at the same time

hi
i am working on controlling my lights with my phone and a push button, the button is not the locking type and I am using relays so I just need to control the output signal High or low.
I can control the relayes with my phone, but with the button it is not working right, it only switches it the moment it is pushed and then returns to the state selectedon the phone.
how do i make it all work together?
this is the code i have.
(it is the first time I post, so I could be not clear enough)

type // RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__ESP8266WIFI_LIB_CLOUD
#include <ESP8266WiFi.h>

#include <RemoteXY.h>

// RemoteXY connection settings 
#define REMOTEXY_WIFI_SSID "*******" //here is the wifi name 
#define REMOTEXY_WIFI_PASSWORD "******" // and here is the password
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "/*cloud token from RemoteXY*/"


// RemoteXY configurate  
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 78 bytes
  { 255,4,0,0,0,71,0,16,159,1,2,1,20,16,22,11,151,4,31,31,
  79,78,0,79,70,70,0,2,1,20,35,22,11,151,4,31,31,79,78,0,
  79,70,70,0,2,1,20,52,22,11,151,4,31,31,79,78,0,79,70,70,
  0,2,1,20,67,22,11,151,4,31,31,79,78,0,79,70,70,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t night_light; // =1 if switch ON and =0 if OFF 
  uint8_t light1; // =1 if switch ON and =0 if OFF 
  uint8_t light2; // =1 if switch ON and =0 if OFF 
  uint8_t extra; // =1 if switch ON and =0 if OFF 

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0 

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////

//output pins declaring
#define PIN_NIGHT_LIGHT D0
#define PIN_LIGHT1 D1
#define PIN_LIGHT2 D2
#define PIN_EXTRA D3

//input pins declaring
#define PIN_Button1 D5
#define PIN_Button2 D6
#define PIN_Button3 D7
#define ISPRESSED LOW

//light status
byte Night_Light1_Status = HIGH;
byte Light1_Status = HIGH;
byte Light2_Status = HIGH;
byte Extra_Status = HIGH;

//setup 
void setup() 
{
  RemoteXY_Init (); 
 Serial.begin(57600);
  
  pinMode (PIN_NIGHT_LIGHT, OUTPUT);
  pinMode (PIN_LIGHT1, OUTPUT);
  pinMode (PIN_LIGHT2, OUTPUT);
  pinMode (PIN_EXTRA, OUTPUT);

  ///////////////////////////////
  pinMode (PIN_Button1, INPUT_PULLUP);
  pinMode (PIN_Button2, INPUT_PULLUP);
  pinMode (PIN_Button3, INPUT_PULLUP);

  // TODO you setup code
  
}


//loop function
void loop() 
{ 
  RemoteXY_Handler ();

// declaving status variables
 static byte currentButton1Status = !ISPRESSED;
  byte button1Status = digitalRead(PIN_Button1);
  /////////
  static byte currentButton2Status = !ISPRESSED;
  byte button2Status = digitalRead(PIN_Button2);
  /////////
  static byte currentButton3Status = !ISPRESSED;
  byte button3Status = digitalRead(PIN_Button3);
  

 //setting 
    int NL = RemoteXY.night_light;
      if (NL==0)
      {
        Night_Light1_Status = LOW;
      }
      else if (NL == 1)
      {
        Night_Light1_Status = HIGH;
      }

      /**********
       * button1
       */
       if (button1Status != currentButton1Status)
  {
    currentButton1Status = button1Status;

    if (currentButton1Status == ISPRESSED)
    {
      // change the led status when the button becomes pressed
      Night_Light1_Status = !Night_Light1_Status;
    }
  }
  digitalWrite(PIN_NIGHT_LIGHT, Night_Light1_Status);
  //made this to moniter changes
  Serial.print(NL);
  Serial.println(Night_Light1_Status);
  delay(1000);

  //below this is the remotxy original code
  //digitalWrite(PIN_NIGHT_LIGHT, (RemoteXY.night_light==0)?LOW:HIGH);
  digitalWrite(PIN_LIGHT1, (RemoteXY.light1==0)?LOW:HIGH);
  digitalWrite(PIN_LIGHT2, (RemoteXY.light2==0)?LOW:HIGH);
  digitalWrite(PIN_EXTRA, (RemoteXY.extra==0)?LOW:HIGH);
}

so yeah, I need help keeping the relay on

I got the adjusments from this forum discution How to using push button with using remoteXY

oh and I am using nodemcu esp8266 and I set only one button for testing

ok, I just solved it myself :sweat_smile: :joy:
after digitalWrite, I put RemotXY=*****( the requiered output)
like this:

 digitalWrite(PIN_NIGHT_LIGHT, Night_Light1_Status);
  RemoteXY.night_light = Night_Light1_Status;

so now it changes in my phone as well as the output