How to prevent a Tasker profile from toggling back-and-forth? I have a Samsung Galaxy S3 with Tasker 4.0u1 installed. I have a "Low Light" profile which activates ScreenFilter when %LIGHT == 0 (and I'm not in certain apps which don't react well to the filter being turned on).

In dark situations, this works quite well and prevents the S3's bright (even on minimum brightness setting) screen from hurting my eyes.

The problem I have is that in dim-light situations, the filter keeps turning on and turning off, which gets so annoying I have to pop into Tasker and shut the profile off.

How to prevent the profile from toggling back-and-forth?
Based on Izzy's suggestion, this is what I've come up with:

Profile: Toggle Screen Filter
Primary Context: Variable Set %LIGHT
Secondary Context: Not in Netflix, Safe in Cloud, etc.
Task:

1. Perform Task `Distance` Priority 8 Parameter 1 %LIGHT Parameter 2 %OLDLIGHT Return Value Variable %lightchange
2. If %lightchange &gt; %LightThreshold
3.   If %ScreenFilterOn = 1
4.     Perform Task `Screen Filter Off` Priority 8
5.   Else
6.     Perform Task `Screen Filter On` Priority 8 If %LIGHT = 0
7.   End If
8. End If
9. Variable Set %OLDLIGHT To %LIGHT


Task Distance:

1. Variable Set Name %rval To %par1 - %par2 Do Maths True If %par1 &gt; %par2
2. Variable Set Name %rval To %par2 - %par1 Do Maths True If %par2 &gt; %par1
3. Variable Set Name %rval To 0 If %par1 = %par2
4. Return Value %rval


Task Screen Filter On:

1. Screen Filter 48.6% Soft-keys On
2. Variable Set Name %ScreenFilterOn To 1


Task Screen Filter Off:

1. Screen Filter 100% Soft-keys On
2. Variable Set Name %ScreenFilterOn To 0


I had to fiddle with the value of %LightThreshold a bit. I started out with it set to 30, but that turned out to be so high that Screen Filter never activated. With it set to 10, things seem to be working well for now. I'll report back in a couple of days.