Button running i2c relay wont stay in on position

Hi everyone, I am trying to use blynk button to run a i2c relay, I can get it to send the command to turn it on but it turns it back off instantly, I can tell via serial prints where my code is no good but I am to new to coding to be able to write code that will work, can anyone please take a look and see what i need to change to make it so the relay stays on until it is told by blynk to turn off. Or what i am trying to eventually accomplish to get the temp to control the relay to turn a fireplace on and off at certain temperature ranges, like you would a thermostat that controls a heater. ie set it at 72 degrees and it keeps it within 3 or so degrees of that temp if the button is on…
here is my code

#define BLYNK_PRINT Serial
#define FIRE 


#include <Wire.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
#define COMMAND_RELAY_OFF     0x00
#define COMMAND_RELAY_ON      0x01
const byte qwiicRelayAddress = 0x18;     //Default Address
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "f0a0e7d1ed404f5d8de43af76dd5e15b";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Th#@$#t";
char pass[] = "#$@#$@#$";

#define DHTPIN 13          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(true); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}
  BLYNK_WRITE(V4) {
   int f = param.asInt();
  
    if(f == 1);
    relayOn();
  
  
  
  }


void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  dht.begin();
  Wire.begin(); // join the I2C Bus
  testForConnectivity();
  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run();
  timer.run();
}
// RelayOn() turns on the relay at the qwiicRelayAddress
// Checks to see if a slave is connected and prints a
// message to the Serial Monitor if no slave found.
void relayOn() {
  Wire.beginTransmission(qwiicRelayAddress);
  Wire.write(COMMAND_RELAY_ON);
  Serial.println("Fire ON");
  if (Wire.endTransmission() != 0) {
    Serial.println("Check Connections. No slave attached.");
  }
}


// RelayOff() turns off the relay at the qwiicRelayAddress
// Checks to see if a slave is connected and prints a
// message to the Serial Monitor if no slave found.
void relayOff() {
  Wire.beginTransmission(qwiicRelayAddress);
  Wire.write(COMMAND_RELAY_OFF);
  Serial.println("Fire OFF");
  if (Wire.endTransmission() != 0) {
    Serial.println("Check Connections. No slave attached.");
 }
}


// testForConnectivity() checks for an ACK from an Relay. If no ACK
// program freezes and notifies user.
void testForConnectivity() {
  Wire.beginTransmission(qwiicRelayAddress);
  //check here for an ACK from the slave, if no ack don't allow change?
 if (Wire.endTransmission() != 0) {
   Serial.println("Check Connections. No slave attached.");
    while (1);
 }
}

I’m reading this on an iPad, so I might be overlooking something, but here’s a few comments,…

How is your Button widget set up?
By default they are set to Push, so send a “1” when pressed then immediately send a “0” when released.

However, your BLYNK_WRITE(V4) function is a bit of a mess. It has semicolon where it shouldn’t, missing curly brackets, and no option to call the relayOff function.
I think you’ll find it should look more like this:

BLYNK_WRITE(V4)
{
  int f = param.asInt();
  
  if(f == 1)
  {
    relayOn(); 
  }
  else
  {
    relayOff(); 
  }
}

Pete.