I’m hoping this is possible.
Relatively new to anything complex within Sharptools but purchased the premium version as I saw the Black Friday discount going.
Can anyone say whether I can achieve this or not?
The ‘do’ is just a virtual switch and I know I can do that, it’s more the top part of this piton.
Thanks.
I trick the system by using “changes and is not” and then enter something random.
If it only supports on/off I sync it to a variable I use instead and use that as the trigger.
I made a wrong assumption you needed a state changed, without to what state, argument.
But after reading your post several times again, the most difficult part I see is to get those 10 minutes active or inactive.
Does the inactive matter? If it doesn’t, I’d create a variable toggle on and off. You can create a rule that triggers by “state stays inactive for 10 minutes” to turn it on for a certain duration if needed. Or also create a rule that turns it back to off once active.
I’m thinking the following might work (be sure to scroll through the entire code, which is likely only partially visible.)
**TRIGGER(S)**
Event Trigger - Device
Driveway's Motion changes to 'active'
+
**FLOW**
Action
setVariable $doStuff to False
IF Condition - ANY
En Suite Motion Sensor has stayed active for 10 minutes
OR
En Suite Motion Sensor has stayed inactive for 10 minutes
THEN
IF Condition - All
En Suite Motion Sensor is active
THEN
setVariable $doStuff to True
ELSE
(Blank)
ELSE
setVariable $doStuff to True
+
IF Condition - Any
$doStuff is True
THEN
(Do stuff)
Explanation
The trigger for the Rule is Driveway’s Motion changing to Active
Once triggered, we set a boolean variable $doStuff to False
The first IF checks if En Suite Motion has been active or inactive for 10 minutes. If either of these conditions is true, the En Suite’s motion has not changed in the last ten minutes. If both conditions are False, then En Suite’s motion did change in the last ten minutes.
Under the THEN side of the top level IF, we nest an IF to check if En Suite is active. If it is, then $doStuff is set to True.
On the ELSE side of the top level IF, the rule set $doStuff to true because we know En Suite did somehow change in the last 10 minutes.
Finally, underneath all that, IF $doStuff is true, then execute whatever instructions you like under THEN. The ELSE portion is blank, as none of the conditions you specified were true.
I haven’t actually tried this and it’s possible I still have brain fog from Thanksgiving, so perhaps someone will offer a correction if I missed something. But it’s a place to start.
Thank you mate. All of this seems very confusing for me though.
I guess there isn’t a way to just have ‘if motion sensor has changed in the last 10 mins’ rather than having to set all of that other stuff up? I have over 20 of these pistons on webcore so setting all that up would take forever, although I don’t even think I could because a lot of that is going over my head.
Yes it matters mate because I’d only want Alexa to announce any motion on outside cameras if I’m in that particular room.
So take for example the EnSuite. The only way I could see this being possible was to either have the en suite motion sensor active, or it’s changed within the last 10 mins. After it’s changed after 10 min ( either active or inactive ) then I’ll no longer be on there.
If I just have an or statement as ‘active’ or inactive’ then it’ll still announce all the time when I’m not even in that room wouldn’t it.
Very easy to achieve this with webcore but Sharptools, not so much. :(.
Not at this time. I know there are at least a couple of Feature Requests related to ‘change’ and ‘changes’ events; you might want to take a look and vote for (or create one) that works for you.
Coming here from webCoRE is definitely not a 1-to-1 transition. There are features and capabilities that aren’t available yet. The best advice I can give you is to be willing to rethink your logic flow. While perhaps not quite as clean as your webCoRE piston, the logic provided above is also only a tiny step more complex … and once you can follow it, your Rules will start to come together rather quickly.
I don’t think this would work quite the way John wants. If the sensors became active, inactive, and then active again, it’s possible that the first active event would run the rule and then flip the motion timer to false after the second active event flipped it to true. That’s where the ‘state stays’ features are helpful as the make sure things stayed a certain condition.
0 ... 550...600 ... 1150
1a. active (true, timer starts)
2a. active2 (true, second timer starts)
1b. first timer flips false
2b. second timer flips false
Excuse the crude diagram, but you can see that 2a. flips it to true and Johns expectation would be that it would stay true for the next 600 seconds. In this case though, 1b would flip it to false just 50 seconds later.
If the main goal is to determine if a light in a particular room has been active in the last ten minutes, couldn’t you invert the condition and only use the ‘state stays inactive’ for the 10 minute duration…
If it’s true, THEN do nothing since it never went active in the last 10 minutes. Otherwise if it’s false, that means there was some sort of activity in the last 10 minutes, so it will take you down the ELSE path where you can have your logic specific to that room.
The main goal is to have Alexa announce that someone has triggered the driveway motion sensor ( Arlo) from an Alexa device within that particular room.
So my example, the EnSuite. I use the motion sensor to let Alexa know I’m in the EnSuite as I don’t want Alexa announcing it if I’m not in there and the only way I’ve figured out the best way to do that is have the EnSuite motion sensor either be active or has changed for xxx amount of minutes.
Anything over 10 minutes of it not changing state assumes I’m not in there now so won’t announce it.
Does that make sense?
Yes. I believe what I suggested should cover that.
It checks to see if the motion sensor from a particular room has stayed inactive. If there was motion in the last ten minutes, that would be false and take you to the ELSE path where you would run your Alexa logic.
Rethinking this again and what if the EnSuite motion sensor is actually active though? Like if I’m in the EnSuite and I move and triggers the motion sensor to be active, does that mean it won’t do the announcement then?
In the example I provided, the trigger for the rule is the DRIVEWAY motion sensor becoming active. So anytime motion happens on the DRIVEWAY, it will run the flow which will check to see if your OFFICE motion sensor has been inactive for the last 10 minutes.
So if the DRIVEWAY detects motion and the office is active or has been active at any point in the past 10 minutes, it would hit the ELSE path and run the actions in it.
(Edit: In other words, it’s not triggered by your office – it’s triggered by the driveway and the status of the office motion sensor at that point and the 10 minutes prior is used as a condition)