question of code ct

goodnight,
i have a question
I measure the lamp current (200watt) -> (0.9) from ct sensor and I put a relay
for lamp, i want when the current greater than 0.6 then turn off lamp.
When upload algorithm to arduino, current flows from 0.3 to 0.9 then 0.3 etc and does not remain fixed.

// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3

#include "EmonLib.h" // Include Emon Library
#include <LiquidCrystal.h>
EnergyMonitor emon1;
// Create an instance

//#define relay2 22
LiquidCrystal lcd(8,9,10,11,12,13);

void setup()
{
Serial.begin(9600);
lcd.begin(16,2);

// pinMode(relay2, OUTPUT);

emon1.current(0, 90.3); // Current: input pin, calibration.
}

void loop()
{
double Irms = emon1.calcIrms(1480); // Calculate Irms only

Serial.print(Irms*230.0); // Apparent power
Serial.print(" ");
Serial.println(Irms); // Irms
lcd.setCursor(0, 0);
lcd.print("lampe100=");
lcd.print(Irms);
lcd.print(" A");
if (Irms>0.6){
digitalWrite(relay2, LOW);
//delay(1000); //Delay 1 second
}
else{
digitalWrite(relay2,HIGH);
//delay(1000); //Delay 1 second

}*/

}

//delay(1000); //Delay 1 second
  
  
  

  }*/

I see a comment closing, but I don't see a comment opening.

I believe there are two things going on here. The first is that the light is changing resistance as it heats up and the current is going down over time until it stabilizes. That's what happens with my light bulbs anyway. The other is that the library uses a software high pass filter to both remove transients and to equalized the 2.5 volt offset that you must have to measure AC current; this high pass filter tends to wander a bit in the first minute until the algorithm settles out. Also, there is often a problem with using a CT to measure low currents. The devices tend to be noisy, which isn't a problem when you're measuring 15A, but you may have to add a capacitor to filter out some of the trash to work reliably at lower levels.

Give it a little time, at least 10 seconds to a minute to settle in and then see what happens. This will mean keeping the relay out of the circuit until you understand the operation over time.

Of course, there is also the possibility of some hardware problem, but I suspect you've set that up correctly.