Rule for dusksensor

Hi I have a little problem with my dusk sensor that suppused to turn on & off lights, sometimes it works and sometimes it doesn’t. What I would like to achive is that when dusk sensor start to turn On, OFF,ON.OFF and so on for quite some time during sunrise or down my rules will only be triggerd Once and not each time dusksensor switches. I’ve been trying with boot mapdb persitance and rr4dj

Rule

rule "skymmning till"
when
Item g1_Skymmning changed from OFF to ON
then
if(g1_Skymmning.updatedSince(now.minusMinutes(120), “mapdb”) && g1_Framsida.state==OFF){
sendBroadcastNotification(“Skymmning på”)
sendCommand(g1_Framsida, ON)
sendCommand(g1_Framsidakod, ON)
sendCommand(gT_doorlamp, ON)
sendCommand(g2_hall_uppe, ON)
}

end

rule "Skymmning av"
when
Item g1_Skymmning changed from ON to OFF
then
if(g1_Skymmning.updatedSince(now.minusMinutes(120), “mapdb”) && g1_Framsida.state==ON) {
sendBroadcastNotification(“Skymmning av”)
sendCommand(g1_Framsida, OFF)
sendCommand(g1_Framsidakod, OFF)
sendCommand(gT_doorlamp, OFF)
sendCommand(g2_hall_uppe, OFF)

		}

end

mapdb persitance

Strategies {
default = everyUpdate
}

Items {
// persist all items on every change and restore them from the db at startup
g1_Skymmning : strategy = everyChange, restoreOnStartup
}

rr4dj persistance right now my persitance for that item is in mapdb.

I hope somebody would like to help me out here I guess I’m missing som basic stuff here.

Strategies {
// for rrd charts, we need a cron strategy
everyMinute : “0 * * * * ?”
}

Items {
g1_Innetemp,gT_Utetemp,gG_Garagetemp,

// let's only store temperature values in rrd
Temp*: strategy = everyMinute, restoreOnStartup

}