Only Allow Rule to Run Once a Day

Hi
Is there a way to make a rule run Only once per day?

@Birendra_Vithanage, can you provide a bit more context about your rule needs? Is the rule to be triggered by a location/device event or at specific time of the day everyday?

If the rule is to be triggered by location/device event(s), you can create a True/False variable, or a Virtua Switch from SmartThings/Hubitat platform, and use it in the IF condition in rule flow to determine if the rule should be executed or not, and you can reset this variable/virtual switch once a day in another rule depends on your needs.

Or if you simply want the rule to be executed at a certain time of the day everyday, you can just use the Timer event in the trigger.

I’d be happy to provide more specific example if I can understand the automation needs better. :wink:

Turning on the light according to illuminance and the precence.
But the problem is that after the rule ran if I turn off the light it turns the light on again after some time.

See below for the rule example that you can use a variable to restrict the rule to be executed once until the variable is reset. (You can also use Virtual Switch from SmartThings/Hubitat with the same concept.)

Then you can have another rule to reset this variable once a day according to your needs.

3 Likes

Thnks Ill try this today

Thank you, James! I was also struggling with the same case.

1 Like

This requires a premium account though right? Variables aren’t available for non-premium as far as I know…

Yes, Variable support is a premium-only feature. Or you can create a Simulated/Virtual Switch in SmartThings/Hubitat and use it as the variable in logic described above.

That’s such a great suggestion! Ill do that

I have a similar situation. I want to set up a LUX measurement so when it hits at or below that #, it triggers a number of lights to turn on. I have that part set up. The other condition is I only want it turn on the lights between certain hours (I was trying to set the beginning time for noon and the ending time for around sunset, but it looks like you can’t mix and match a beginning time with a sunset as the ending time.)

Once the LUX threshold is met, I don’t want it to execute any more commands, even if all the conditions are met, until the next day, starting at noon. Basically for the same reason previously mentioned because if I turn a light off and it still hits the time and LUX threshold, it’s going to turn that light back on again and then I’ll be fighting with the automation. Also, every time the LUX changes, it’s going to cause the rule to run again and again. Should I follow the same examples you gave? I am thinking to try the virtual device in SmartThings if I can figure it out. Thank you.

The between times IF Condition requires two specific times, but you can use two separate
conditions AND’ed together to limit between a specific time and sunset.

It sounds like the approach James mentioned with using a variable and setting initializing it to True to allow the condition to pass and then setting it to False inside the Then path would work for you. Just make sure to have another rule reset the variable at midnight each day.

1 Like

Much appreciated. Can I still achieve this with a virtual device? Also, is there a way for all lights to turn on at the same time, instead of it turning on one, then the next, etc. in the order is is programmed?

Yes, a virtual switch should work fine as a flag. You might try a Scene for sending commands to multiple devices at once. Until SmartThings properly supports group broadcasts, you’ll still likely see some amount of ‘popcorn’ effect though.

Ok, I actually don’t mind it, but the scene is always an option.