In a post-Groovy world, what options do we have to create a routine based on a regular sub-day timer? For example, run a vent fan once an hour for 10 min. I have seen anything in the stock ST app. Does anyone have an edge timer driver for creating these triggers?
It could be easily added by adding preferences for On time and Off time in a switch driver.
It can also be easily done with two automations, what happens is having timeouts are not executed locally.
1 automation:
-IF
- Switch off
- for 50 min
-Then
- Switch On
- Power off after 10 min
2 Automation:
-IF
- Every day at 0 a.m.
-Then
- Switch On
- Power off after 10 min
You can do it with a Rule too. Haven’t tried this but it looks about right.
name: "On for ten minutes per hour"
actions:
- every:
interval:
value:
integer: 1
unit: Hour
actions:
- command:
devices:
- &switchuid 12345678-1234-1234-123456789012
commands:
- component: main
capability: switch
command: on
- sleep:
duration:
value:
integer: 10
unit: Minute
- command:
devices:
- *switchuid
commands:
- component: main
capability: switch
command: off
Both good solutions. Thanks for the suggestions. I tried the “Power on off” rules that you get in ST. They allow for 3 on/off sessions per day. Unfortunately, they only ever turn on for me and don’t shut off.
@blueyetisoftware,
Hello
I added a timer with On and Off times programmed in preferences in the zigbee Switch Mc driver, in case it can help you
I am trying to do something similar by turning on a virtual switch (which triggers an alexa annoucement) hourly when my garage has been left open. Any thoughts on how to trigger this routine every hour? Thanks
I think, now, with new Android app version (maybe before). there is an option for “Stays this status for how long”. that could be used in an IF switch is ON
which could be used to trigger a virtual switch.
I think that would work, anyway.
You can make a routine with the door sensor and a virtual device, for example called a reminder:
IF:
- open sensor open during x minutes
and - virtual switch reminder = Off
THEN
- virual switch reminder = On and turn Off after “y” minutes
- Send notification
This will send you a notification when it is open for x minutes
It will send you a notification every y minutes while the door is still open.
In example first notification at 1 minute and every 2 minutes
You can also made the routine with the garage light itself.
- If when the garage door is opened the light comes on and you put it to turn off after x minutes.
- If the light goes out and the door is still open, turn the light on and turn it off after y minutes and send a notification.
It’s the same, but without virtual switch
Amazing. Thank you this is exactly the logic I needed. I had about 8 routines built to achieve the same thing and not reliably.
Any idea how to use this idea for two garage doors ? Ie. If either garage is open for x time, send reminder every x minutes? I could duplicate the routine but I think that will result in two independent reminders. I want one reminder every 30 mins regardless of it one or both garage doors are open. Is this possible? Thanks.
Hi @sdbg
At the moment it is not possible to make routines that have an OR condition and an AND condition. you have to do 2 routines;
A routine that says:
IF door A or door B is open for more than x minutes turns On a virtual reminder switch and turns Off after y minutes + sends a notification.
Another routine that says:
IF switch Virtual reminder is Off THEN turn on switch virtual reminder and turn it off after y minutes + send a notification
In the example you provided of routine 2, wouldn’t that routine result in sending a reminder even if both garages have been closed? This would be a phantom reminder I think…
Yes, you are right, the second routine stays in a loop because it only has one trigger.
You would have to do another routine and add another virtual device All doors check:
-
IF: Door A & Door B & Door X… are closed THEN virtual all Doors check to Off
-
IF Door A or Door B or Door X… is open for more than x minutes
-
THEN
virtual all Doors check to On -
IF
- virtual all Doors check is On
And - Virtual remainder is Off
- virtual all Doors check is On
-
THEN
- Virtual remainder On and turn Off after “y” minutes
- send notification
I think It will work for two or more Doors open
Hi Mariano, as stated in another thread, I’d like to get recurring reminders at certain intervals if a door has been left open. I’m not able to wrap my head around this routine. Is it one routine per contact sensor? Each contact sensor requires a virtual device? What is the logic for the virtual device control? I don’t see a “reminder” option for the “then” logic in the ST routine options.
Hi @shobuddy
in one moment a send you two examples
Hi @shobuddy
The reminder is the name that I give to the virtual device, you can name it whatever you want.
This routine is for each contact sensor and requires one virtual device each.
If you are going to use more sensors you can do other things:
-
- You can use Virtual Appliances Mc driver creating a SwitchBoard virtual sensor from 2 to 5 switches that I have on my channel. with which you can do up to 5 routines for 5 sensors with a single virtual device.
In this way it will send you a personalized and independent message for each open sensor during “x” minutes + another one every “y” minutes
- You can use Virtual Appliances Mc driver creating a SwitchBoard virtual sensor from 2 to 5 switches that I have on my channel. with which you can do up to 5 routines for 5 sensors with a single virtual device.
-
- You can do 3 routines with Virtual Appliances Mc driver creating a SwitchBoard 2-Switches virtual device to control all your sensors in the house and it would send you 1 message when one or more sensors are open for “x” minutes and every “y” minutes until they are closed everybody.
Example for 4 doors:
- You can do 3 routines with Virtual Appliances Mc driver creating a SwitchBoard 2-Switches virtual device to control all your sensors in the house and it would send you 1 message when one or more sensors are open for “x” minutes and every “y” minutes until they are closed everybody.
Create virtual device SwitchBoard 2-Switches. I renamed as Virtual Letf it Open
You can write the name for every switch, only for detail view.
1st automation:
- Switch 1 will turn On when any door is open for more than x minutes (in example 1 minute)
- switch 2 will turn Off when any door is open for more than x minutes later (in example 1 minute)
- You can add precondition: If location mode is Away
- You can add to send a notification with: Some door is open more than “x” minutes
2nd automation:
IF:
- Virtual Switch 1 is On and Virtual Switch 2 is Off
- You can add precondition: If location mode is Away
Then:
- Virtual Switch 2 turn On and turn Off “y” minutes after ( in example 2 minutes)
- Send Notification: Any Door is Open since 1 minute or more
3thd Automation:
IF:
- All doord are closed
- You can add precondition: If location mode is Away
Then:
- Virtual Switch 1: Turn Off
- Virtual Switch 2: Turn Off
- Send Notification: All Doors Closed
The Three automation:
This is the link to my Shared Channel to install Virtual Appliances Mc driver
Some observations about the workaround loop functionality… Only required if you have a bit of OCD
I also wanted to have a loop running. A Timer that restart every 5 minutes and followed the logic to turn on/off after. I used the EDGE virtual device creator for the virtual switch
What I did (similar to above couldnt figure out how to combine nbr 1 and nbr 2)
Rule 1: If virtual switch off for 5 minutes turning it on
Rule 2: If virtual switch on for 5 minutes turning it off
Rule 3: At midnigh every day turning it off/on > This is to align things to exact “00” minutes and in case something breaks
Once you start this it worked fine
Something happened while I was testing My power went out for a few minutes. Unfortunately after everything came up the cycle was broken and would never recover. Simply the loop stopped and stay liked that. As if, once power came back up there is no conscience of something been “turned on” or “turned off” for some period of time. Maybe this is a bug?
Anyway, if you don’t care you can wait for rule 3 to get things going.
Otherwise (OCD), you can run a routine in sharptools to monitor ST and kick things back again.
BTW, Sharptools is also inflicted by the same issue as smartthings and you need to create a routine similar to create a cycle (inspiration here). However in sharptools you can rely on variables.
In summary:
Rule1: 5 minute loop in sharptools by setting a boolean variable on/off. Everytime the variable is set to true, then increase a counter by one. If counter reaches two (problem) reset virtual switch in smartthings (to kick things back in operation)
Rule2: Every time ST virtual switch changes to on, set counter to zero (this is ST saying no need to fix me I am working)
With these, the longest that it goes with an outage is 10 minutes
I’m guessing it’s because SmartThings still does some Routines with timing in the cloud and not local on the Hub.
However, since you are using @TAustin’s Virtual Device Edge driver, take a look at the virtual motion device since it has a built-in ‘motion duration’ timer. I’m using the built-in motion duration timer for a few things.
Strange since the routines have the little home icon indicating they happen locally. Also the issue was a short power outage of 3 seconds. After that power/internet was fine after all equipment was up (maybe 3 minutes). But routine would not kick in.
I will check the motion sensor