www.homeseer.com    
 

Go Back   HomeSeer Message Board > HomeSeer Products & Services > HomeSeer General Discussion Area

HomeSeer General Discussion Area General discussion about HomeSeer that does not fall into any other category or are not specific to 1.x or 2.x versions of HomeSeer.

Reply
 
Thread Tools Display Modes
  #21  
Old December 17th, 2017, 04:51 PM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
You have to put the day before the text file i.e. if tomorrow is not a school day, the date entered would be today 12/17/2017.

The script can be modified to use the actual day if you want.

Change the line:

If DateTime.Now.ToString.Contains(Data) Then

To

If DateTime.Now.AddDays(1).ToString.Contains(Data) Then
__________________
Jon

Reply With Quote
  #22  
Old December 17th, 2017, 04:54 PM
swanie2000 swanie2000 is offline
Seer Deluxe
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 291
Quote:
Originally Posted by Rupp View Post
You could do it the old fashion way and trust them until they break the trust and they will. Then when the trust is broken take away the privilege for, oh say, a month and I'll bet they'd maintain the trust when they get their phones and wifi back. My 27 year old daughter told me a few weeks ago that one of the best things we ever did for her was take her phone, tv, and door (yep bed room door) away for a month when she was 17.
Well, believe me we have tried the "trust" route, and that just makes us look weak to my 16yo. The only thing that seems to work is removing the internet/TV setup, and allowance. Also he has a hard time getting up and to school on time, which is his only JOB.

This whole project started as a way to have homeseer automatically dock a few hours of internet/TV whenever he fails to get up on time, fails to get to school on time, etc. I also want homeseer to calculate his allowance, and dock it for any day he skips school, etc.

It sucks it has come to this, but he knows his mom and I can't keep track of everything, and watch him like a hawk. It is pretty easy to trick/fool parents who are playing the "trust" game.

However, homeseer has nothing better to do then to watch his bedroom lights, bathroom lights, house doors open/close when he leaves for school, and can react to his laziness as an impartial judge. My house is smarter than he is, and I am trying to prove a point. He will not be able to trick homeseer, and homeseer will not feel sorry for him and give him a break, either!

BUT, in order to get all this to work, hinges on the basics. I need homeseer to be able to accurately decide if it is a school day or school night. Once that code works, the rest of it will be easy.
Reply With Quote
  #23  
Old December 17th, 2017, 05:12 PM
swanie2000 swanie2000 is offline
Seer Deluxe
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 291
Quote:
Originally Posted by jon00 View Post
You have to put the day before the text file i.e. if tomorrow is not a school day, the date entered would be today 12/17/2017.

The script can be modified to use the actual day if you want.

Change the line:

If DateTime.Now.ToString.Contains(Data) Then

To

If DateTime.Now.AddDays(1).ToString.Contains(Data) Then

Hi Jon00,
Yes, I need the text file with the dates to be the actual days off. It is much easier to create this list of actual days off with the school calendar.

When tomorrow is a holiday,
I need the script to be able to look at this list of dates TODAY, and set the virtual device to "School Night(true/false)" to false or 0.

It's hard to explain in writing, but I need homeseer to look into the future (1)one day, decide if tomorrow will be a holiday or not, and then set my virtual device today, so homeseer can use it today.

Will the code change you mentioned above, do this?
Reply With Quote
  #24  
Old December 17th, 2017, 05:30 PM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
Yes!
Reply With Quote
  #25  
Old December 17th, 2017, 05:43 PM
swanie2000 swanie2000 is offline
Seer Deluxe
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 291
Your Brilliant!

I added the code change you mentioned, and it now Works perfect!
Now to do some more testing!!

Hopefully last question.
Will the script be able to function correctly if months are split?
For example: across the last day of the month/year, and the first day of the next month/year?

Lets say 5/1/2017 is a special date listed in the text file.
Will it be able to subtract (1)day and arrive at 4/30/2017 correctly?
Reply With Quote
  #26  
Old December 17th, 2017, 05:51 PM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
Yes!
Reply With Quote
  #27  
Old December 17th, 2017, 06:20 PM
outbackrob's Avatar
outbackrob outbackrob is offline
Seer Master
 
Join Date: Jun 2003
Location: El Lago, TX
Posts: 1,273
Quote:
Originally Posted by prsmith777 View Post
You can easily add all M-F and then go back and deselect the holidays etc.
Exactly. That's what we did. Made it pretty quick and easy to populate the calendar.
__________________
.
Reply With Quote
  #28  
Old December 17th, 2017, 08:59 PM
Rvtravlr's Avatar
Rvtravlr Rvtravlr is offline
Seer Deluxe
 
Join Date: Aug 2013
Location: Reno, Nevada
Posts: 480
Is there a way to embed certain holidays in the script dynamically so that the text file only contains exception dates?
__________________
Michael

HS3 Pro 3.0.0.435 | 819 devices | 373 events | OpenSprinkler | BLShutdown | EasyTrigger | NetCAM | Harmony Hub | Sonos | SDJ-Health | BLUPS | PHLocation | BLBackup | BLLock | Z-Wave | weatherXML | Pushover 3P | Blue-Iris |
Reply With Quote
  #29  
Old December 18th, 2017, 08:42 AM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
I'm not sure what you mean by dynamically? The text file is used for exception dates only. Without any entries in the file, running the script on a Sun-Thur would mark the virtual device as a school day (tomorrow).
Reply With Quote
  #30  
Old December 18th, 2017, 11:19 AM
lveatch lveatch is offline
Seer Deluxe
 
Join Date: Dec 2012
Location: USA - Illinois
Posts: 179
Quote:
Originally Posted by langenet View Post
So I think there's a limitation to the number of e-mails that the account has in order to have this work without error. My account I defined above is actually an Imap account and with 1982 messages it appears that HS3 has issue digesting the return list or something. When I tested with another account which only had one message in it, it works fine.
I can send a calendar message to it and despite checking each minute, it is processed cleanly. Can anyone else confirm this? I could create a rule such that if I get the reminder e-mail, I could forward it to the other account, but this gets a bit messy which in my opinion shouldn't be required.

Robert
I pointed HS to another gmail account of mine; had nearly 5000 emails in the inbox.

HS only looked at the 251 emails, but it is does appear to be looking for new emails; which is what I want it to do on HS start up.

Code:
[email]->Start checking server for email using POP
[email]->Initializing email, found 251 messages

Code:
The enveloped-data message does not contain the specified recipient.
Makes me wonder if there is an email where there are a few emais in the inbox where the email headers doesn't match your sign-in info.
__________________
Len


HomeSeer Version: HS3 Pro Edition 3.0.0.435
Linux version: Linux homeseer Ubuntu 16.04 x86_64
Number of Devices: 633
Number of Events: 773

Enabled Plug-Ins
2.0.54.0: BLBackup
2.0.40.0: BLLAN
3.0.0.48: EasyTrigger
30.0.0.36: RFXCOM
3.0.6.2: SDJ-Health
3.0.0.87: weatherXML
3.0.1.190: Z-Wave
Reply With Quote
  #31  
Old December 18th, 2017, 11:05 PM
Rvtravlr's Avatar
Rvtravlr Rvtravlr is offline
Seer Deluxe
 
Join Date: Aug 2013
Location: Reno, Nevada
Posts: 480
Quote:
Originally Posted by jon00 View Post
I'm not sure what you mean by dynamically? The text file is used for exception dates only. Without any entries in the file, running the script on a Sun-Thur would mark the virtual device as a school day (tomorrow).
What I would like is for the script to calculate the observed dates for New Years, Memorial Day, Fourth of July, Labor Day, Thanksgiving Day and the following day and Christmas. These would be calculated for any given year we are in.

Then, the only exception dates would be in addition to these days and would be in the txt file.

Is this possible?

Last edited by Rvtravlr; December 19th, 2017 at 12:54 AM.
Reply With Quote
  #32  
Old December 19th, 2017, 04:00 AM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
I'm sure its possible but calculating holiday dates on a yearly basis is not a quick script change.

All this work has been done before so checkout the following threads:

https://forums.homeseer.com/showpost...03&postcount=2

https://forums.homeseer.com/showthread.php?t=179143
Reply With Quote
  #33  
Old December 19th, 2017, 09:01 PM
Rvtravlr's Avatar
Rvtravlr Rvtravlr is offline
Seer Deluxe
 
Join Date: Aug 2013
Location: Reno, Nevada
Posts: 480
Thanks
Reply With Quote
  #34  
Old December 23rd, 2017, 01:34 AM
swanie2000 swanie2000 is offline
Seer Deluxe
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 291
Quote:
Originally Posted by jon00 View Post
You have to put the day before the text file i.e. if tomorrow is not a school day, the date entered would be today 12/17/2017.

The script can be modified to use the actual day if you want.

Change the line:

If DateTime.Now.ToString.Contains(Data) Then

To

If DateTime.Now.AddDays(1).ToString.Contains(Data) Then
Hi Jon00,
I added this line to the script, and it did seem to work, all week, until Friday, when running the script should have resulted in "NO SCHOOL Tomorrow"
The script still thinks Saturday is a school day.

Do you think this little change to the script is throwing off the weekends?
Reply With Quote
  #35  
Old December 23rd, 2017, 12:12 PM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
Odd, I cannot see how that could happen unless there is a match in the text file.

I've added some debug code to the script.

If it happens again, post the debug entries so we can see where the problem lies:

Code:
Imports System.IO

    Sub Main(ByVal Parm As Object)

        Try
            Dim Path As String = ""
            Dim FileReader As StreamReader
            Dim Data As String = ""
            Dim DayOfWeek As Integer
            Dim SchoolDayTomorrow As Boolean = True
            Dim DVRef As Integer = 8668


            Path = hs.GetAppPath & "\data\NoSchoolTomorrowDates.txt"
            FileReader = New StreamReader(Path)
            DayOfWeek = DateTime.Now.DayOfWeek

            Select Case DayOfWeek
                Case 1 To 5 'Sunday To Thursday
                    SchoolDayTomorrow = True
                Case 6 To 7 ' Friday & Saturday
                    SchoolDayTomorrow = False
            End Select
            hs.Writelog("Debug", "Day of Week: " & DayofWeek)
            hs.Writelog("Debug", "School Tomorrow1: " & SchoolDayTomorrow)
            Do While FileReader.Peek >= 0
                Data = FileReader.ReadLine()
                If Data <> "" Then
                    If DateTime.Now.AddDays(1).ToString.Contains(Data) Then
                        hs.Writelog("Debug", "Match in text file: " & DateTime.Now.AddDays(1).ToString & " " & Data)
                        SchoolDayTomorrow = False
                        Exit Do
                    End If
                End If
            Loop
            FileReader.Close()
            hs.Writelog("Debug", "School Tomorrow2: " & SchoolDayTomorrow)

            If hs.DeviceExistsRef(DvRef) Then
                If SchoolDayTomorrow Then
                    hs.SetDeviceValueByRef(DvRef, 1, True)
                    hs.SetDeviceString(DVref, "School Tomorrow", True)
                Else
                    hs.SetDeviceValueByRef(DvRef, 0, True)
                    hs.SetDeviceString(DVref, "No School Tomorrow", True)
                End If
            End If

        Catch Ex As Exception
            hs.WriteLog("Error", "Error in SchoolTomorrow.vb: " & Ex.ToString)
        End Try
    End Sub
Reply With Quote
  #36  
Old December 23rd, 2017, 07:22 PM
swanie2000 swanie2000 is offline
Seer Deluxe
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 291
Thanks Jon00,
I replaced the original script, with the debugging script. Changed (8668) to my device number of (336), and saved it as version 2.

I have an event set up to run the script at 5pm, every day. That same event sends me a text, with the newly updated device value. (School Tomorrow / No School Tomorrow).

I verified the date 12-23-2017(Saturday) was NOT in the list of dates.
Before I changed the script, I manually ran it today, (Saturday, 12/23/2017), and the script did correctly decide that tomorrow (Sunday 12/24/2017) was not a school day.

It seems it only made the mistake on Friday, when looking at Saturday.

Kids are out of school now for 2 weeks, so it will be a little while before the script should change back to (School Tomorrow)
Reply With Quote
  #37  
Old December 23rd, 2017, 07:52 PM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
When you ran it today (sat), what day of the week number did it display in the log?
Reply With Quote
  #38  
Old December 23rd, 2017, 09:00 PM
swanie2000 swanie2000 is offline
Seer Deluxe
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 291
Quote:
Originally Posted by jon00 View Post
When you ran it today (sat), what day of the week number did it display in the log?
This is what is in the log when I ran the event manually

Dec-23 3:12:02 PM email Email successfully sent......
Dec-23 3:12:00 PM Event Event Trigger "Email Routines - Xymon School - Email Notification"
Dec-23 3:11:55 PM Debug School Tomorrow2: False
Dec-23 3:11:55 PM Debug School Tomorrow1: False
Dec-23 3:11:55 PM Debug Day of Week: 6
Dec-23 3:11:55 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/SchoolTomorrow-v2.vb
Dec-23 3:11:55 PM Event Event Trigger "Xymon Routines School Tomorrow / No School Tomorrow"
Dec-23 3:11:55 PM Event Event Xymon Routines School Tomorrow / No School Tomorrow triggered by the event page 'Run' button.
Dec-23 3:11:43 PM Device Control Device: Floor-2 Xymon's Bedroom School Tomorrow (yes/no) to On (1) by/from: CAPI Control Handler
Dec-23 3:10:39 PM email Email successfully sent......
Dec-23 3:10:38 PM Event Event Trigger "Email Routines - Xymon School - Email Notification"
Dec-23 3:10:33 PM Debug School Tomorrow2: False
Dec-23 3:10:33 PM Debug School Tomorrow1: False
Dec-23 3:10:33 PM Debug Day of Week: 6
Dec-23 3:10:32 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/SchoolTomorrow-v2.vb
Dec-23 3:10:32 PM Event Event Trigger "Xymon Routines School Tomorrow / No School Tomorrow"
Dec-23 3:10:32 PM Event Event Xymon Routines School Tomorrow / No School Tomorrow triggered by the event page 'Run' button.


Does that help?

OK, that is the full log....
Reply With Quote
  #39  
Old December 24th, 2017, 08:42 AM
jon00's Avatar
jon00 jon00 is offline
OverSeer
 
Join Date: Jan 2002
Location: London UK
Posts: 11,495
Thanks,

It looks like your Day of week starts on a Monday rather than Sunday.

Change:

Code:
            Select Case DayOfWeek
                Case 1 To 5 'Sunday To Thursday
                    SchoolDayTomorrow = True
                Case 6 To 7 ' Friday & Saturday
                    SchoolDayTomorrow = False
            End Select
To

Code:
            Select Case DayOfWeek
                Case 5 To 6 ' Friday & Saturday
                    SchoolDayTomorrow = False
                Case Else
                    SchoolDayTomorrow = True
            End Select
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger even to run tomorrow? jquincy HS3 / HS3PRO Discussion 5 September 5th, 2017 04:35 PM
Weather forecast for tomorrow U5tabil YR Weather Plugin (3P) 12 February 10th, 2017 04:13 AM
Inhibit Today-Tomorrow langenet mcsSprinklers 1 June 15th, 2016 08:19 PM
Inhibit Tomorrow langenet mcsSprinklers 3 August 25th, 2012 01:47 PM
hs.sunrise time for tomorrow rmorton27 Web Server and Interface 7 January 29th, 2005 09:09 AM


All times are GMT -4. The time now is 01:53 AM.


Copyright HomeSeer Technologies, LLC