I am trying to setup a rule that will display text and announce a message when the system is disarmed on the last thursday of each month. However, I'm trying to make it as efficient as possible, but thanks to February, and a few months with less than 31 days, it doesn't look as easy. I was referencing this to see if I could create a pattern: http://www.elkproducts.com/support/M1_Appl...ews092605_2.htm but these really only target the two months in which DST changes. In this example, on http://www.elkproducts.com/support/M1_Appl...1news030205.htm - I can see that there is a line with "AND THE MONTH IS A MULTIPLE OF 6" - how do we do these?
The following is my attempt at figuring out the logic to determine when the last thursday of each month is. I have written some possible rule sets for each condition (based on when the 1st of each month is).
For the counter based rules, there would then be a rule that subtracts 1 from COUNTER X at midnight, every night. Then, when the counter hits "1" that should be the last thursday of the month, and I can have the rule fire off of that condition.
For the non-counter based rules, I wouldn't need to worry about a counter... Just fire off the rule on that day when the system is disarmed... To save rule space, I would probably tell it to turn on an Output for 30 seconds or whatever. Then, when that output is turned off, it would fire off the announcement rule.
Anyway, for those two month conditions, if anyone knows of an easy way to incorporate the multiple possibilities in as little number of rules as possible, that would be great.
Thanks!
The following is my attempt at figuring out the logic to determine when the last thursday of each month is. I have written some possible rule sets for each condition (based on when the 1st of each month is).
Code:
SMTWTFS
1234567
8901234
5678901
2345678
901
Last Thursday for ALL months is 26th
Possible Rule:
WHENEVER THE HOUR IS 5:XX AM
AND THE DAY(S) OF THE WEEK IS/ARE S------
AND THE DAY OF THE MONTH IS 1
THEN SET COUNTER X TO 26
OR, ANOTHER POSSIBLE.. Since if Thursday is the 26th, it's the last Thursday...
WHENEVER AREA 1 ARM STATE BECOMES DISARMED
AND THE DAY(S) OF THE WEEK IS/ARE ----T--
AND THE DAY OF THE MONTH IS 26
THEN....
--------------------------------------------
SMTWTFS
-123456
7890123
4567890
1234567
8901
Last Thursday for all months is 25th
Possible Rule:
WHENEVER THE HOUR IS 5:XX AM
AND THE DAY(S) OF THE WEEK IS/ARE -M-----
AND THE DAY OF THE MONTH IS 1
THEN SET COUNTER X TO 25
OR, ANOTHER POSSIBLE.. Since if Thursday is the 25th, it's the last Thursday...
WHENEVER AREA 1 ARM STATE BECOMES DISARMED
AND THE DAY(S) OF THE WEEK IS/ARE ----T--
AND THE DAY OF THE MONTH IS 25
THEN....
--------------------------------------------
SMTWTFS
--12345
6789012
3456789
0123456
78901
Last Thursday for months with less than 31 days is 24th, otherwise it's 31st
--------------------------------------------
SMTWTFS
---1234
5678901
2345678
9012345
678901
Last Thursday for all months except February is 30th. For February it's 23rd
Possible Rule:
WHENEVER THE HOUR IS 5:XX AM
AND THE DAY(S) OF THE WEEK IS/ARE ---W---
AND THE DAY OF THE MONTH IS 1
AND THE MONTH IS NOT FEBRUARY
THEN SET COUNTER X TO 30
AND
WHENEVER THE HOUR IS 5:XX AM
AND THE DAY(S) OF THE WEEK IS/ARE ---W---
AND THE DAY OF THE MONTH IS 1
AND THE MONTH IS FEBRUARY
THEN SET COUNTER X TO 23
OR, ANOTHER POSSIBLE SET:
WHENEVER AREA 1 ARM STATE BECOMES DISARMED
AND THE DAY(S) OF THE WEEK IS/ARE ----T--
AND THE MONTH IS NOT FEBRUARY
AND THE DAY OF THE MONTH IS 30
THEN....
AND
WHENEVER AREA 1 ARM STATE BECOMES DISARMED
AND THE DAY(S) OF THE WEEK IS/ARE ----T--
AND THE MONTH IS FEBRUARY
AND THE DAY OF THE MONTH IS 23
THEN....
--------------------------------------------
SMTWTFS
----123
4567890
1234567
8901234
5678901
Last Thursday for all months (and February in leap year) is 29th. For February in non-leap it's 22nd.
--------------------------------------------
SMTWTFS
-----12
3456789
0123456
7890123
4567890
1
Last Thursday for all months is 28th.
Possible Rule:
WHENEVER THE HOUR IS 5:XX AM
AND THE DAY(S) OF THE WEEK IS/ARE -----F-
AND THE DAY OF THE MONTH IS 1
THEN SET COUNTER X TO 28
OR, ANOTHER POSSIBLE.. Since if Thursday is the 28th, it's the last Thursday...
WHENEVER AREA 1 ARM STATE BECOMES DISARMED
AND THE DAY(S) OF THE WEEK IS/ARE ----T--
AND THE DAY OF THE MONTH IS 28
THEN....
--------------------------------------------
SMTWTFS
------1
2345678
9012345
6789012
3456789
01
Last Thursday for all months is 27th.
Possible Rule:
WHENEVER THE HOUR IS 5:XX AM
AND THE DAY(S) OF THE WEEK IS/ARE ------S
AND THE DAY OF THE MONTH IS 1
THEN SET COUNTER X TO 27
OR, ANOTHER POSSIBLE.. Since if Thursday is the 27th, it's the last Thursday...
WHENEVER AREA 1 ARM STATE BECOMES DISARMED
AND THE DAY(S) OF THE WEEK IS/ARE ----T--
AND THE DAY OF THE MONTH IS 27
THEN....
For the counter based rules, there would then be a rule that subtracts 1 from COUNTER X at midnight, every night. Then, when the counter hits "1" that should be the last thursday of the month, and I can have the rule fire off of that condition.
For the non-counter based rules, I wouldn't need to worry about a counter... Just fire off the rule on that day when the system is disarmed... To save rule space, I would probably tell it to turn on an Output for 30 seconds or whatever. Then, when that output is turned off, it would fire off the announcement rule.
Anyway, for those two month conditions, if anyone knows of an easy way to incorporate the multiple possibilities in as little number of rules as possible, that would be great.
Thanks!