Author Topic: Can an event span 12am  (Read 2124 times)

Offline possum

  • Sr. Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
Can an event span 12am
« on: July 11, 2016, 12:04:03 pm »
I have events that run from approximately 7am in the morning until 2am the following day (not an all day event). The event is read from Google and displayed correctly by GCal3 but it seems to be consistently tripping off at 12am. My recollection is that this used to work with V1.4.

Has this behavior changed recently or is my memory faulty?

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #1 on: July 12, 2016, 10:51:43 am »
I did a quick check and do not see this happening but it's possible some combination of parameters is set in a way that makes it happen.

Is it GCal3 that is tripping or a scene that for some reason is executing again at 12:00 am ?

Please send me a log file with gc_debug = 3 that covers the time from 11:00 pm to 1:00 am (i.e. when the error occurs).

Also - since you were having some configuration issues -- what version of GCal3 are you using ?  I assume you got it working by reinstalling ?

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 844
  • Karma: +58/-8
Re: Can an event span 12am
« Reply #2 on: July 12, 2016, 06:19:06 pm »
Sorry - I couldn't resist - the terms 12 am and 12 pm are incorrect:

http://wwp.greenwichmeantime.com/info/noon.htm


Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #3 on: July 13, 2016, 12:38:56 am »
Being an Australian by birth that lived for many years in England (and therefore twice correctly educated), I feel the pain .....
Having lived in the USA for many years I have been forced to adopt some inconsistencies in order to avoid having to explain myself.
Not to mention the most awful of inventions .... 'marketing speak'.  No, I'm not trying to 'disrespect' anyone or as someone said "I'm not sayin', just sain'"!

P.S.  I can also explain the correct use of single and double quotes !   ::)

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 844
  • Karma: +58/-8
Re: Can an event span 12am
« Reply #4 on: July 13, 2016, 04:46:34 pm »
Quote
P.S.  I can also explain the correct use of single and double quotes !

What/wot - all eleven of them 8)

http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=Unicode5QuoteMirroring

Offline possum

  • Sr. Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
Re: Can an event span 12am
« Reply #5 on: July 15, 2016, 12:41:32 am »
I successfully upgraded to your official release V2.2 some days before I noticed this problem. I then loaded the two additional files that you posted but haven't officially released yet. All of this appears to be working correctly because shortly after I completed this, I experienced an internet outage and your app functioned as you described.

I am using your app to provide data to a PLEG module. In the PLEG module, I am using the trigger input "GCal3 Sensor Tripped" although before I posted this question, I tried the other trigger inputs that you provide and they all seemed to work the same - i.e. they go false at "00:00:00" rather than 02:00:00". I have only a single event in the calendar. It is active from approximately 4am until 2am the following day. This information is correctly displayed in the web browser and as far as I can tell, it is visible in the "advance" tab and also shows up in the log file.

I copied some settings out of the GCal3 module after 00:00:00 hours. At this point, the trigger in the PLEG module showed a value of "false" (even though it should have remained true until 2am) and the time stamp for the false state was a short time after "00:00:00".

gc_keyword = AWAKE
gc_exactKeyword = true
gc_ignoreKeyword = false
gc_triggerNoKeyword = false
gc_IgnoreAllDayEvents = false
gc_retrip = true
gc_eventsToday = 1
gc_eventsLeftToday = 0
gc_activeEvents = AWAKE

It seems like this is showing that there is still an active event by the name of AWAKE. This is correct since the calendar OFF time should be 2am and it is just shortly after midnight. However, gc_eventsToday is showing "1" and this seems to be in error unless this is only counting ON events since the OFF event isn't supposed to happen until 2am. gc_eventsLeftToday is also showing zero but this isn't correct either because there are either 1 or 2 events for 7/15/2016 depending on whether you are counting just ON events (4am on 7/15/2016) or both ON events and OFF events (2am on 7/15/2016).

I set gc_debug=3 as you requested and also set the filter on info viewer to GCal3 in order to limit the file to GCal3. If you require log information beyond GCal3, I will need to rerun it again without the filter.

I continue to notice that the time stamps associated with trigger data from this module seem to change (occasionally) when your app runs regardless of whether the data changes or not. I have been able to work around this so it has become more of an academic issue for me but it is somewhat bothersome that there are fundamentally different behaviors for triggers.

EDIT: removed log file
« Last Edit: July 19, 2016, 03:40:42 pm by Stuart »

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #6 on: July 15, 2016, 02:49:46 pm »
Let me take a closer look at this - I suspect that I have a logic error that I have introduced when trying to make the calendar info retrieval more efficient.   I see from the log file that you have set the start time of the event to be 180 minutes earlier than the start-time in the actual calendar entry.  Did you do this by setting gc_StartDelta or in the event name AWAKE[-180,0] or in gc_keyword ?.

P.S. a better filter for getting the log is device: xx (in your case "device: 68") as this will also capture the vera generated logs for the device.  Or, .... use the get log button built into GCal3.

Offline possum

  • Sr. Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
Re: Can an event span 12am
« Reply #7 on: July 15, 2016, 03:28:25 pm »
Yes, I set gc_StartDelta.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #8 on: July 15, 2016, 04:03:40 pm »
Try this.  GCal3 does a check at midnight but was only looking back to the start of the current day (a bug and not very helpful in your case).  I've changed it to look back to the start of the previous day + gc_ExtraDays (literally a one line modification).  gc_ExtraDays was put in to look into the future but I suspect it can do extra duty (pun intended) for those that may have events spanning several days.  The only downside is a larger payload from google - but for most users it will not matter nor will it likely be noticeable.

I'll see if I can test and reproduce over the weekend.  Let me know of your results.

EDIT: Removed File
« Last Edit: July 19, 2016, 03:41:11 pm by Stuart »

Offline zedrally

  • Hero Member
  • *****
  • Posts: 1081
  • Karma: +5/-4
  • Black Cat Control Systems
Re: Can an event span 12am
« Reply #9 on: July 15, 2016, 06:26:27 pm »
I noticed that you referenced PLEG, if your logic is using PLEG then you can span the time using the NOT function. ie NOT 0200;0700


Not sure if it helps, but you might be able to somehow incorporate it into your logic.
Living in the Land of Oz, give me a vegemite sandwich. Home Seer, Vera Lite & Edge, Popp, Black Cat Smart Hub & Vera G, Black Cat Lite 1 & 2's a Black Cat Dimmer or 2, Fantem Tec and then some  Black Cat Cat's Eye PIR's & Door-Window Sensors, RFXComm, Broadlink RMPro & Mini plus a Z-UNO or 2.

Offline possum

  • Sr. Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
Re: Can an event span 12am
« Reply #10 on: July 16, 2016, 08:09:21 am »
The problem is not that the logic spans midnight but that the ending event coming from GCal3 that was set at 2am is being generated prematurely at midnight. I considered breaking the single event up into two events. One that went from 4am to midnight and then a second event that ran from midnight until 2am but decided to find out whether GCal3 was working as intended before I did that.

Stuart:
I have installed your corrected file and should know tomorrow morning whether it has corrected the problem.

Pardon my ignorance but I tried using the log button built into GCal3 but couldn't see where to get the resulting file.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #11 on: July 16, 2016, 01:02:53 pm »
@ possum
it's in the first post here:
http://forum.micasaverde.com/index.php/topic,36744.0.html

also I'm testing as well - have to wait till midnight ....

In addition - another small change to adjust the count of Events today because of the change I made yesterday

Edit: File removed, included in rel 2.3
« Last Edit: July 19, 2016, 03:47:20 pm by Stuart »

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #12 on: July 16, 2016, 01:11:51 pm »
@zedrally

Definite bug in the code  :-[

I forced a check at midnight to facilitate the count of "events today" etc. With that change I also limited the time window of the request to google to only go back as far as midnight.  As a result - it was missing the event that spanned midnight.  The patch I've made should fix that.

GCal3 will now look back to midnight the previous day if gc_Extra days = 0 (the default)  and further days into the past (and future) if gc_extraDays is > 0.

So if there is an event that spans several days from start to finish) then the user may have to alter gc_extraDays to suit.
The alternative is to look back to the start of google time and that is costly in terms of payload, memory etc.

Offline possum

  • Sr. Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
Re: Can an event span 12am
« Reply #13 on: July 17, 2016, 06:08:28 am »
Your fix seems to be working fine. The calendar event turned off at 2am like it was supposed to. I also noticed that

gc_eventsToday = 2
gc_eventsLeftToday = 0

also now seem to make sense since there are two events in the day (2am and 4am) and when I read the information at 6am they had both been completed.

Thanks for the response.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 673
  • Karma: +68/-2
Re: Can an event span 12am
« Reply #14 on: July 19, 2016, 03:46:10 pm »
@ possum

Good to hear, but I noticed you did not download the additional fix in the post above.  So while the values for gc_eventsToday and gc_eventsLeftToday look good - it's likely just your event pattern.

I've removed the file but release version 2.3 which should be out in a couple of days. Recm you upgrade so that you don't see strange numbers with a different pattern of events.