[ANSWERED]: Schedule triggering issues

Posted on
Sat May 02, 2015 4:11 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

[ANSWERED]: Schedule triggering issues

Hey all!

I am sure there is a simple solution to my problem.

Currently I have a schedule that every minute checks the lux on a sensor (it's in a cupboard).
If the door is closed the lux is 0; so I trigger an action based on it being greater than zero. Works fine!
The problem is that by pure bad timing you could open the cupboard and then close it almost immediately causing the trigger to occur.

What I really want is a schedule to check the sensor. If the door is open for say 60 seconds to then trigger an action. If the door is closed (because lux is zero) to effectively reset.

Is there an elegant way to do this?

thanks

Posted on
Sat May 02, 2015 4:39 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: Schedule triggering issues

Right!

I came up with a better solution but it doesn't work :roll:

Instead I set a trigger if the lux > 0 then do my script; also as an action to disable the trigger.
I've selected re-enable the trigger after 1 minute.

I leave the cupboard open; the lux > 0 ; my script is executed once; but no more. Surely it should trigger every minute as intended?

Is the issue that the lux hasn't changed?i.e. it's the same value as before so only gets reported once???

Posted on
Sat May 02, 2015 10:30 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Schedule triggering issues

If you have the trigger set for device state changed when value is > 0, then it will only occur the first time the value transitions from 0 to greater than 0. After that it would require a reset (back down to 0) before it will execute. Instead, try changing the device state changed trigger to occur on any change, then add a conditional that checks that the lux value is > 0. That will execute every time there is any change, then the conditional will eliminate the case you don't want it to execute (when lux is 0).

Image

Posted on
Mon May 04, 2015 3:40 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: [ANSWERED]: Schedule triggering issues

Hey!

Works perfectly thanks!

Posted on
Mon May 04, 2015 8:56 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: [ANSWERED]: Schedule triggering issues

Actually one issue

I only want the trigger to occur when the door has been opened for 30 seconds or more. Then if closed within the time cancel the trigger.
At the moment it all works fine. But the action is done straight away. After the action I can cause a delay by disabling the trigger and then re enabling it 30seconds later.
But the initial delay is a problem

Posted on
Tue May 05, 2015 4:29 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]: Schedule triggering issues

There is a checkbox option on the action panel for delaying when an action executes. Does that help?

Image

Posted on
Wed May 06, 2015 2:27 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: [ANSWERED]: Schedule triggering issues

Hey!

I don't think so.
Perhaps this is easier in a script?; but I'm not sure how to do that.
Basically I need to 'cancel' my trigger potentially.

So pseudo code:
Code: Select all
if (lux>0) then
         wait 30 seconds()
         check_lux()

       if (lux>0) then
         run_script()
      endif
endif

Posted on
Sun May 10, 2015 1:36 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]: Schedule triggering issues

Here is a script-less approach you might want to try:

1) Create an Indigo variable called, cabinetOpenCounter, and set it to 0.
2) Create a repeating Schedule that executes every 15 seconds, which has a conditional that checks the lux value is > 0 with an action to increment Indigo variable value cabinetOpenCounter by 1.
3) Create a Trigger that executes whenever lux becomes 0, with an action to set cabinetOpenCounter to 0.
4) Create a final Trigger on Variable Value Change of cabinetOpenCounter > 1 (or some other higher value) that executes your final action/script that the cabinet door was left open.

An added bonus of this technique is the cabinetOpenCounter variable will give you an idea how long the cabinet was left open (ex: value of 40 would be about 10 minutes).

Image

Posted on
Fri May 15, 2015 5:11 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: [ANSWERED]: Schedule triggering issues

Hey Matt!

I haven't tried your suggestion but it sounds good!
I assume though it would be less clumsy in a script?

My scripting skills are still somewhat newbie! :lol:

Could you please point me in the right script direction.

The thing that confuses me is how I 'stall' in the script i.e. wait 30 seconds; and then abort.

Also - lets suppose the cupboard door is opened and closed multiple times. Does that means there are multiple instances of the script running?; or can there always 'only be one' i.e. would I script then need to check within itself if it had already been executed!

Appreciate your fantastic support as usual!

Cheers

Posted on
Mon May 18, 2015 4:13 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: [ANSWERED]: Schedule triggering issues

Hey Matt!

Actually tried your method; doesn't always work.
Sometimes the event I wish to happen is called even though the door has not been open for 30 seconds or more.

It's difficult too work out what the issue is as it's not repeatable. I guess some issue with schedule/trigger timing clash???? :roll:

Cheers

Posted on
Mon May 18, 2015 2:22 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]: Schedule triggering issues

I'm not sure – you'd have to capture the contents of the Event Log when it fails then we can see if we can troubleshoot it.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests