Recent discussion on how to ID what day of the week it is in a rule prompted me to want a rule too... (in my case it was garbage cans).
Having already done some date/time work with my Meteorological Seasons driver, I wrote this driver this AM to allow me to parse values so I can easily control rules. Initially I was putting the variables list from PHP but then I learned that Java comes up... um. short. At least in pre-defined ways. Update - Fixed 0.2.2 I haven't determined the Pattern for the Leap year and DST booleans as well as non leading zero's on a few attributes. However this does cover a pretty wide swath.
I'm going to be moving my house over the next 10 days so responsiveness may be erratic from me. Update - Fixed 0.2.2 I intend to finish some basic icons, have HTML tiles (I use the fine Hubitat Android Dashboard) and I intend to make the schedule updates variable. Currently it is set for every 5 minutes. When those tasks are complete I'll add it to HPM ( Update - Fixed 0.2.2 * now in HPM). Thanks to @sburke781 for the basis I stole this from.
Besides the power this app is showing to me (well. I wrote it so.. yea.) I've just added an Even and Odd Week variable. so Folks scheduling garbage can pick ups... Tada! Point your rule and enjoy.
(in latest version, 0.2.3 on HPM)
** yet another update ** so come to learn that boolean values for custom attributes aren't supported in Rules. This is known since...well .. 2020 at least.. regardless - I've converted all booleans to strings and adjusted their names to be a bit more humanistic. Much MUCH thanks to @sburke781 who just is huge as a persona around here!
0.2.4 changed all boolean variables to text strings so comparators work.
0.2.5 Added Even/Odd text string variables for DayOfTheWeekNum.
0.2.6 Added Even/Odd text string variables for DayOfTheYearNum.
0.2.7 Fixed 24HrNoLead showing lead zero. Fixed debug switch check on update text line to log file
Do HPM Repair to get an immediate update to newest version of the driver.
I guess it would help some if I overview the steps -
Follow the link below to Github page. Copy the content.
On your hub, select Drivers Code (under developers).
Click New Driver in the top right.
Go to Devices and Add Device (again top right corner).
Select Virtual (under manually)
for Type* start typing Date and Select Date & Time Parser (under User heading)
ASsign device a Name and optionally a Label.
Select Refresh on the Device page and viola.
You can now use 'custom attributes' in rules to pick which variable value you wish to equate etc.
Here is an Image of all Variables now available for use in Rules: