Announcement

Collapse
No announcement yet.

Jon00 DaysTill for Homeseer 3 & Homeseer 4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Jon00 DaysTill for Homeseer 3 & Homeseer 4

    This package allows you to determine the remaining number of days for a specific date, yearly or set number of days. This may be useful for recurring events such as bin days, birthdays or anniversaries. Each event has its own virtual device generated which shows the number of days remaining. This can be used to trigger Homeseer events as necessary. Also included is a number of major pre-programmed public holidays for UK, USA & Canada together with their Daylight Savings Time Start/Finish dates.

    Recurring/Rollover periods with X number of days from a date is also supported.

    A second set of virtual devices is also created which show the number of days since the event date calculated. This may be useful to trigger events after a configured date. This becomes more difficult with the remaining number of days if we consider leap years.

    For example, if we wanted to trigger on the next day (Friday) after Thanksgiving, using a DaysTill device, it would show either 364 or 365 days (depending on a leap year). With the DaysSince device, we can always trigger on 1 since this is 1 day after Thanksgiving.

    Just run once a day just after midnight to update the virtual devices. You can then trigger any events when you want during the day.

    Setup is via a web configuration page.

    Related: Jon00 Quick Reminders

    Click image for larger version  Name:	Capture.PNG Views:	0 Size:	39.2 KB ID:	1521481

    Click image for larger version  Name:	Capture1.PNG Views:	0 Size:	30.7 KB ID:	1521480
    Click image for larger version

Name:	Capture3.png
Views:	22
Size:	128.4 KB
ID:	1660155

    Click image for larger version  Name:	Capture.png Views:	0 Size:	75.3 KB ID:	1659995
    As always, you can download from my website (click on my banner below).

    Please post any comments, suggestion here!

    (No Banner seen?- check your Forum Settings - User Settings, Account, Tick 'Show Signature')
    Jon


    #2
    Absolutely brilliant! Works straight out the box.

    Thanks Jon, Top of the class
    sigpic
    A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

    Comment


      #3
      Thanks . Nice idea!

      Attached Files

      Comment


        #4
        Originally posted by MattL0 View Post
        Thanks . Nice idea!
        Actually, It's a complete re-write and expansion of a script originally written for HS2: https://forums.homeseer.com/forum/de...ipt#post721771

        Just helping Gog's out (as he is getting old these days and needs reminders )
        Jon

        Comment


          #5
          Originally posted by jon00 View Post

          Actually, It's a complete re-write and expansion of a script originally written for HS2: https://forums.homeseer.com/forum/de...ipt#post721771

          Just helping Gog's out (as he is getting old these days and needs reminders )
          You are spot on about the old and definitely need reminders. Managed to get HS to announce the reminders for 10 days prior to the day. thanks.

          sigpic
          A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

          Comment


            #6
            jon00 This is really slick.

            I need your Birthday so I can add it to my Days Till List I send you your another Donation. My Annual "Thanks" for all you the great projects you have shared with the community.

            Maybe you can add it to your current dates included with this plugin and make sure it is enabled.

            Call it $ Jon00 needs some Love Day $ or $ Jon00 needs another Pint Day $ ?? Cheers.

            Comment


              #7
              Originally posted by mbdirtfarmer View Post
              jon00 This is really slick.

              I need your Birthday so I can add it to my Days Till List I send you your another Donation. My Annual "Thanks" for all you the great projects you have shared with the community.

              Maybe you can add it to your current dates included with this plugin and make sure it is enabled.

              Call it $ Jon00 needs some Love Day $ or $ Jon00 needs another Pint Day $ ?? Cheers.
              Lol Click image for larger version

Name:	icon14.png
Views:	404
Size:	664 Bytes
ID:	1455700
              Jon

              Comment


                #8
                UPDATE: PLEASE SEE POST #14 For the latest version and updates to this.
                You can disregard this post, but I'll leave it intact for historical purposes.

                Hi jon00 (et al)!

                I would like to say how great this script is, and show you how I made it so that I get daily email reminders for my DaysTill devices that are upcoming in the next 28 days.

                First off, I want to thank jon00 for making such a useful script for date tracking.
                What I wanted to do, and after much effort on my part (cause I ‘ain’t no programmer”) was to get notifications of upcoming dates sent to me via email. I also tried to get it to work with PushOver but couldn’t. Now Jon00 provides his script for free (I recommend making a donation when you find it useful), and this process for notification requires using the paid plugin EasyTrigger by SPUD.
                EasyTrigger offers many useful features, and I recommend it for its many useful features.

                I originally tried making individual events for each date range I wanted to be notified. 4 weeks away, 3 weeks, 2 weeks, 1 week, next day, and today. Problem was getting the data and separating it for each call in the routine and sending the email using the global variables provided by Easytrigger.
                Long story short, with much experimentation I honestly stumbled onto a working solution.
                But in order to do this, install the DaysTill script following the instruction provided with the script.
                install the EasyTrigger plug-in (if you don’t already have it) and you can use the trial version before you buy it if you don’t want to purchase it outright.

                In the DaysTill setup, you will already have a couple dates installed as devices by default, go in and turn on some more, and add a few dates in of your own. Pretty straightforward.
                This process works, it’s not necessarily perfect, and can probably be improved or streamlined.


                Click image for larger version  Name:	daystill1.png Views:	158 Size:	85.8 KB ID:	1466602
                Click image for larger version  Name:	daystill2.png Views:	73 Size:	24.3 KB ID:	1466603

                Now for the EasyTrigger functions to work that you need, you’ll have to setup a “device group” and include all the DaysTill devices you want checked. And each time you add a new a new date to DaysTill, you’ll have to update the group on EasyTrigger.

                I just called the group “Dates”
                Click image for larger version  Name:	daystill3.png Views:	72 Size:	22.7 KB ID:	1466604Click image for larger version  Name:	daystill4.png Views:	72 Size:	201.7 KB ID:	1466605

                Now here’s the fun part. The “main event”! (excuse the pun)
                The DaysTill script requires an event to run each night after midnight that will decrease the count for each device’s value.

                Click image for larger version  Name:	daystill5.png Views:	71 Size:	26.2 KB ID:	1466606


                What we will do is piggyback off that event to run our event that will send the emails.

                Click image for larger version  Name:	daystill6.png Views:	72 Size:	43.9 KB ID:	1466607

                What these do is enable and then disable the new event that actually gets the data from the DaysTill update and emails it out.
                The Enable and Disable event function are also part of the EasyTrigger Plugin.
                The reason for using these is to control exactly when the EasyTrigger group triggers run and also because I found out if you leave the event enabled it runs each time you add a new date. Also, it doesn’t seem to work if it’s not run immediately following the DaysTill update script being run.
                That is one of the “not perfect” things that could be improved. Also, the 1 minute delay between enabling and disabling the script is arbitrary…. It works, but it could maybe be shortened but I didn’t feel like testing it further since it works.

                Now for the event to run to get emails, it’s surprising simple….but again, it works.

                Click image for larger version  Name:	daystill7.png Views:	72 Size:	38.8 KB ID:	1466608

                I called it “4 weeks” because I set it to report to me anything under 29 days from now. This is really the only parameter to set to change how far in advance you want notifications. Set it for one day higher.
                Want two weeks advance notice, set it to 14, and so on.
                Now as for how it works, I honestly don’t know. Lol
                But the results are good enough to give me what I need. A daily reminder of all the events (Daystill Devices) that are coming up in the next 28 days.
                The emails look like this:
                (From my yahoo inbox)

                Click image for larger version  Name:	daystill8.png Views:	72 Size:	43.0 KB ID:	1466609
                Now this includes 4 actual dates and 4 test ones I put in just to flesh out the system during testing. I don't know what the maximum workable number of events are, so if anyone finds out a number that fails to generate all the emails, let me know.

                Two other things to consider.
                1. You can create more than one group of devices in EasyTrigger (one for holidays and one for birthdays, maybe one for work and one for personal) and create separate reminder events to run with different days parameter. Say 28 days for birthdays and 14 days for holidays.
                2. If you do create more than one reminder event, they need to run sequentially in the original event and would look something like this:
                Click image for larger version  Name:	daystill9.png Views:	72 Size:	42.4 KB ID:	1466610

                So that's it, I hope someone else can benefit from this.

                The usefulness of emailing this data can be applied (I believe) to pulling any of the data tied to devices in an EasyTrigger defined group. This is my first attempt at (hopefully) providing something useful to the HomeSeer community.

                If you are able to improve or streamline any of this, by all means let me know. Thanks!

                Comment


                  #9
                  UPDATE: PLEASE SEE POST #14 For the latest version and updates to this.
                  You can disregard this post, but I'll leave it intact for historical purposes.


                  I have my first real update! After some voluminous reading, and some further experimentation.... I have some more to offer for customizing the results.

                  If you follow the original outline, you'll get a series of emails (one per device) that all are less than x days away. My example was 29 giving me daily reminders of everything coming up in the next 28 days.

                  My original desire was to have a series of separate reminders, one for 4 weeks away, then 3, 2, with the week, tomorrow, and finally today.
                  I could not get that to happen using the triggers for the ranges, or time based from the run of the nightly update for DaysTill, and found the method outlined above that worked to at least give me reminders in bulk every day. Not ideal obviously, but it worked. (and I said it wasn't perfect)

                  Anyway, going back through the EasyTrigger documentation and doing some more experimenting, I am now able to get the 6 separate event criteria to give me the specific reminders I want.
                  One for events 28 days away, then 21, 14, 7-2, 1, and 0 days away. you could very easily change the 7-2 days to simply a 7 if you wanted.

                  Here's what I have now:
                  Click image for larger version  Name:	daystillupdate1.png Views:	80 Size:	105.3 KB ID:	1466661

                  The new events are then setup as shown below:
                  Click image for larger version  Name:	daystillupdate3.PNG Views:	62 Size:	65.3 KB ID:	1466664
                  Click image for larger version  Name:	daystillupdate4.PNG Views:	63 Size:	64.8 KB ID:	1466665


                  the contents of the email are all pretty much the same,
                  Click image for larger version  Name:	daystillupdate5.PNG Views:	62 Size:	5.5 KB ID:	1466666
                  But for the tomorrow and today emails I replaced the variable for the value with "tomorrow" and "today".

                  The results? Well, now it is a bit more refined with specific headers instead of one generic one.
                  As you can see below from my email from the test I did at 0132.

                  Click image for larger version  Name:	daystillupdate6.PNG Views:	63 Size:	17.8 KB ID:	1466667
                  Granted you still get a different email for every matching device... if you had 2 on 28 days away and 3 on 21 days away (birthdays for example) you'd get 5 emails, not 2.

                  when compared to what I got yesterday. ( i had removed the "test birthdays" before retesting tonight, so that's why you don't see the one for 3 days from now)

                  Click image for larger version  Name:	daystillupdate7.PNG Views:	63 Size:	129.7 KB ID:	1466668


                  And there you have it! I have now succeeded on my original want of having weekly reminders for a specific day count, and on the way discovered a method for bulk reminders of everything coming up in the next x days.

                  Both methods work, but standard disclaimer, I have not tested to the number of valid criteria matches before the emails fail. There might not even be one.

                  Anyway, I again hope that this comes of some usefulness for someone else, and if you make any improvements please let me know. Thanks.
                  Attached Files

                  Comment


                    #10
                    Fantastic writeup Roger. I'm sure others will appreciate your method to send reminders via email.
                    Jon

                    Comment


                      #11
                      Originally posted by jon00 View Post
                      Fantastic writeup Roger. I'm sure others will appreciate your method to send reminders via email.
                      Hi Jon,
                      it's been a few weeks now, and I thought I'd give a little "after action report" of how it's been acting.... it's been perfect actually. 😀👍
                      Here is a screen shot of my email filtered for the DaysTill reminders. and as you can see from this morning; I got both a reminder for a birthday this week, and Mother's day in 3 weeks.

                      Click image for larger version

Name:	daystill10.PNG
Views:	358
Size:	39.1 KB
ID:	1469643

                      Comment


                        #12
                        👍 I hope others will follow your writeup example!
                        Jon

                        Comment


                          #13
                          Originally posted by jon00 View Post
                          👍 I hope others will follow your writeup example!
                          HI Jon! With some downtime today, and thanks to some updated features that were added to EasyTrigger recently, I have cleaned up the events and made some improvements.
                          As EasyTrigger now allows you to expand upon the Global Variable it creates by adding a suffix, it now makes it much easier to set for reporting different dates.
                          I'm in the process of final testing, and after tonight's run will post all the changes with a new walk-thru instructions.

                          Comment


                            #14
                            ok, as promised, here's the update with the new features added to EasyTrigger.
                            Of course before I start I want to give a huge thanks to both jon00 for his awesome DaysTill script, and to spud for his awesome EasyTrigger script...

                            Please disregard the earlier post instructions, and when I'm done here I'll edit it to point to this post.

                            SO... after following the instructions to install Easytrigger (which has so many useful functions) if you don't already have it, and then following the instructions for the DaysTill script and setting up some dates/days for yourself.... here's how I setup events to send me email reminders when dates are 4 weeks, 3 weeks, & 2 weeks away.... then also each day they are less than a week away, then tomorrow, and finally today. Now I have these run right after midnight right after Jon00's maintenance update event

                            With the new features added to EasyTrigger (at least in the Beta as I write this) you could have all the events in one email if you like. But since you would get blanks or nonsense info in the results on days where there is nothing for a particular range, I decided to only have emails sent if a date range matches. Yes, that does mean I could get 6 or more emails a night if all the conditions were met for all the date ranges....but what's the harm in that?

                            On to the good stuff. It may seem like a lot, but once setup and configured, the only changes that need to be made are making sure you add any new DaysTill event dates to the EasyTrigger Group. Use it all, or bits and pieces... if you make it work better, let me know.

                            Below are all the events I have for doing the DaysTill reminders.
                            You can disregard the first listed one, that is actually the previous version and has been deactivated.

                            Click image for larger version

Name:	daystill1 new.PNG
Views:	529
Size:	13.4 KB
ID:	1477935

                            I run mine at basically 30 seconds after midnight.
                            I have most of my events set to not log, so I have created my own log entry scripts to keep track of things that run.
                            Keeps the log cleaner.
                            The first thing is to enable the events that check for matches with the DaysTill nightly maintenance run that updates the dates' counts.
                            The reason I have them all disabled, is I don't want them running when I add a new event or do any maintenance/testing.
                            This of course is purely optional and you could just skip this part and leave all the events active... but I think it's a nice feature.
                            After enabling the check events, I run the Jon00DaysTill.vben as required to update the dates' counts.
                            then I wait ten seconds and disable all the check events again.
                            You'll note the events are all grouped in their own master event to keep everything organized and clean.
                            The contents of those events will be shown next.
                            Then I run another write to log to show it's done, and it bookends the events that do run very nicely.
                            Click image for larger version

Name:	daystill2 new.PNG
Views:	309
Size:	20.8 KB
ID:	1477936

                            The "Enable Events" event... real simple, just activates them all right before running Jon00's nightly maintenance.
                            I'll also show you what the contents of those are shortly as well.
                            Click image for larger version

Name:	daystill3 new.PNG
Views:	309
Size:	17.7 KB
ID:	1477937

                            The "disable Events" event.... again, pretty simple and straightforward.
                            Click image for larger version

Name:	daystill4 new.PNG
Views:	312
Size:	18.2 KB
ID:	1477938

                            Now for the meat of a "check Event". we look for a matching in the EasyTrigger group (I called it Dates) and then send an email.
                            Click image for larger version

Name:	daystill5 new.PNG
Views:	308
Size:	9.4 KB
ID:	1477943

                            The new part in all this, is the fact that Spud has added optional suffixes to his global variables. it makes the identification of the match so much easier and allows your scripts to run without overwriting each other before the email is sent cause the matches are no longer just one set of global variables... they are as many as you need.

                            Is this example for 28 days (and the process also apples to 21 and 14 days as well) we are looking for a DaysTill device in the EasyTrigger "Dates" group's newvalue becomes 28, it is assigned to the global variable etdevicevalue with a suffix of _28 (or _21 or _14 as needed)
                            Click image for larger version

Name:	daystill6 new.PNG
Views:	309
Size:	11.7 KB
ID:	1477945

                            For the week leading up to the date, I have it check for the newvalue is equal to or less than 7 but greater than or equal to 2.
                            And I have a suffice of _days
                            Click image for larger version

Name:	daystill7 new.PNG
Views:	308
Size:	10.4 KB
ID:	1477948
                            Here's the actual math for that.
                            Click image for larger version

Name:	daystill8 new.PNG
Views:	317
Size:	14.2 KB
ID:	1477942

                            For Tomorrow, and Today, it's just like the 2,3, & 4 weeks and just matching the newvalue to 1 or 0.
                            Suffiexes are _tomorrow and _today.
                            Click image for larger version

Name:	daystill9 new.PNG
Views:	308
Size:	8.9 KB
ID:	1477941
                            Click image for larger version

Name:	daystill10 new.PNG
Views:	315
Size:	8.9 KB
ID:	1477940
                            that's the events portion of it.

                            Within the EasyTrigger config, you hae to create a group to put all the Daystill devices in, AS i mentioned I used "Dates"
                            Click image for larger version

Name:	daystill11 new.PNG
Views:	307
Size:	8.0 KB
ID:	1477944
                            Which looks like this :
                            Click image for larger version

Name:	daystill12 new.PNG
Views:	307
Size:	189.7 KB
ID:	1477947

                            And here's what my email as looked like the last few days
                            Click image for larger version

Name:	daystill13 new.PNG
Views:	311
Size:	8.5 KB
ID:	1477946

                            I hope someone finds this of some use, and if you can improve upon it...please share.

                            Thanks

                            RogerL
                            Attached Files

                            Comment


                              #15
                              V1.0.1 is now available.

                              Changes since V1.0.1

                              Recurring/Rollover periods with X number of days is now supported.

                              If updating from V1.0.0, just replace the script.
                              Jon

                              Comment

                              Working...
                              X