Please use code fences How To Ask For Assistance
I would add another proxy item like a switch that will serve as a flag
Switch isHome
rule "Welcome Home Lights"
when
Item iPhone_DistanceFromHome changed
then
if(iPhone_DistanceFromHome.state <= 800 && isHome.state != ON) {
if((hour >= 20) || (hour <= 5))
if(Light_Outside_ESPurna_10.state == OFF){
sendCommand(Light_Outside_ESPurna_10, ON)
postUpdate(isHome, ON)
}
end
As an exercise, I’d let you come up with the logic to turn isHome OFF