jfh Posted August 9, 2020 Share Posted August 9, 2020 I want to be able to take an action if a contact has been open for more than 7 days. Is there any reasonable way to do this without using a 7 day timer? Quote Link to comment Share on other sites More sharing options...
C4 User Posted August 9, 2020 Share Posted August 9, 2020 I don’t know enough about the date math, but one way you could approach this would be to set up a variable for each contact you want to monitor. Then set a daily schedule to run a macro that adds 1 to the variable counts, checks the counts, and does whatever you want to do if count is over 7. Then set each variable to zero whenever the contact closes. Quote Link to comment Share on other sites More sharing options...
jfh Posted August 9, 2020 Author Share Posted August 9, 2020 That’s good enough for what I want. I was over thinking things. Thanks. Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted August 9, 2020 Share Posted August 9, 2020 3 hours ago, C4 User said: I don’t know enough about the date math, but one way you could approach this would be to set up a variable for each contact you want to monitor. Then set a daily schedule to run a macro that adds 1 to the variable counts, checks the counts, and does whatever you want to do if count is over 7. Then set each variable to zero whenever the contact closes. This is what I use for both daily count downs and count ups. If you want to display the current value of the variable, you can do so using a thermostat or a unbound test dimmer. You can also edit the variable (increase decrease) from a TS using the dimmer or extra experience buttons. Quote Link to comment Share on other sites More sharing options...
C4 User Posted August 9, 2020 Share Posted August 9, 2020 4 hours ago, South Africa C4 user said: This is what I use for both daily count downs and count ups. If you want to display the current value of the variable, you can do so using a thermostat or a unbound test dimmer. You can also edit the variable (increase decrease) from a TS using the dimmer or extra experience buttons. @South Africa C4 user Can you explain more about how to display variable value using unbound test dimmer? Thank you. Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted August 9, 2020 Share Posted August 9, 2020 2 hours ago, C4 User said: @South Africa C4 user Can you explain more about how to display variable value using unbound test dimmer? Thank you. There is a test dimmer and test light driver available in the on-line diver database (Free). It is intended for dealers to use as a demo in showrooms without a physical light bound to the driver but is very useful for other purposes (such as this, or linking in completely different types of lights such as pool lights via a pool proxy driver). You can create a room called variables or settings and put a few of these test dimmers (for numeric values between 0 and 100) and test lights (for Boolean variables) in it.1 Lets say you have a variable called KidsMaxVolume which you use to control the maximum volume in your children’s rooms, you can then program against the dimmer so that every time the lighting level changes, the variable KidsMaxVolume is changed to equal the new light level. If the variable can be changed in some other fashion (and probably also necessary for after a director reboot - I cant recall) then you also need to program against the when variable changes event for KidsMaxVolume such that it sets the light level to equal the variable value. I moved away from this method to using the free Yatun Temperature display driver for displaying variables. The latter takes more programming if one wants display and control but is not limited to the lighting screen only! Quote Link to comment Share on other sites More sharing options...
Neo1738 Posted August 11, 2020 Share Posted August 11, 2020 Honestly wouldn't it be easier to set a timer to reset if contact closed and start if opened and if it expires it does xyz action? Instead of a variable that has to check in daily etc. Quote Link to comment Share on other sites More sharing options...
jfh Posted August 11, 2020 Author Share Posted August 11, 2020 10 hours ago, Neo1738 said: Honestly wouldn't it be easier to set a timer to reset if contact closed and start if opened and if it expires it does xyz action? Instead of a variable that has to check in daily etc. Yes, but 7 days is a very long timer and I figured I’d lose it on a reboot. Quote Link to comment Share on other sites More sharing options...
Cyknight Posted August 11, 2020 Share Posted August 11, 2020 I would agree - this is something for a simple scheduled event, assuming you don't care about the EXACT amount of time (if you set for 7 days, it could potentially be 6 days and 1 second to exactly 7 days - or use 8 for 7 days and 1 second to 8 days- due to the exact time the contact opens). Basic: daily scheduled event at 1PM Variable, number called [whatever] WHEN scheduled event occurs IF contact is open, variable [whatever] +1 WHEN variable changes, IF variable is equal to or higher than 7 [whatver you'd want to do] plus add variable = 0 Hardly a lot of programming and much more reliable You could increase accuracy by scheduling a check twice or more a day, just make sure you multiply and adapt the number before triggering the even: twice a day that same programming, now you check for variable being 14 to get a 6 day 1 second to 6 day 12h range, for 15 to get 6 day 12 h 1 second to 7 days, for 16 to get 7 days 1 second to 7 days 12h etc) Running a 7 day timer is not something that I'd recommend due to reboot, but also, why would you have the system run a timer for that long, unless you REALLY need to know by the second? Even then I'd do it different, though it would likely require paid driver. jfh and South Africa C4 user 1 1 Quote Link to comment Share on other sites More sharing options...
jfh Posted August 11, 2020 Author Share Posted August 11, 2020 Agree @Cyknight and approximate times are fine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.