Can an event span 12am

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?

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 ?

Sorry - I couldn’t resist - the terms 12 am and 12 pm are incorrect:

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 ! ::slight_smile:

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

What/wot - all eleven of them 8)

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

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.

Yes, I set gc_StartDelta.

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

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.

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.

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.

@ possum
it’s in the first post here:,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


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.

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.

@ 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.

I will update to V2.3 as you suggest.

I don’t understand your post. I haven’t changed anything at this end because this was the last issue that I was trying to resolve. I did download a “GCal3.lua” file that you had included in your last post to this question. You have since deleted it. If there was another file, then I must have missed it. I had to have downloaded the file because that is what allowed the event to end correctly at 2am and it is definitely doing that.

For what it is worth, I also noticed that the time stamp is now working correctly again even though you have made no mention of it.

I must have misread the download count - I thought it was at zero.

For what it is worth, I also noticed that the time stamp is now working correctly again even though you have made no mention of it.

I did not mention because I did not make any changes - I looked and the code was all there. It may have been a side effect of the “midnight thing” but I did not think too hard about that :slight_smile:
… or maybe I covered it here:,35582.15.html

Good the hear that all is well.