The issue I’m having is not being able to figure out how to get the second device integrated so I can select it.
Using your previous assistance I created a rule that will do the following (I hope):
When the “Fan Switch” is “ON” turn on the “Blower” and cycle it on and off every 10 minutes as long as “Fan Switch” Stays “ON”. If “Fan Switch” is “OFF” shut off “Blower”.
I cannot test this until winter as “Fan Switch” is controlled by a thermostat. Does it look like it will work?
You’ll need to add fan switch changes to off as a trigger.
And then yqou can keep the second If/then section and add below blower off, set variable False or you can move Blower off and add set variable false to the Else section so it’s ready for the next run.
Otherwise I think it looks ok.
Yes. That should work.
I don’t know your comfort level but if you’re interested, there are also context variables available for use that slightly speed up rule execution because it doesn’t have to pull the actual devices status.
Right now… comfort level is about a 1. I just started using Sharptools 2 days ago. I am very comfortable using variables, expressions, etc. in WebCoRe, but this is just a bit different. I’m sure in time, I’ll get there. Thanks for your help!!!
No problem. Let me know if you need more help.
So this is an old thread, but I used this to create a looping rule to watch a door lock being left unlocked for 10 minutes and send a message. Problem is, the lock is reporting back it is locked after it gets unlocked and I’m very confused. I checked the logs and it is reporting that it failed to match the if criteria and goes to the else. I viewed that it is reporting this:
[
{
“type”: “state”,
“subtype”: “device”,
“data”: {
“platform”: “samsung-smartthings”,
“locationId”: “98fbb808”,
“deviceId”: “cee2d65e”,
“attribute”: “lock”,
“state”: {
“attribute”: “lock”,
“value”: “locked”,
“timestamp”: “2023-02-14T19:15:28.133Z”,
“isStateChange”: null
}
}
}
]
I’m not sure if there is a huge delay in reporting, but the lock change triggers the rule, so that is also confusing to me. The lock icon changes on the smartthings app, too. Or am I missing something obvious in my rule set up.
Thanks for any thoughts.
For the IF condition, if you are trying to use the state from the lock/unlock event to update a variable, I would recommend using Context Variables → Event → Device → Value.
The condition would end up looking something like:
IF $context.event.value is ‘unlocked’
THEN …
This avoids any potential issues where SmartThings might have issued the event for your lock saying it was unlocked, but the state didn’t get updated yet. This can happen for a number of reasons - sometimes it’s just a simple race condition where the event is sent across and triggers the rule before SmartThings has updated their database. Or as you alluded to, in this case it could also be SmartThings bigger issues with some of their recent Edge Driver / Platform updates.
So I set up a check to see if my door remains unlocked after 10 minutes and send an sms and announce on my echo device, too. I also set up a manual suppression of those alerts by utilizing a virtual switch and auto resume alerts after one hour. If anyone is interested in seeing how I did that, let me know and I’ll take screenshots of the rules and post them.
I’m interested in seeing a screenshot of this part, Thanks
Rule 1: The check rule is triggered when the door is locked or unlocked. I had to use the context value to get the lock state after the trigger event in the if statement because my lock was returning a locked state even after it was locked. Thanks to @josh for this tip!
I added a couple of virtual devices to get this all to work using this: [ST Edge] Virtual Hub Kit [BETA] - Community Created Device Types - SmartThings Community
I needed a virtual sensor to trigger Alexa and a virtual switch to trigger the reminder suppression.
Rule 2: The reminder loop checks the virtual switch to see if it should suppress the notifications, and sends a sms and triggers Alexa by changing the virtual sensor to open and then back to close. I had to use all lowercase when syncing the state of the virtual sensor or it threw an error.
Rule 3: Because an Alexa routine won’t trigger on a switch, I had to use a virtual sensor here. I have Alexa announce the door is unlocked when the virtual sensor opens.
@Paul_Paul here is where the suppression starts, but is integrated in previous rules…
Rule 4: When I turn on the virtual switch, it changes a variable for rule 2 so the notifications don’t go out. It also sends me an sms that tells me when the notifications will automatically resume, one hour from now. If the switch is set to off, it sends me an sms to tell me that. I trigger the switch in the Smartthings app.
Rule 5: When the suppression virtual switch has been on for an hour, it triggers this rule and the virtual switch is turned off which triggers a sms to tell me so.
Let me know if anyone has questions, I hope this helps @Paul_Paul
Wow, Thanks for a great writeup
I must admit I’ve read through it 4 or 5 times to get my head around it
Detailed explanations like this are a massive help for understanding complex rules
You’re most welcome. Let me know if I can help when you go to set up your own rule.
In this example. If the goal was to do this for all windows and doors, would you have to have a variable for each window and door?