The Vera Community forums have moved!

Advanced => Plugins & Plugin Development => Programming => Google Calendar Switch => Topic started by: Stuart on August 22, 2014, 10:26:48 am

Title: GCAL3 - General Discussion
Post by: Stuart on August 22, 2014, 10:26:48 am
This topic is for general discussion about Google Calendar 3
Title: Re: GCAL3 - Google Calendar 3
Post by: CudaNet on August 22, 2014, 01:10:13 pm
Stuart, really looking forward to installing this. Will give it a go in the next day or so.... So glad this plugin is in it's own forum (just noticed that)...
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 22, 2014, 02:09:47 pm
Stuart, really looking forward to installing this. Will give it a go in the next day or so.... So glad this plugin is in it's own forum (just noticed that)...

Just posted the release files above.   Hope the install is smooth ......
Title: Re: GCAL3 - Google Calendar 3
Post by: korttoma on August 22, 2014, 04:15:20 pm
Thumbs up Stuart!!!
Title: Re: GCAL3 - Google Calendar 3
Post by: duiffie on August 25, 2014, 05:22:24 am
Followed all the steps, but:

Code: [Select]
50      08/25/14 11:24:40.417   luup_log:75: GCal3 gc_V 0.6:Getting new token __LEAK__ this:40960 start:3620864 to 0x12e1000 <0x8c24>
50      08/25/14 11:24:40.420   luup_log:75: GCal3 gc_V 0.6:Client email is: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com __LEAK__ this:4096 start:3624960 to 0x12e2000 <0x8c24>
50      08/25/14 11:24:40.792   luup_log:75: GCal3 gc_V 0.6:Command rm /etc/cmh-ludl/GCal3/GCal3.token returned 256 <0x8c24>
50      08/25/14 11:24:41.027   luup_log:75: GCal3 gc_V 0.6:Command /usr/lib/lua/googlejwt.sh xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3.token returned 32512 <0x8c24>
50      08/25/14 11:24:41.028   luup_log:75: GCal3 gc_V 0.6:Could not execute the googlejwt.sh script <0x8c24>
50      08/25/14 11:24:41.029   luup_log:75: GCal3 gc_V 0.6:Fatal error trying to get access token <0x8c24>
06      08/25/14 11:24:41.032   Device_Variable::m_szValue_set device: 75 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-25T14:13:52 now: 2014-08-25T14:24:32 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x8c24>
50      08/25/14 11:24:41.033   luup_log:75: GCal3 gc_V 0.6:Next check will be in 10800 sec at 2014-08-25T14:24:32 <0x8c24>

The calendar shows up fine though after opening the calendar-tab, the device hangs on 'Checking...'.

Any idea? :-)
Title: Re: GCAL3 - Google Calendar 3
Post by: roquej on August 25, 2014, 09:11:55 am
Stuart,

Will GCal3 install over GCal_II or would it be appear as another device?

Thank you!

JR
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 25, 2014, 10:47:20 am
Followed all the steps, but:

Code: [Select]
50      08/25/14 11:24:40.417   luup_log:75: GCal3 gc_V 0.6:Getting new token __LEAK__ this:40960 start:3620864 to 0x12e1000 <0x8c24>
50      08/25/14 11:24:40.420   luup_log:75: GCal3 gc_V 0.6:Client email is: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com __LEAK__ this:4096 start:3624960 to 0x12e2000 <0x8c24>
50      08/25/14 11:24:40.792   luup_log:75: GCal3 gc_V 0.6:Command rm /etc/cmh-ludl/GCal3/GCal3.token returned 256 <0x8c24>
50      08/25/14 11:24:41.027   luup_log:75: GCal3 gc_V 0.6:Command /usr/lib/lua/googlejwt.sh xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3.token returned 32512 <0x8c24>
50      08/25/14 11:24:41.028   luup_log:75: GCal3 gc_V 0.6:Could not execute the googlejwt.sh script <0x8c24>
50      08/25/14 11:24:41.029   luup_log:75: GCal3 gc_V 0.6:Fatal error trying to get access token <0x8c24>
06      08/25/14 11:24:41.032   Device_Variable::m_szValue_set device: 75 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-25T14:13:52 now: 2014-08-25T14:24:32 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x8c24>
50      08/25/14 11:24:41.033   luup_log:75: GCal3 gc_V 0.6:Next check will be in 10800 sec at 2014-08-25T14:24:32 <0x8c24>

The calendar shows up fine though after opening the calendar-tab, the device hangs on 'Checking...'.

Any idea? :-)

@duiffie
This log tells me there was a error trying to execute the command /ur/lib/lua/googlejwt.sh -- possibly that it could not be found .....
The number and type of arguments looks correct

What does the log file indicate at the very start ?   It's possible there was a failure in downloading googlejwt.sh or setting it's permissions. 

Unfortunately googlejwt.sh is currently a 'black box' there is no debugging.  That's the next thing I'm working on, although - given a correctly formed GCal3.json file - I've not seen it fail.

Lets see if googlejwt.json exists first - can you telnet in ?  do an 'ls -l' ?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 25, 2014, 10:54:07 am
Stuart,

Will GCal3 install over GCal_II or would it be appear as another device?

Thank you!

JR

You "should" be fine - I think (I'm on the road for a couple of days)  there may be one global variable that I have not tidied up that is common with GCal_II but it's only used briefly when decoding calendar results - so it would be bad luck if there was a 'collision'.  Even then - I'm not certain how Lua / mios seprates the execution space .....  so it might be perfectly fine even as is.
Title: Re: GCAL3 - Google Calendar 3
Post by: duiffie on August 25, 2014, 12:11:20 pm
Followed all the steps, but:

Code: [Select]
50      08/25/14 11:24:40.417   luup_log:75: GCal3 gc_V 0.6:Getting new token __LEAK__ this:40960 start:3620864 to 0x12e1000 <0x8c24>
50      08/25/14 11:24:40.420   luup_log:75: GCal3 gc_V 0.6:Client email is: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com __LEAK__ this:4096 start:3624960 to 0x12e2000 <0x8c24>
50      08/25/14 11:24:40.792   luup_log:75: GCal3 gc_V 0.6:Command rm /etc/cmh-ludl/GCal3/GCal3.token returned 256 <0x8c24>
50      08/25/14 11:24:41.027   luup_log:75: GCal3 gc_V 0.6:Command /usr/lib/lua/googlejwt.sh xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3.token returned 32512 <0x8c24>
50      08/25/14 11:24:41.028   luup_log:75: GCal3 gc_V 0.6:Could not execute the googlejwt.sh script <0x8c24>
50      08/25/14 11:24:41.029   luup_log:75: GCal3 gc_V 0.6:Fatal error trying to get access token <0x8c24>
06      08/25/14 11:24:41.032   Device_Variable::m_szValue_set device: 75 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-25T14:13:52 now: 2014-08-25T14:24:32 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x8c24>
50      08/25/14 11:24:41.033   luup_log:75: GCal3 gc_V 0.6:Next check will be in 10800 sec at 2014-08-25T14:24:32 <0x8c24>

The calendar shows up fine though after opening the calendar-tab, the device hangs on 'Checking...'.

Any idea? :-)

@duiffie
This log tells me there was a error trying to execute the command /ur/lib/lua/googlejwt.sh -- possibly that it could not be found .....
The number and type of arguments looks correct

What does the log file indicate at the very start ?   It's possible there was a failure in downloading googlejwt.sh or setting it's permissions. 

Unfortunately googlejwt.sh is currently a 'black box' there is no debugging.  That's the next thing I'm working on, although - given a correctly formed GCal3.json file - I've not seen it fail.

Lets see if googlejwt.json exists first - can you telnet in ?  do an 'ls -l' ?

it does exist and it is executable:
Code: [Select]
ls -ltr /usr/lib/lua/googlejwt.sh
-rwxr-xr-x    1 root     root         1240 Aug 25 18:04 /usr/lib/lua/googlejwt.sh

i see that the openssl command is used within this shell script. My box (vera 2) doesn't seem to have openssl installed, can that be a reason?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 25, 2014, 12:22:47 pm
@ Duiffie
Wow!   I have a vera light and do not know if there is supposed to be a difference.

The reason I went that route is because vera does not have a lua module that would otherwise be used.  So I assumed that the *nix libraries would be the safest approach.......

I'll send an email to vera support and ask.  It may be a simple opt install -  if so we can do that manually and later I can pout a check in the plugin.

Title: Re: GCAL3 - Google Calendar 3
Post by: duiffie on August 25, 2014, 12:40:10 pm
@ Duiffie
Wow!   I have a vera light and do not know if there is supposed to be a difference.

The reason I went that route is because vera does not have a lua module that would otherwise be used.  So I assumed that the *nix libraries would be the safest approach.......

I'll send an email to vera support and ask.  It may be a simple opt install -  if so we can do that manually and later I can pout a check in the plugin.

I did 2 things and then things started to work:
- installed openssl: opkg install openssl-util
- changed the first line of the googlejwt.sh script (#!/bin/bash to #!/bin/ash) because bash seems not present on vera 2 as well
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 25, 2014, 03:51:48 pm
@Duiffie

Great! And Thanks! !!!

I suspect that ash vs bash is just a symlink  to busybox-  strange that MCV would do that. ..... might be an openwrt thing. ....

Might be that the script can be made generic by invoking busybox direct.

I'm traveling this week but will look at some options when I return including auto installing opened out it's not there. ...
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: guest141575 on August 26, 2014, 01:03:19 pm
I've upgraded from GCal II to GCal 3.

Now, whenever Vera needs to make a reload it will take like ages. I have 4 defined calendar devices. The reload happens an arbitrary number of times, typically 4 times in a row. It says "Unit Busy", then it says "Running LUA Startup" or "Starting LUA Engine". Then it starts with "Unit Busy" and so on..  Before it was only a single cycle.
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: Stuart on August 26, 2014, 03:08:58 pm
I've upgraded from GCal II to GCal 3.

Now, whenever Vera needs to make a reload it will take like ages. I have 4 defined calendar devices. The reload happens an arbitrary number of times, typically 4 times in a row. It says "Unit Busy", then it says "Running LUA Startup" or "Starting LUA Engine". Then it starts with "Unit Busy" and so on..  Before it was only a single cycle.

Once it's done does it work correctly?
Can you capture a log file?
I did not test with multiple plugins since hopefully the ability to define multiple keywords makes that unnecessary.  I will try to test but may not get to it until next week.
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: guest141575 on August 26, 2014, 04:15:37 pm
I've upgraded from GCal II to GCal 3.

Now, whenever Vera needs to make a reload it will take like ages. I have 4 defined calendar devices. The reload happens an arbitrary number of times, typically 4 times in a row. It says "Unit Busy", then it says "Running LUA Startup" or "Starting LUA Engine". Then it starts with "Unit Busy" and so on..  Before it was only a single cycle.

Once it's done does it work correctly?
Can you capture a log file?
I did not test with multiple plugins since hopefully the ability to define multiple keywords makes that unnecessary.  I will try to test but may not get to it until next week.

First I want to say Thank You for your great work.  ;D

Yes, everything seems to work after it's done reloading etc , so it's not that urgent. It can wait until you have time to look into it. I use multiple GCal 3 devices since I have several calendars to watch :D

If You can't reproduce the behaviour I will learn how to produce a log file. Thanks!  ;D ;D ;D

Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: guest141575 on August 27, 2014, 04:33:06 am
Once it's done does it work correctly?

New status update:

This morning one of my main PLEG wouldn't load due to "Error loading Startup Lua" (or something like that). I can't say why. I had to resolve it by uninstalling GCal 3 and replace it by the old GCal II. Everything works smoothly with the old plugin.

I tried first to just unset the calendar URLs but it didn't help. I wish I could provide some info that is more helpful but I really had to get my Vera system back in a working state.
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: Stuart on August 27, 2014, 05:53:10 am
Once it's done does it work correctly?

New status update:

This morning one of my main PLEG wouldn't load due to "Error loading Startup Lua" (or something like that). I can't say why. I had to resolve it by uninstalling GCal 3 and replace it by the old GCal II. Everything works smoothly with the old plugin.

I tried first to just unset the calendar URLs but it didn't help. I wish I could provide some info that is more helpful but I really had to get my Vera system back in a working state.

PLEG gets a little agitated when devices it knew about are changed.  I have found that I need to remove all references to old devices and replace them whenever I either change the name of a plugin or it's device number changes.

With 4 instances of the plugin. ....... it would be easy get out pic sync
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: guest141575 on August 27, 2014, 06:14:31 am
Once it's done does it work correctly?

New status update:

This morning one of my main PLEG wouldn't load due to "Error loading Startup Lua" (or something like that). I can't say why. I had to resolve it by uninstalling GCal 3 and replace it by the old GCal II. Everything works smoothly with the old plugin.

I tried first to just unset the calendar URLs but it didn't help. I wish I could provide some info that is more helpful but I really had to get my Vera system back in a working state.

PLEG gets a little agitated when devices it knew about are changed.  I have found that I need to remove all references to old devices and replace them whenever I either change the name of a plugin or it's device number changes.

With 4 instances of the plugin. ....... it would be easy get out pic sync

I had 3 trigger references in PLEG to the GCal devices. When Upgrading I created new GCAL 3 instances first and just changed the trigger references from the old to the new devices. (Btw, PLEG won't recognize any changes made unless I also alter the trigger name). After that I deleted the old GCal II devices and the Plugin itself. I did it this way because I don't want to reimplement my PLEG logic.

This morning when I had problems with my main PLEG starting, I did the same procedure as described above except from that I downgraded. That is, I actually created 4 new GCal II devices. It works fine after changing the references in PLEG to the new GCal II devices, no issues at all and fast reloading.

I don't know if this information helps... I wish I had a spare Vera for testing purposes :D

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 27, 2014, 09:20:12 am
@farang
This is good feedback.  I suspect that it's related to the multiple plugin reload issue - which I have reproduced.

The problem occurs when the plugins are trying to access google at the same time.  It's a little different method between GCal_II and GCal3.  I suspect the problem would occurs after startup during later checks but it's definitely a timing thing and sometimes happens and sometimes not -  so maybe that's what happened.

I'm going to implement a semaphore asap and see if that solves it. .....

A spare vera would be nice😶👀
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: Stuart on August 27, 2014, 02:13:36 pm
I've upgraded from GCal II to GCal 3.

Now, whenever Vera needs to make a reload it will take like ages. I have 4 defined calendar devices. The reload happens an arbitrary number of times, typically 4 times in a row. It says "Unit Busy", then it says "Running LUA Startup" or "Starting LUA Engine". Then it starts with "Unit Busy" and so on..  Before it was only a single cycle.

I had a long flight delay and was able to put in and test some semaphore code that should prevent this from happening.  It forces a staggered calendar refresh between instances of the plugin.

 The problem looked to be due to simultaneous https requests - but that's a bit speculative.  Can you try this version and let me know?  I could not get it to 'break' running two plugins at the same time trying for the same calendar ..... 

Attachment removed ...  had a bug
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: guest141575 on August 28, 2014, 02:52:52 am
I've upgraded from GCal II to GCal 3.

Now, whenever Vera needs to make a reload it will take like ages. I have 4 defined calendar devices. The reload happens an arbitrary number of times, typically 4 times in a row. It says "Unit Busy", then it says "Running LUA Startup" or "Starting LUA Engine". Then it starts with "Unit Busy" and so on..  Before it was only a single cycle.

I had a long flight delay and was able to put in and test some semaphore code that should prevent this from happening.  It forces a staggered calendar refresh between instances of the plugin.

 The problem looked to be due to simultaneous https requests - but that's a bit speculative.  Can you try this version and let me know?  I could not get it to 'break' running two plugins at the same time trying for the same calendar .....

Thank You Stuart  :)

Currently I'm quite busy working but I'll try to test when I get some time left. PM me if You'd like to get access to a busy GCal calendar for testing purposes (I manage a school schedule you could use for stress test)

Cheers  ;D
Title: Re: GCAL3 - Google Calendar 3
Post by: tyfoon on August 28, 2014, 07:37:59 am
Hi,

Moving from the original Gcal to Gcal3 and having some issues with PLEG & GCAL3 I don't get.

I'm reading the gc_Trippedevent variable and using this value as a condition. See below for the PLEG logic.

What I don't get is that all three conditions are true.

Please note that the calendar items do not overlap so only one should be true.


Device Properties
Name   Device Name   Device Variable   Value   Last Change   Previous Change
GcalEvent   GCal3 Sensor   gc_TrippedEvent   KIDSWEG   2014-08-28 06:27:21.102   2014-08-28 06:26:21.789


Conditions
TempKidsWeg   No   GcalEvent=="KIDSWEG"   true   2014-08-26 20:03:18.346   2014-08-26 20:01:51.372
TempKidsWarm   No   GcalEvent=="KIDSWARM"   true   2014-08-26 20:09:23.507   0
TempKidsSlapen   No   GcalEvent=="KIDSSLAPEN"   true   2014-08-26 20:09:23.510   0
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 28, 2014, 12:10:59 pm
Hi,

Moving from the original Gcal to Gcal3 and having some issues with PLEG & GCAL3 I don't get.

I'm reading the gc_Trippedevent variable and using this value as a condition. See below for the PLEG logic.

What I don't get is that all three conditions are true.

Please note that the calendar items do not overlap so only one should be true.


Device Properties
Name   Device Name   Device Variable   Value   Last Change   Previous Change
GcalEvent   GCal3 Sensor   gc_TrippedEvent   KIDSWEG   2014-08-28 06:27:21.102   2014-08-28 06:26:21.789


Conditions
TempKidsWeg   No   GcalEvent=="KIDSWEG"   true   2014-08-26 20:03:18.346   2014-08-26 20:01:51.372
TempKidsWarm   No   GcalEvent=="KIDSWARM"   true   2014-08-26 20:09:23.507   0
TempKidsSlapen   No   GcalEvent=="KIDSSLAPEN"   true   2014-08-26 20:09:23.510   0

Just a shot in the dark.  If gc_triggerNoKeyword is false. What happens if you set it to true?
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on August 29, 2014, 08:37:58 am
Hi

I am also having trouble getting this to work in PLEG. I am using the "Event has specified name" option. I noticed when I looked in the gcal device advanced tab that the gc_jsonEvents variable is empty. From reading the docs, I believe this is probably what PLEG would be looking at?

Thanks
Title: Re: GCAL3 - Google Calendar 3
Post by: hansibal on August 29, 2014, 10:22:59 am
Hi Stuart,

I must be doing something wrong, have been trying for the last 3 day to get it working, first in UI7, but I have reverted to UI6, but no luck there either.

I have tried to set up the plugin both automatically via the 'app store' and manually. I get the calendar view in the calendar tab and I see the test event, but I get stuck in the 'checking loop'

This is the info from the log file
Code: [Select]
06      08/29/14 15:17:53.003   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-29T15:17:52 now: 2014-08-29T15:17:53 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2cd63680>
06      08/29/14 15:17:53.004   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2cd63680>
50      08/29/14 15:17:53.004   luup_log:107: GCal3 gc_V 0.6:Device nil blocked semaphore request from device 107 <0x2cd63680>
06      08/29/14 15:17:53.005   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-29T15:18:02 now: 2014-08-29T15:18:03 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2cd63680>
50      08/29/14 15:17:53.006   luup_log:107: GCal3 gc_V 0.6:Next check will be in 10 sec at 2014-08-29T15:18:03 <0
This is what I get after updating to yesterdays V0.6 lua. It seems to me it doesn't get any events at all. Prior to updating the the most recent lua, I had the package file from post one and I got the following message:
Code: [Select]
LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 0.6"..."]:234: attempt to concatenate local 'client_email' (a nil value)
But that seems to work now with the new version

Any ideas would be greatly appreciated!

Keep up the good work

Kr,
Hans
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 29, 2014, 11:15:07 am
Hi

I am also having trouble getting this to work in PLEG. I am using the "Event has specified name" option. I noticed when I looked in the gcal device advanced tab that the gc_jsonEvents variable is empty. From reading the docs, I believe this is probably what PLEG would be looking at?

Thanks

PLEG would not look at gc_jsonEvents.  Provided the browser UI was refreshed (F5) to update the advanced tab - if gc_jsonEvents is empty, this means that no events were read from the calendar - none at all.

What does the front panel of the plugin indicate ?  Does it show an event ?  Not tiggered / active / triggered ?   (lightbulb ==> grey / light yellow / full yellow). It's the value of gc_trippedEvent that causes "Event has specified name" to work.  Note also that your matching condition MUST be all upper case.

Please check these things and we will get it working.   Also - was this an existing or new PLEG configuration ?

The quickest way to troubleshoot is to get a log file with gc_debug set to 3.   The infoviewer plugin is great for that ......
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 29, 2014, 12:52:27 pm
Attached is a patched file.  There was a problem with the semaphore and that certainly affected Hansibal , quite likely Borat and likely everyone else who tried the last patch (which I have removed).

Here is version 6.1.2 -- please let me know how it goes.  I deliberately tried to make it misbehave - and think I've got it this time .....  learning about Lua all the time ......

Edit: Removed Attachment
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 29, 2014, 01:02:49 pm
Hi Stuart,

I must be doing something wrong, have been trying for the last 3 day to get it working, first in UI7, but I have reverted to UI6, but no luck there either.

I have tried to set up the plugin both automatically via the 'app store' and manually. I get the calendar view in the calendar tab and I see the test event, but I get stuck in the 'checking loop'

This is the info from the log file
Code: [Select]
06      08/29/14 15:17:53.003   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-29T15:17:52 now: 2014-08-29T15:17:53 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2cd63680>
06      08/29/14 15:17:53.004   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2cd63680>
50      08/29/14 15:17:53.004   luup_log:107: GCal3 gc_V 0.6:Device nil blocked semaphore request from device 107 <0x2cd63680>
06      08/29/14 15:17:53.005   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-29T15:18:02 now: 2014-08-29T15:18:03 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2cd63680>
50      08/29/14 15:17:53.006   luup_log:107: GCal3 gc_V 0.6:Next check will be in 10 sec at 2014-08-29T15:18:03 <0
This is what I get after updating to yesterdays V0.6 lua. It seems to me it doesn't get any events at all. Prior to updating the the most recent lua, I had the package file from post one and I got the following message:
Code: [Select]
LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 0.6"..."]:234: attempt to concatenate local 'client_email' (a nil value)
But that seems to work now with the new version

Any ideas would be greatly appreciated!

Keep up the good work

Kr,
Hans

I'd love to know how this goes in UI7 .....

I think I fixed the problem you were seeing ....   see post above ....
Title: Re: GCAL3 - Google Calendar 3
Post by: tyfoon on August 29, 2014, 03:35:32 pm
Hi

I am also having trouble getting this to work in PLEG. I am using the "Event has specified name" option. I noticed when I looked in the gcal device advanced tab that the gc_jsonEvents variable is empty. From reading the docs, I believe this is probably what PLEG would be looking at?

Thanks

PLEG would not look at gc_jsonEvents.  Provided the browser UI was refreshed (F5) to update the advanced tab - if gc_jsonEvents is empty, this means that no events were read from the calendar - none at all.

What does the front panel of the plugin indicate ?  Does it show an event ?  Not tiggered / active / triggered ?   (lightbulb ==> grey / light yellow / full yellow). It's the value of gc_trippedEvent that causes "Event has specified name" to work.  Note also that your matching condition MUST be all upper case.

Please check these things and we will get it working.   Also - was this an existing or new PLEG configuration ?

The quickest way to troubleshoot is to get a log file with gc_debug set to 3.   The infoviewer plugin is great for that ......
Hi Stuart,  please see my pleg code above (all capitals) and a screenshot of the Plugin.  The Plugin nicely shows a burning light bulb and the correct event.
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on August 30, 2014, 07:46:15 am
Hi

I am also having trouble getting this to work in PLEG. I am using the "Event has specified name" option. I noticed when I looked in the gcal device advanced tab that the gc_jsonEvents variable is empty. From reading the docs, I believe this is probably what PLEG would be looking at?

Thanks

PLEG would not look at gc_jsonEvents.  Provided the browser UI was refreshed (F5) to update the advanced tab - if gc_jsonEvents is empty, this means that no events were read from the calendar - none at all.

What does the front panel of the plugin indicate ?  Does it show an event ?  Not tiggered / active / triggered ?   (lightbulb ==> grey / light yellow / full yellow). It's the value of gc_trippedEvent that causes "Event has specified name" to work.  Note also that your matching condition MUST be all upper case.

Please check these things and we will get it working.   Also - was this an existing or new PLEG configuration ?

The quickest way to troubleshoot is to get a log file with gc_debug set to 3.   The infoviewer plugin is great for that ......

It was definitely tripping on am event. Away at the mo so can't send a screenshot but it was showing the event I was looking for in pleg at the top and showing tripped. Will try the new version when I get home and let u know.

Title: Re: GCAL3 - Google Calendar 3
Post by: hansibal on August 30, 2014, 10:01:09 am
Attached is a patched file.  There was a problem with the semaphore and that certainly affected Hansibal , quite likely Borat and likely everyone else who tried the last patch (which I have removed).

Here is version 6.1.2 -- please let me know how it goes.  I deliberately tried to make it misbehave - and think I've got it this time .....  learning about Lua all the time ......

hi Stuart,

Thanks for taking time to look into this. I know get the following error:
Code: [Select]
06      08/30/14 14:57:44.101   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T14:56:55 now: 2014-08-30T14:57:44 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2dacb680>
06      08/30/14 14:57:44.102   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2dacb680>
50      08/30/14 14:57:44.102   luup_log:107: GCal3 gc_V 0.6.2:Checking semaphore <0x2dacb680>
50      08/30/14 14:57:44.103   luup_log:107: GCal3 gc_V 0.6.2:Semaphore file returned nil <0x2dacb680>
01      08/30/14 14:57:44.103   LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 0.6.2"..."]:101: /etc/cmh-ludl/GCal3/GCal3.sem: No such file or directory <

Kr,
Hans
Title: Re: GCAL3 - Google Calendar 3
Post by: kiethr on August 30, 2014, 12:16:22 pm
Hi Stuart

Thank you for your work with this app, I seem to be having an issue after upgrading to Gcal3.  After installing from the most recent patch in the forum, I can't get the calendar to load.  I put in the URL and i received a message that it was set.  I closed the window and refreshed.  I then set up the triggers and none of them would fire.  I then pressed the check button and its been checking for over an hour and nothing populates in the calendar tab.

Any pointers?

PS its on a vera lite.

Thanks


Sent from my iPad using Tapatalk HD
Title: Re: GCAL3 - Google Calendar 3
Post by: babas on August 30, 2014, 12:41:43 pm
Hi Stuart,

I have a problems when I ask a "check" the message "Checking ..." persist. I check with two devices.
On tab "calendar" is ok I see my calendar.

Code: [Select]
50      08/30/14 18:32:35.516   luup_log:186: GCal3 gc_V 0.6.2:This is device # 186 __LEAK__ this:8192 start:774144 to 0x1152000 <0x2c18f680>
06      08/30/14 18:32:35.517   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedEvent was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.517   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedID was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.518   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_Value was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.518   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Checking ... #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.518   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.519   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_Interval was: 180 now: 180 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.519   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_StartDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.520   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_EndDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.520   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.520   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_exactKeyword was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.521   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.521   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_triggerNoKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.521   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreAllDayEvent was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.522   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_retrip was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.523   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_CalendarID was: ir5jbk6tlfgprcag2pc6b1ei2o@group.calendar.google.com now: ir5jbk6tlfgprcag2pc6b1ei2o@group.calendar.google.com #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.523   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.524   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T18:25:40 now: 2014-08-30T18:25:40 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.524   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-30T18:12:46 now: 2014-08-30T18:12:46 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.525   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_debug was: 3 now: 3 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.525   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_displaystatus was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
50      08/30/14 18:32:35.525   luup_log:186: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Variables initialized ... <0x2c18f680>
50      08/30/14 18:32:35.542   luup_log:186: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2c18f680>
50      08/30/14 18:32:35.543   luup_log:186: GCal3 gc_V 0.6.2:/usr/lib/lua/googlejwt.sh  already exists <0x2c18f680>

50      08/30/14 18:32:35.585   luup_log:186: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/json.lua returned 0 <0x2c18f680>
50      08/30/14 18:32:35.585   luup_log:186: GCal3 gc_V 0.6.2:/usr/lib/lua/json.lua  already exists <0x2c18f680>
50      08/30/14 18:32:35.586   luup_log:186: GCal3 gc_V 0.6.2:Function: checkforcredentials <0x2c18f680>

50      08/30/14 18:32:35.616   luup_log:186: GCal3 gc_V 0.6.2:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2c18f680>
50      08/30/14 18:32:35.617   luup_log:186: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Timezone is 2 hrs and 0 min <0x2c18f680>
50      08/30/14 18:32:35.617   luup_log:186: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Running Plugin ... <0x2c18f680>
06      08/30/14 18:32:35.617   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2c18f680>
06      08/30/14 18:32:35.618   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
50      08/30/14 18:32:35.622   luup_log:187: GCal3 gc_V 0.6.2:This is device # 187 <0x2c18f680>
06      08/30/14 18:32:35.635   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedEvent was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.636   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedID was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.636   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_Value was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.636   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Checking ... #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.637   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.637   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_Interval was: 180 now: 180 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.638   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_StartDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.638   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_EndDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.638   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.639   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_exactKeyword was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.639   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.639   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_triggerNoKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.640   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreAllDayEvent was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.640   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_retrip was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.641   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_CalendarID was: dgmhk36mgd4s54s0ircbl68k0j72v04s@import.calendar.google.com now: dgmhk36mgd4s54s0ircbl68k0j72v04s@import.calendar.google.com #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.641   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.641   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T18:25:10 now: 2014-08-30T18:25:10 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.643   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-30T18:16:57 now: 2014-08-30T18:16:57 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.643   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_debug was: 1 now: 1 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
06      08/30/14 18:32:35.644   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_displaystatus was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>
50      08/30/14 18:32:35.644   luup_log:187: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Variables initialized ... <0x2c18f680>

50      08/30/14 18:32:35.822   luup_log:187: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Running Plugin ... <0x2c18f680>
06      08/30/14 18:32:35.822   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2c18f680>
06      08/30/14 18:32:35.843   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2c18f680>





06      08/30/14 18:32:37.104   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T18:25:10 now: 2014-08-30T18:32:37 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 __LEAK__ this:131072 start:1101824 to 0x11a2000 <0x2d98f680>
06      08/30/14 18:32:37.104   Device_Variable::m_szValue_set device: 187 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2d98f680>
06      08/30/14 18:32:37.107   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T18:25:40 now: 2014-08-30T18:32:37 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2d78f680>
06      08/30/14 18:32:37.107   Device_Variable::m_szValue_set device: 186 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2d78f680>
50      08/30/14 18:32:37.108   luup_log:186: GCal3 gc_V 0.6.2:Checking semaphore <0x2d78f680>
50      08/30/14 18:32:37.108   luup_log:186: GCal3 gc_V 0.6.2:Semaphore file returned nil <0x2d78f680>

thanks
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 30, 2014, 02:02:54 pm
Attached is a patched file.  There was a problem with the semaphore and that certainly affected Hansibal , quite likely Borat and likely everyone else who tried the last patch (which I have removed).

Here is version 6.1.2 -- please let me know how it goes.  I deliberately tried to make it misbehave - and think I've got it this time .....  learning about Lua all the time ......

hi Stuart,

Thanks for taking time to look into this. I know get the following error:
Code: [Select]
06      08/30/14 14:57:44.101   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T14:56:55 now: 2014-08-30T14:57:44 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2dacb680>
06      08/30/14 14:57:44.102   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2dacb680>
50      08/30/14 14:57:44.102   luup_log:107: GCal3 gc_V 0.6.2:Checking semaphore <0x2dacb680>
50      08/30/14 14:57:44.103   luup_log:107: GCal3 gc_V 0.6.2:Semaphore file returned nil <0x2dacb680>
01      08/30/14 14:57:44.103   LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 0.6.2"..."]:101: /etc/cmh-ludl/GCal3/GCal3.sem: No such file or directory <

Kr,
Hans

Hi Hans --
I'm wondering if there is an upstream error ?   Are you able to see if the directory /etc/cmh-ludl/GCal3 exists ? If so - what files are in that directory ?  It should get created when the credentials are being parsed.  What does the log file look like during the plugin startup ?

The creation of the GCal3.sem file should occur immediately after the "semaphore file returned nil" message.  Clearly it is not (and the logs confirm that) and the function I am using assumes the folder exists  So the question may be  "why isn't the folder being created"

If the 
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 30, 2014, 02:08:32 pm
Hi Stuart

Thank you for your work with this app, I seem to be having an issue after upgrading to Gcal3.  After installing from the most recent patch in the forum, I can't get the calendar to load.  I put in the URL and i received a message that it was set.  I closed the window and refreshed.  I then set up the triggers and none of them would fire.  I then pressed the check button and its been checking for over an hour and nothing populates in the calendar tab.

Any pointers?

PS its on a vera lite.

Thanks


Sent from my iPad using Tapatalk HD

I use a vera light - so you should be good to go.  If it's hung when you press the check button - it could be several things.  Please get a log file with gc_debug = 3 and we can figure out what's happening.

When you say you put in the url - do you mean the calendar ID ?   GCal3 works very differently that GCal_II
Title: Re: GCAL3 - Google Calendar 3
Post by: korttoma on August 30, 2014, 02:16:38 pm
@Stuart

Veralite and Vera2 is not the same. Veralite should be the same as Vera3 as far as I know only less memory and some less ethernet ports.

I could be wrong.

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 30, 2014, 02:25:26 pm
@Stuart

Veralite and Vera2 is not the same. Veralite should be the same as Vera3 as far as I know only less memory and some less ethernet ports.

I could be wrong.
I had misread the post and quickly corrected myself. ...  not quickly enough  :'(

Title: Re: GCAL3 - Google Calendar 3
Post by: korttoma on August 30, 2014, 02:37:35 pm
Don't cry Stuart, we all make mistakes. Btw, thanks again for all your har work!  ;)
Title: Re: GCAL3 - Google Calendar 3
Post by: hansibal on August 30, 2014, 03:37:57 pm
Quote

Hi Hans --
I'm wondering if there is an upstream error ?   Are you able to see if the directory /etc/cmh-ludl/GCal3 exists ? If so - what files are in that directory ?  It should get created when the credentials are being parsed.  What does the log file look like during the plugin startup ?

The creation of the GCal3.sem file should occur immediately after the "semaphore file returned nil" message.  Clearly it is not (and the logs confirm that) and the function I am using assumes the folder exists  So the question may be  "why isn't the folder being created"

If the

Hi,

Only had my vera kit for a couple of days, but I think I am starting to like this stuff. Here is the stuff from the startup:
Code: [Select]
06      08/30/14 20:28:19.702   Device_Variable::m_szValue_set device: 107 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Armed was: 0 now: 0 #hooks: 1 upnp: 0 v:0xde0cc0/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.702   Device_Variable::m_szValue_set device: 107 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Tripped was: 0 now: 0 #hooks: 1 upnp: 0 v:0xde0070/NONE duplicate:0 <0x2b673680>
06      08/30/14 20:28:19.741   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedEvent was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.741   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedID was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.742   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_Value was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.742   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Successfully Initialized now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.742   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.743   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_Interval was: 180 now: 180 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.743   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_StartDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.744   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_EndDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.744   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.744   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_exactKeyword was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.745   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.745   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_triggerNoKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.746   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreAllDayEvent was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.746   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_retrip was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.746   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_CalendarID was: ------------@googlemail.com now: --------n@googlemail.com #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.747   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.747   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T20:07:26 now: 2014-08-30T20:07:26 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.747   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-30T14:55:11 now: 2014-08-30T14:55:11 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.748   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_debug was: 3 now: 3 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.748   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_displaystatus was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
50      08/30/14 20:28:19.752   luup_log:107: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Variables initialized ... <0x2b673680>
50      08/30/14 20:28:19.770   luup_log:107: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2b673680>
50      08/30/14 20:28:19.770   luup_log:107: GCal3 gc_V 0.6.2:/usr/lib/lua/googlejwt.sh  already exists <0x2b673680>
50      08/30/14 20:28:19.789   luup_log:107: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/json.lua returned 0 <0x2b673680>
50      08/30/14 20:28:19.789   luup_log:107: GCal3 gc_V 0.6.2:/usr/lib/lua/json.lua  already exists <0x2b673680>
50      08/30/14 20:28:19.790   luup_log:107: GCal3 gc_V 0.6.2:Function: checkforcredentials <0x2b673680>
50      08/30/14 20:28:19.808   luup_log:107: GCal3 gc_V 0.6.2:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b673680>
50      08/30/14 20:28:19.809   luup_log:107: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Timezone is 1 hrs and 0 min <0x2b673680>
50      08/30/14 20:28:19.809   luup_log:107: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Running Plugin ... <0x2b673680>
06      08/30/14 20:28:19.810   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Successfully Initialized now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.810   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x

The /etc/cmh-hudl/ doesn't contain the directory GCAL3, there are three files in the dir for Gcal:
GCal3.lua.lzo                       
GCal_II.lua.lzo                       
Gcal3.json.lzo

hope this helps,

Kr,
Hans
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 30, 2014, 04:28:19 pm
Quote

Hi Hans --
I'm wondering if there is an upstream error ?   Are you able to see if the directory /etc/cmh-ludl/GCal3 exists ? If so - what files are in that directory ?  It should get created when the credentials are being parsed.  What does the log file look like during the plugin startup ?

The creation of the GCal3.sem file should occur immediately after the "semaphore file returned nil" message.  Clearly it is not (and the logs confirm that) and the function I am using assumes the folder exists  So the question may be  "why isn't the folder being created"

If the

Hi,

Only had my vera kit for a couple of days, but I think I am starting to like this stuff. Here is the stuff from the startup:
Code: [Select]
06      08/30/14 20:28:19.702   Device_Variable::m_szValue_set device: 107 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Armed was: 0 now: 0 #hooks: 1 upnp: 0 v:0xde0cc0/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.702   Device_Variable::m_szValue_set device: 107 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Tripped was: 0 now: 0 #hooks: 1 upnp: 0 v:0xde0070/NONE duplicate:0 <0x2b673680>
06      08/30/14 20:28:19.741   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedEvent was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.741   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedID was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.742   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_Value was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.742   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Successfully Initialized now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.742   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.743   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_Interval was: 180 now: 180 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.743   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_StartDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.744   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_EndDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.744   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.744   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_exactKeyword was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.745   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.745   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_triggerNoKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.746   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreAllDayEvent was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.746   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_retrip was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.746   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_CalendarID was: ------------@googlemail.com now: --------n@googlemail.com #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.747   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.747   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T20:07:26 now: 2014-08-30T20:07:26 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.747   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-30T14:55:11 now: 2014-08-30T14:55:11 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.748   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_debug was: 3 now: 3 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.748   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_displaystatus was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
50      08/30/14 20:28:19.752   luup_log:107: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Variables initialized ... <0x2b673680>
50      08/30/14 20:28:19.770   luup_log:107: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2b673680>
50      08/30/14 20:28:19.770   luup_log:107: GCal3 gc_V 0.6.2:/usr/lib/lua/googlejwt.sh  already exists <0x2b673680>
50      08/30/14 20:28:19.789   luup_log:107: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/json.lua returned 0 <0x2b673680>
50      08/30/14 20:28:19.789   luup_log:107: GCal3 gc_V 0.6.2:/usr/lib/lua/json.lua  already exists <0x2b673680>
50      08/30/14 20:28:19.790   luup_log:107: GCal3 gc_V 0.6.2:Function: checkforcredentials <0x2b673680>
50      08/30/14 20:28:19.808   luup_log:107: GCal3 gc_V 0.6.2:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b673680>
50      08/30/14 20:28:19.809   luup_log:107: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Timezone is 1 hrs and 0 min <0x2b673680>
50      08/30/14 20:28:19.809   luup_log:107: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Running Plugin ... <0x2b673680>
06      08/30/14 20:28:19.810   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Successfully Initialized now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b673680>
06      08/30/14 20:28:19.810   Device_Variable::m_szValue_set device: 107 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x

The /etc/cmh-hudl/ doesn't contain the directory GCAL3, there are three files in the dir for Gcal:
GCal3.lua.lzo                       
GCal_II.lua.lzo                       
Gcal3.json.lzo

hope this helps,

Kr,
Hans

Hans --

the log entry
08/30/14 20:28:19.808   luup_log:107: GCal3 gc_V 0.6.2:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b673680>
together with no /etc/cmh-ludl/GCal3 directory
tells me that the code which sets up the credentials did not execute before

the /etc/cmh-ludl/GCal3 directory gets created the first time credentials are created.  This does not occur unless you upload the GCal3.json generated when you setup your google api service account.

Did you do this ?  If not, then this is the reason.  If you did - then there was some sort of problem the last time: upload the file GCal3.json again (you don't need to regenerate it - the original is still good), restart and get the logs. 

Title: Re: GCAL3 - Google Calendar 3
Post by: hansibal on August 30, 2014, 04:38:27 pm
Hi Stuart,

I did do this, but will try again and report back.

Kr,
Hans
Title: Re: GCAL3 - Google Calendar 3
Post by: hansibal on August 30, 2014, 05:03:09 pm
Hi Stuart,

That did get it working, I must have done something wrong in the initial setup. As I started it from the beginning (making new project etc), I can't track down what it was exactly i did wrong, but I suspect the filename to be wrong, Gcal3.json iso GCal3.json (I it case sensitive?)

Anyway, it is working now, i'll be back experimenting :)

Thanks for your help!

Kr,
Hans
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 30, 2014, 09:37:52 pm
Hi Stuart,

That did get it working, I must have done something wrong in the initial setup. As I started it from the beginning (making new project etc), I can't track down what it was exactly i did wrong, but I suspect the filename to be wrong, Gcal3.json iso GCal3.json (I it case sensitive?)

Anyway, it is working now, i'll be back experimenting :)

Thanks for your help!

Kr,
Hans


Yep - case sensitive !   gets me all the time .....

Glad you have it working !!
Title: Re: GCAL3 - Google Calendar 3
Post by: kiethr on August 30, 2014, 09:53:30 pm
Edit: Stuart, I missed a step is the process, my calendar now populates in the calender tab however the app window on the dash board isn't showing the next event in my calendar and doesn't trip on the exact keyword.

Here is the log dealing with the gcal.

09   08/30/14 23:13:58.612   JobHandler_LuaUPnP::Run device 108 GCal3 Sensor room 0 type urn:schemas-srs-com:device:GCal:3 id  parent 0/0xd36398 upnp: 0 <0x2ae29000>

50   08/30/14 23:14:12.574   luup_log:108: GCal3 gc_V 0.6.2:This is device # 108 <0x2b75d680>
06   08/30/14 23:14:12.575   Device_Variable::m_szValue_set device: 108 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Armed was: 1 now: 1 #hooks: 0 upnp: 0 v:0xd79fc8/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.576   Device_Variable::m_szValue_set device: 108 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Tripped was: 0 now: 0 #hooks: 0 upnp: 0 v:0xd79248/NONE duplicate:0 <0x2b75d680>
06   08/30/14 23:14:12.577   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedEvent was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.578   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedID was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.578   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_Value was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.578   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Successfully Initialized now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.579   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.579   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_Interval was: 180 now: 180 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.579   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_StartDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.580   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_EndDelta was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.580   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.581   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_exactKeyword was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.581   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.581   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_triggerNoKeyword was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.581   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreAllDayEvent was: false now: false #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.582   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_retrip was: true now: true #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.582   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_CalendarID was: kiethrumbold@gmail.com now: kiethrumbold@gmail.com #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.582   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.583   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T23:10:22 now: 2014-08-30T23:10:22 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.583   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-08-30T23:01:02 now: 2014-08-30T23:01:02 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.584   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_debug was: 3 now: 3 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.584   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_displaystatus was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
50   08/30/14 23:14:12.584   luup_log:108: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Variables initialized ... <0x2b75d680>
50   08/30/14 23:14:12.602   luup_log:108: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2b75d680>
50   08/30/14 23:14:12.603   luup_log:108: GCal3 gc_V 0.6.2:/usr/lib/lua/googlejwt.sh  already exists <0x2b75d680>
50   08/30/14 23:14:12.622   luup_log:108: GCal3 gc_V 0.6.2:Command ls /usr/lib/lua/json.lua returned 0 <0x2b75d680>
50   08/30/14 23:14:12.622   luup_log:108: GCal3 gc_V 0.6.2:/usr/lib/lua/json.lua  already exists <0x2b75d680>
50   08/30/14 23:14:12.622   luup_log:108: GCal3 gc_V 0.6.2:Function: checkforcredentials <0x2b75d680>
50   08/30/14 23:14:12.641   luup_log:108: GCal3 gc_V 0.6.2:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b75d680>
50   08/30/14 23:14:12.642   luup_log:108: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Timezone is -4 hrs and -0 min <0x2b75d680>
50   08/30/14 23:14:12.642   luup_log:108: GCal3 gc_V 0.6.2:GCal3 gc_V 0.6.2:Running Plugin ... <0x2b75d680>
06   08/30/14 23:14:12.643   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Successfully Initialized now: Successfully Initialized #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>
06   08/30/14 23:14:12.643   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>

50   08/30/14 23:14:14.103   luup_log:61: VeraAlert:61:ProfileInit:Assoc:textalert with:Pushover <0x2c75d680>
06   08/30/14 23:14:14.104   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-08-30T23:10:22 now: 2014-08-30T23:14:14 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2df5d680>
06   08/30/14 23:14:14.105   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2df5d680>
50   08/30/14 23:14:14.105   luup_log:108: GCal3 gc_V 0.6.2:Checking semaphore <0x2df5d680>
50   08/30/14 23:14:14.106   luup_log:108: GCal3 gc_V 0.6.2:Semaphore file returned nil <0x2df5d680>
01   08/30/14 23:14:14.106   LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 0.6.2"..."]:101: /etc/cmh-ludl/GCal3/GCal3.sem: No such file or directory <0x2df5d680>

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on August 30, 2014, 11:42:54 pm
@Kieth

There looks to be two problems.  The first is that there does not seem to be any keyword specified.  gc_Keyword is 'blank'

08/30/14 23:14:12.580   Device_Variable::m_szValue_set device: 108 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b75d680>

But before going any further - this error needs to be resolved
LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 0.6.2"..."]:101: /etc/cmh-ludl/GCal3/GCal3.sem: No such file or directory <0x2df5d680>

This looks identical to the problem that hansibal had.

Try uploading the GCal3.json file again and capturing the log.   The initial credential setup creates the /etc/cmh-ludl/GCal3 directory and that does not exist (as well as the other files that are placed there during the credentials setup).




Title: Re: GCAL3 - Google Calendar 3
Post by: kiethr on August 31, 2014, 11:24:11 am
Thanks for pointing me in the right direction.  I did figure out what the issue was.  When i renamed the json file, I renamed it with the extension therefore getting a file named GCal3.json.json.  Once i corrected that everything else worked great.

Thanks again its a great app.
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on August 31, 2014, 04:44:56 pm
Hi

Just loaded the updated LUA file. Good news is, gc_jsonevents now shows something:

[{'eventEnd':1409490000,'eventStart':1409439600,'eventName':'VACATION'},{'eventEnd':1409521200,'eventStart':1409517600,'eventName':'VACATION'}]

It trips (though it appeared to do that previously), however the PLEG is still not detecting it using the following as an input:

GcalVacation   GCal3 has event with name: VACATION

Any ideas?
Title: Re: GCAL3 - Google Calendar 3
Post by: tyfoon on September 01, 2014, 08:07:50 am
@Stuart: Could it be trailing spaces before/after the event name why PLEG does  not pick it up?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 01, 2014, 11:39:31 am
@Stuart: Could it be trailing spaces before/after the event name why PLEG does  not pick it up?

Possible if there are spaces in the PLEG condition.  I trim whitespace within GCal3 though.

I will take a closer look tomorrow as there are some issues on the vera side around this especially with notifications
Title: Re: GCAL3 - Google Calendar 3
Post by: babas on September 01, 2014, 02:24:08 pm
Hello,

I have found my problem. In the file "Setting up a Google V3 API Service Account.pdf" page 3 line 2 the new name set is "CGal3.json" but the real name for the file is "GCal3.json"( C and G is invert).

thanks for this plugin.

babas
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 01, 2014, 11:56:15 pm
Hello,

I have found my problem. In the file "Setting up a Google V3 API Service Account.pdf" page 3 line 2 the new name set is "CGal3.json" but the real name for the file is "GCal3.json"( C and G is invert).

thanks for this plugin.

babas

Thanks !   I have updated the document
Title: Re: GCAL3 - Google Calendar 3
Post by: lwinter on September 02, 2014, 03:03:35 am
I don't know if I'm on the good topic.
I use GCAL v1 for 2 years and it works well. The plugin is triggered and a scene will be started. For example : "Wake up" on 7:00 (to 7:01) on my Google calendar. The scene "Wake up" will start at 7:00 when "A Calendar Event is Active" with "Wake up" as keyword.
I installed the GCAL3 last week and I don't understand the 5th point in the usage notes :
Quote
If set to false (recommended) then the scene can be specified to react to ?An event has specified name? this does not technically trigger the plugin ? but the event is ?active?.
The device GCAL3 is active at 7:01 and not at 7:00 and no scene will start. I changed the parameters to
Code: [Select]
gc_Keyword = Wake Up;Away
gc_exactKeyword = true
gc_ignoreKeyword = false
gc_triggerNoKeyword = false
gc_ignoreAllDayEvent = false
but the result is the same. How can I trigger a scene with a GCAL3 device ?
Sorry for my english and thanks for your answers.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 12:14:50 pm
Hi,

Moving from the original Gcal to Gcal3 and having some issues with PLEG & GCAL3 I don't get.

I'm reading the gc_Trippedevent variable and using this value as a condition. See below for the PLEG logic.

What I don't get is that all three conditions are true.

Please note that the calendar items do not overlap so only one should be true.


Device Properties
Name   Device Name   Device Variable   Value   Last Change   Previous Change
GcalEvent   GCal3 Sensor   gc_TrippedEvent   KIDSWEG   2014-08-28 06:27:21.102   2014-08-28 06:26:21.789


Conditions
TempKidsWeg   No   GcalEvent=="KIDSWEG"   true   2014-08-26 20:03:18.346   2014-08-26 20:01:51.372
TempKidsWarm   No   GcalEvent=="KIDSWARM"   true   2014-08-26 20:09:23.507   0
TempKidsSlapen   No   GcalEvent=="KIDSSLAPEN"   true   2014-08-26 20:09:23.510   0

I did some tests as follows:
3 events each of 5 minutes, one after the other; TEST1, TEST2 TEST3.

Attributes and results per the attached. Seems to be working as it should.  I.e. the three events last being seen as true by PLEG each separated by 5 minutes.  Is your setup working now ?



Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 12:38:10 pm
I don't know if I'm on the good topic.
I use GCAL v1 for 2 years and it works well. The plugin is triggered and a scene will be started. For example : "Wake up" on 7:00 (to 7:01) on my Google calendar. The scene "Wake up" will start at 7:00 when "A Calendar Event is Active" with "Wake up" as keyword.
I installed the GCAL3 last week and I don't understand the 5th point in the usage notes :
Quote
If set to false (recommended) then the scene can be specified to react to ?An event has specified name? this does not technically trigger the plugin ? but the event is ?active?.
The device GCAL3 is active at 7:01 and not at 7:00 and no scene will start. I changed the parameters to
Code: [Select]
gc_Keyword = Wake Up;Away
gc_exactKeyword = true
gc_ignoreKeyword = false
gc_triggerNoKeyword = false
gc_ignoreAllDayEvent = false
but the result is the same. How can I trigger a scene with a GCAL3 device ?
Sorry for my english and thanks for your answers.

The one minute delay is normal.  I took a very conservative approach to provide a delay between the completion of one event and the start of the next so that other plugins could respond.

An event has specified name -  this does not technically trigger the plugin  -  but the event is "active"
This differentiates between 'triggering' and being able to react to a keyword with "A Calendar Event is Active" but not triggering (from Vera's perspective).  Without this vera would trigger on every event (with no gc_Keyword)

So you can leave gc_Keyword blank and use "A Calendar Event is Active" to "Activate" based on event names you set in your scenes.

How are you setting your scenes ?  Are the conditions set to be upper case ?   All the keywords are changed to upper case within the plugin and the matching conditions therefore need to be in upper case as well.

Title: Re: GCAL3 - Google Calendar 3
Post by: tyfoon on September 02, 2014, 12:39:08 pm
Looking at the screenshot I also see last false in all three occasions was identical and is the time of the last condition. 

If t3 event would still be true,  t1 and t2 would also still be true.

In other words, if you would have made the screenshot within the 5min test3 was active I think you would have seen all three conditions being true.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 01:04:43 pm
Looking at the screenshot I also see last false in all three occasions was identical and is the time of the last condition. 

If t3 event would still be true,  t1 and t2 would also still be true.

In other words, if you would have made the screenshot within the 5min test3 was active I think you would have seen all three conditions being true.

The reason all three have the same 'last false' time is that PLEG evaluates all three conditions whenever one of them changes state.  So this is correct.

Each one became true - sequentially - at the time indicated in the 'last true' column.

I did a rerun (all I did was change the event times).  The first (result2)  is with TEST2 'active' (5 minutes later than TEST1) but with TEST3 yet to occur (it has the old true / false times).
T1 was last true at 10:45:51 but is currently false
T2 became true at 10:52:15 and is true
T3 was last true at 9:31:07 but is currently false

Result 3 shows what it looks like during the 3 minutes when TEST 3 was active

This looks to be correct to me.

Title: Re: GCAL3 - Google Calendar 3
Post by: tyfoon on September 02, 2014, 01:48:11 pm
Cool! Just arrived home.  Will re-test. PS do I need to update any files? I have the version available via the app store
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 02:03:56 pm
Cool! Just arrived home.  Will re-test. PS do I need to update any files? I have the version available via the app store

I'd use the version here - although I did not change anything relating to events,

http://forum.micasaverde.com/index.php/topic,26692.msg190735.html#msg190735
Title: Re: GCAL3 - Google Calendar 3
Post by: lwinter on September 02, 2014, 02:52:10 pm
Quote
An event has specified name -  this does not technically trigger the plugin  -  but the event is "active"
This differentiates between 'triggering' and being able to react to a keyword with "A Calendar Event is Active" but not triggering (from Vera's perspective).  Without this vera would trigger on every event (with no gc_Keyword)

So you can leave gc_Keyword blank and use "A Calendar Event is Active" to "Activate" based on event names you set in your scenes.

How are you setting your scenes ?  Are the conditions set to be upper case ?   All the keywords are changed to upper case within the plugin and the matching conditions therefore need to be in upper case as well.
I leave gc_Keyword, gc_ignoreKeyword = false then true and nothing happen : the scene doesn't start.
The next Event is TEST. My device is active but the scene will not be triggered.
Trigger of the scene :
A calendar event is active
Status ? Module is active
script of the scene :
Code: [Select]
local valeur = luup.variable_get("urn:srs-com:serviceId:GCalIII","gc_TrippedEvent",191)
my_prowl("Value ?", valeur, "", 0)
end
but when I execute the scene manually, it returns on Prowl Value ? TEST
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on September 02, 2014, 05:07:22 pm
Hi Stuart

In your PLEG tests, are you using the device property (as per Tyfoons example) or the "Event has specified name" input method? I have been able to get it to work using the device property mechanism, but not using Event has specified name. Could be I am using that wrong, or expecting it to work in a way that it is not designed? Would be good if you could explain how that should behave in PLEG?

ps - @Tyfoon, I noticed you are using == in your conditions, which is a numerical comparison operator. I think you have to use eq - the string operator. Something to try if it still doesnt work for you.

Cheers
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 05:31:16 pm
Quote
An event has specified name -  this does not technically trigger the plugin  -  but the event is "active"
This differentiates between 'triggering' and being able to react to a keyword with "A Calendar Event is Active" but not triggering (from Vera's perspective).  Without this vera would trigger on every event (with no gc_Keyword)

So you can leave gc_Keyword blank and use "A Calendar Event is Active" to "Activate" based on event names you set in your scenes.

How are you setting your scenes ?  Are the conditions set to be upper case ?   All the keywords are changed to upper case within the plugin and the matching conditions therefore need to be in upper case as well.
I leave gc_Keyword, gc_ignoreKeyword = false then true and nothing happen : the scene doesn't start.
The next Event is TEST. My device is active but the scene will not be triggered.
Trigger of the scene :
A calendar event is active
Status ? Module is active
script of the scene :
Code: [Select]
local valeur = luup.variable_get("urn:srs-com:serviceId:GCalIII","gc_TrippedEvent",191)
my_prowl("Value ?", valeur, "", 0)
end
but when I execute the scene manually, it returns on Prowl Value ? TEST

Keywords are all forced to UPPER CASE in the plugin - so any comparison must be in UPPER CASE as well.  Not shouting  :)  just emphasizing ....

Your example test value is in lower case  :'(
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 05:55:08 pm
Hi Stuart

In your PLEG tests, are you using the device property (as per Tyfoons example) or the "Event has specified name" input method? I have been able to get it to work using the device property mechanism, but not using Event has specified name. Could be I am using that wrong, or expecting it to work in a way that it is not designed? Would be good if you could explain how that should behave in PLEG?

ps - @Tyfoon, I noticed you are using == in your conditions, which is a numerical comparison operator. I think you have to use eq - the string operator. Something to try if it still doesnt work for you.

Cheers

Close but no cigar  ;D -- but a great catch (I had not looked at PLEG for a while)

use the eq operator in PLEG

This screen shot shows both approaches working TEST2 is "active" but the plugin is not "triggered".  So if you wanted to do something based on TEST2, you could use a condition requiring T2 to be true or alternatively c2 (as defined)




Title: Re: GCAL3 - Google Calendar 3
Post by: ndoty on September 02, 2014, 06:38:19 pm
This was mentioned before but when you have more than 1 GCal3 Device it will reload LUUP many many times. I know it was stated that only one Device should be needed since you can specify many keywords. However i need 2 separate devices, one for my work schedule and one for my wifes. I set certain things when we are both away and certain things when both or one are home. I have everything working as i want just if i change a setting in the device it will reload luup for each GCal3 device it seems, sometimes more.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 02, 2014, 10:48:54 pm
This was mentioned before but when you have more than 1 GCal3 Device it will reload LUUP many many times. I know it was stated that only one Device should be needed since you can specify many keywords. However i need 2 separate devices, one for my work schedule and one for my wifes. I set certain things when we are both away and certain things when both or one are home. I have everything working as i want just if i change a setting in the device it will reload luup for each GCal3 device it seems, sometimes more.

Please see the earlier posts.  This has been solved - you need the version posted here.  It will be a few days before I get it to the marketplace.
http://forum.micasaverde.com/index.php/topic,26692.msg190735.html#msg190735
Title: Re: GCAL3 - Google Calendar 3
Post by: lwinter on September 03, 2014, 01:00:47 am
Quote

Keywords are all forced to UPPER CASE in the plugin - so any comparison must be in UPPER CASE as well.  Not shouting  :)  just emphasizing ....

Your example test value is in lower case  :'(

I do not have to be gifted  ???
You mean "Nom de ce d?clencheur:" must be in upper case ? Others keywords are in upper case in my example.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 03, 2014, 09:43:04 am
Quote

Keywords are all forced to UPPER CASE in the plugin - so any comparison must be in UPPER CASE as well.  Not shouting  :)  just emphasizing ....

Your example test value is in lower case  :'(

I do not have to be gifted  ???
You mean "Nom de ce d?clencheur:" must be in upper case ? Others keywords are in upper case in my example.

Pardon -- Je lis pas francais

In your code the value of 'valeur' would be TEST
but I do not see you making the comparison for the string literal TEST
what is the function my_prowl doing ?  Also "Value ?" looks a little strange

local valeur = luup.variable_get("urn:srs-com:serviceId:GCalIII","gc_TrippedEvent",191)
my_prowl("Value ?", valeur, "", 0)
end

Wait - I see the problem ....   you are initiating your scene with "A Calendar event is active" - in which case you have to specify the keyword in the advanced tab in gc_Keyword.
That wording ought to be changed to something like "A Calendar event has satisfied a Keyword" .....
The option to set gc_Keyword blank and the calendar being thought of as "Active" but not "Triggered" relates to the initiation possibility of "An event has a specified name"

I'll make an appropriate change to try an avoid confusion in the future.

Title: Re: GCAL3 - Google Calendar 3
Post by: lwinter on September 03, 2014, 02:23:49 pm
Wait - I see the problem ....   you are initiating your scene with "A Calendar event is active" - in which case you have to specify the keyword in the advanced tab in gc_Keyword.
That wording ought to be changed to something like "A Calendar event has satisfied a Keyword" .....
The option to set gc_Keyword blank and the calendar being thought of as "Active" but not "Triggered" relates to the initiation possibility of "An event has a specified name"

I'll make an appropriate change to try an avoid confusion in the future.

That's right !! I specified a keyword (TEST in my example) in gc_Keyword and the scene will be triggered with "A Calendar event is active".
Thanks for your help !!
Title: Re: GCAL3 - Google Calendar 3
Post by: tyfoon on September 03, 2014, 02:56:06 pm
ps - @Tyfoon, I noticed you are using == in your conditions, which is a numerical comparison operator. I think you have to use eq - the string operator. Something to try if it still doesnt work for you.

Correct! I also noticed this after I posted. However this was not the solution. I now used Stuarts method and not the device properties anymore. Now it seems to be working!
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 03, 2014, 07:52:12 pm
ps - @Tyfoon, I noticed you are using == in your conditions, which is a numerical comparison operator. I think you have to use eq - the string operator. Something to try if it still doesnt work for you.

Correct! I also noticed this after I posted. However this was not the solution. I now used Stuarts method and not the device properties anymore. Now it seems to be working!

Device Properties should work equally well - as I showed in the earlier post. At some point it's a matter of preference .....   but .... " if it isn't broken"  .... :o
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 04, 2014, 10:19:34 am
@ Duiffie
Wow!   I have a vera light and do not know if there is supposed to be a difference.

The reason I went that route is because vera does not have a lua module that would otherwise be used.  So I assumed that the *nix libraries would be the safest approach.......

I'll send an email to vera support and ask.  It may be a simple opt install -  if so we can do that manually and later I can pout a check in the plugin.

I did 2 things and then things started to work:
- installed openssl: opkg install openssl-util
- changed the first line of the googlejwt.sh script (#!/bin/bash to #!/bin/ash) because bash seems not present on vera 2 as well

Hi Duiffie -

Could you do me a favor and tell me what version of openssl was installed ?

MCV have suggested a version to install (but not specifically identified for vera 2 - just 'try it') -- and their suggestion is different (newer) than on my vera light.  So I want to be a bit cautious here ....
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on September 06, 2014, 05:09:35 pm
Hi Stuart

Is there some way to trigger overlapping events in PLEG? I have been able to get one to work using "Event with name" but it does not trigger on a second overlapping event. According to the manual
"1. If events overlap ? then the first event will complete before the second event starts i.e. the second event will have an effective start time at the end of the first event.", which I take to mean no, but I wanted to check as they show up in json events with a time, so I was hoping this could be possible. I was hoping to use the plugin for heating and other things, but there will almost inevitably be overlapping events.

Thanks
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 06, 2014, 07:16:55 pm
Hi Stuart

Is there some way to trigger overlapping events in PLEG? I have been able to get one to work using "Event with name" but it does not trigger on a second overlapping event. According to the manual
"1. If events overlap ? then the first event will complete before the second event starts i.e. the second event will have an effective start time at the end of the first event.", which I take to mean no, but I wanted to check as they show up in json events with a time, so I was hoping this could be possible. I was hoping to use the plugin for heating and other things, but there will almost inevitably be overlapping events.

Thanks

There is some good documentation on PLEG in one of the PLEG forums.

Yes - the documentation (and your interpretation) is correct - the devise only contemplates one event at a time.

One thing to remember is that events have a start (which you can do something on .. or not) and a finish (which you can do something on ... or not).  PLEG makes it easier to tease out the logic and get finer control than out-of-the-box vera

One way to approach what you want to do is leave gc_Keywords blank and use PLEG to react to the event names as they occur.

So you could (for example) have a short (say 5 min) event for "Heat On" and another separate event some time later for "Heat Off" -- with other events in between ......   Or maybe short event for Heat {22} and another later on for Heat {15} to change the temp to specified levels .   (Temp in Celsius).

You can also have multiple plugin instances looking at the same (or different calendars) and by using keywords - handle overlaps in this way too.  Note that the vera has limited memory resources and you should be selective in the idea of multiple plugin instances.

And yes - you could read the event list and set up  your own logic around that too -- that' what it's there for :-)

Hope this gives you some ideas
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on September 06, 2014, 07:48:25 pm
Ok thanks I have been trying it with the keywords option so will have a play without it. Am wary of more instances as I have had some memory issues.

Cheers
Title: Re: GCAL3 - Google Calendar 3
Post by: mda on September 06, 2014, 11:30:51 pm
Hi @Stuart,

Is there any way Gcal3 can detect and trip a different sensor (or triggers scenes) when overlapping events with different keywords each start and end?

My use case for this would be to have one google calendar which contains an event called Wake_Up repeating every day at 7am and other event called Vacation that would run for a week, overlapping a bunch of Wake_Up events. My logic would be not to trigger the Wake_Up event if the Vacation event is in progress.

(apologies if this has been asked and answered already... i searched for "overlap" in this thread and came up empty)

Thanks !
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 06, 2014, 11:57:00 pm
Hi @Stuart,

Is there any way Gcal3 can detect and trip a different sensor (or triggers scenes) when overlapping events with different keywords each start and end?

My use case for this would be to have one google calendar which contains an event called Wake_Up repeating every day at 7am and other event called Vacation that would run for a week, overlapping a bunch of Wake_Up events. My logic would be not to trigger the Wake_Up event if the Vacation event is in progress.

(apologies if this has been asked and answered already... i searched for "overlap" in this thread and came up empty)

Thanks !

I have a 'one word' answer ....... PLEG.   It's the 'swiss army knife' of the vera world and means that plugins like GCal don't need to be nearly as complicated as they might otherwise be.  It can easily do the sort of thing you describe --  from a GCal3  perspective, you will probably leave gc_keyword blank and use PLEG to respond to gc_TrippedEvent values.

I have similar requirements and find PLEG to be invaluable.  It takes a bit of effort to understand some of the 'tricky' stuff (e.g. state sequences) but well worth it ....
Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 07, 2014, 03:49:39 am
My calendar shows up in the calendar tab, but calendar events don't show up on the device to be used as triggers.  Pressing 'check' on the control tab just leads to 'checking...' forever.
Any idea how I can fix this, please?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 07, 2014, 12:54:40 pm
My calendar shows up in the calendar tab, but calendar events don't show up on the device to be used as triggers.  Pressing 'check' on the control tab just leads to 'checking...' forever.
Any idea how I can fix this, please?

It's probably a credentials issue.   Please set gc_debug to 3 and get a log

Also - make sure you have applied the patch here as it has a little more debugging

http://forum.micasaverde.com/index.php/topic,26692.msg190735.html#msg190735
Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 07, 2014, 11:42:08 pm
50   09/08/14 13:38:00.102   luup_log:303: GCal3 gc_V 0.6.2:Checking semaphore <0x31862680>
50   09/08/14 13:38:00.103   luup_log:303: GCal3 gc_V 0.6.2:Semaphore file returned 0 <0x31862680>
50   09/08/14 13:38:00.123   luup_log:303: GCal3 gc_V 0.6.2:Device 303 requested semaphore <0x31862680>
50   09/08/14 13:38:00.124   luup_log:303: GCal3 gc_V 0.6.2:Device 303 claimed semaphore <0x31862680>
50   09/08/14 13:38:00.126   luup_log:303: GCal3 gc_V 0.6.2:StartMin is 2014-09-08T00:00:00.000Z StartMax is 2014-09-09T06:38:00.000Z <0x31862680>
50   09/08/14 13:38:00.140   luup_log:303: GCal3 gc_V 0.6.2:Function: requestCalendar <0x31862680>
50   09/08/14 13:38:00.144   luup_log:303: GCal3 gc_V 0.6.2:Getting new token <0x31862680>
50   09/08/14 13:38:00.145   luup_log:303: GCal3 gc_V 0.6.2:Client email is: 634xxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com <0x31862680>
50   09/08/14 13:38:00.186   luup_log:303: GCal3 gc_V 0.6.2:Command rm /etc/cmh-ludl/GCal3/GCal3303.token returned 256 <0x31862680>
50   09/08/14 13:38:00.205   luup_log:303: GCal3 gc_V 0.6.2:Command /usr/lib/lua/googlejwt.sh 634xxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3303.token returned 32512 <0x31862680>
50   09/08/14 13:38:00.205   luup_log:303: GCal3 gc_V 0.6.2:Could not execute the googlejwt.sh script <0x31862680>
50   09/08/14 13:38:00.206   luup_log:303: GCal3 gc_V 0.6.2:Fatal error trying to get access token <0x31862680>
50   09/08/14 13:38:00.206   luup_log:303: GCal3 gc_V 0.6.2:Device 303 released the semaphore <0x31862680>
50   09/08/14 13:38:00.208   luup_log:303: GCal3 gc_V 0.6.2:Next check will be in 10800 sec at 2014-09-08T16:38:00 <0x31862680>

I replaced my gmail email addy with a few xxxx's, but otherwise I  hope that's what you need.  I used the updated file too.
Thanks.
Title: Re: GCAL3 - Google Calendar 3
Post by: Borat on September 08, 2014, 04:16:25 am
Hi Stuart

Is there some way to trigger overlapping events in PLEG? I have been able to get one to work using "Event with name" but it does not trigger on a second overlapping event. According to the manual
"1. If events overlap ? then the first event will complete before the second event starts i.e. the second event will have an effective start time at the end of the first event.", which I take to mean no, but I wanted to check as they show up in json events with a time, so I was hoping this could be possible. I was hoping to use the plugin for heating and other things, but there will almost inevitably be overlapping events.

Thanks

There is some good documentation on PLEG in one of the PLEG forums.

Yes - the documentation (and your interpretation) is correct - the devise only contemplates one event at a time.

One thing to remember is that events have a start (which you can do something on .. or not) and a finish (which you can do something on ... or not).  PLEG makes it easier to tease out the logic and get finer control than out-of-the-box vera

One way to approach what you want to do is leave gc_Keywords blank and use PLEG to react to the event names as they occur.

So you could (for example) have a short (say 5 min) event for "Heat On" and another separate event some time later for "Heat Off" -- with other events in between ......   Or maybe short event for Heat {22} and another later on for Heat {15} to change the temp to specified levels .   (Temp in Celsius).

You can also have multiple plugin instances looking at the same (or different calendars) and by using keywords - handle overlaps in this way too.  Note that the vera has limited memory resources and you should be selective in the idea of multiple plugin instances.

And yes - you could read the event list and set up  your own logic around that too -- that' what it's there for :-)

Hope this gives you some ideas

Hi Stuart

The problem is, I can not see the overlapping event even in the advanced variables of the GCAL device, except in gc_jsonevents. For example, I set up 2 overlapping events and this is what I see (at a time when both are active). As PLEG can not extract the info on the second, I can not do anything with it in PLEG either. What am I missing here? gc_keyword is blank. All other config settings are set to false at the moment.

gc_jsonEvents: [{'eventEnd':1410166080,'eventStart':1410162480,'eventName':'TEST1'},{'eventEnd':1410166200,'eventStart':1410162600,'eventName':'VACATION'}]

gc_TrippedEvent: TEST1

Thanks
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 08, 2014, 01:57:56 pm

The problem is, I can not see the overlapping event even in the advanced variables of the GCAL device, except in gc_jsonevents. For example, I set up 2 overlapping events and this is what I see (at a time when both are active). As PLEG can not extract the info on the second, I can not do anything with it in PLEG either. What am I missing here? gc_keyword is blank. All other config settings are set to false at the moment.

gc_jsonEvents: [{'eventEnd':1410166080,'eventStart':1410162480,'eventName':'TEST1'},{'eventEnd':1410166200,'eventStart':1410162600,'eventName':'VACATION'}]

gc_TrippedEvent: TEST1

Thanks

I had considered providing separate variables for overlapping events -- but 'how many'?  Inevitably 'someone' will want 'more' .....   ;D  Also there is a problem as events unfold - what variable relates to what event ......

Instead I created a single variable gc_jsonEvents so that others could manipulate to their heart's content.  Not ideal but ......
Here's some sample code to decode the gc_jsonEvents variable.  The idea would be to write a custom Luup script to do what you want or use it to set variables in one of the 'container' plugins  which could then be used by PLEG.   A bit 'round about' but .....

The other approach, as stated earlier, is to use separate non overlapping events with parameters  and PLEG to manage the respective conditions e.g.   c1 => TEST and gc_value eq "On",  c2 => TEST gc_value eq "Off", c3 => VACATION and gc_value eq "Start",  c4 =VACATION and gc_value eq "End"

Code: [Select]
function getjsonEvents() -- this is really some sample code and useful for debugging
local json = require"json")
  local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",lul_device)

  if (jsonEvents == "[]") then -- equivalent of a nul so don't try
    package.loaded.json = nil
    return
  end

  local eventList =json.decode(jsonEvents)
  local numberEvents = table.getn(eventList)
  local startevent, startDate, startTime, endevent, endTime, eventname, event
  for i = 1,numberEvents do
    startevent = eventList[i].eventStart
    --startEvent = os.date("%Y-%m-%dT%H:%M:%S",startevent)
    startDate = os.date("%Y-%m-%d", startevent)
    startTime = os.date("%H:%M:%S", startevent)
    endevent = eventList[i].eventEnd
    endTime = os.date("%H:%M:%S", endevent)
    eventname = eventList[i].eventName
    event = "On " .. startDate .. " event " .. eventname .. " will start at " .. startTime .. " and end at " .. endTime
    print("Event " .. i .. ": " .. event)
  end
  package.loaded.json = nil
  return
end

Hope this gives you a better set of options.  For now - there are is no overlapping event handling.  I may add some in the future but it still needs a good design that is not convoluted and for now - I do not have time; especially since my Vera os 'bricked'   :-\ .
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 08, 2014, 09:11:07 pm
50   09/08/14 13:38:00.102   luup_log:303: GCal3 gc_V 0.6.2:Checking semaphore <0x31862680>
50   09/08/14 13:38:00.103   luup_log:303: GCal3 gc_V 0.6.2:Semaphore file returned 0 <0x31862680>
50   09/08/14 13:38:00.123   luup_log:303: GCal3 gc_V 0.6.2:Device 303 requested semaphore <0x31862680>
50   09/08/14 13:38:00.124   luup_log:303: GCal3 gc_V 0.6.2:Device 303 claimed semaphore <0x31862680>
50   09/08/14 13:38:00.126   luup_log:303: GCal3 gc_V 0.6.2:StartMin is 2014-09-08T00:00:00.000Z StartMax is 2014-09-09T06:38:00.000Z <0x31862680>
50   09/08/14 13:38:00.140   luup_log:303: GCal3 gc_V 0.6.2:Function: requestCalendar <0x31862680>
50   09/08/14 13:38:00.144   luup_log:303: GCal3 gc_V 0.6.2:Getting new token <0x31862680>
50   09/08/14 13:38:00.145   luup_log:303: GCal3 gc_V 0.6.2:Client email is: 634xxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com <0x31862680>
50   09/08/14 13:38:00.186   luup_log:303: GCal3 gc_V 0.6.2:Command rm /etc/cmh-ludl/GCal3/GCal3303.token returned 256 <0x31862680>
50   09/08/14 13:38:00.205   luup_log:303: GCal3 gc_V 0.6.2:Command /usr/lib/lua/googlejwt.sh 634xxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3303.token returned 32512 <0x31862680>
50   09/08/14 13:38:00.205   luup_log:303: GCal3 gc_V 0.6.2:Could not execute the googlejwt.sh script <0x31862680>
50   09/08/14 13:38:00.206   luup_log:303: GCal3 gc_V 0.6.2:Fatal error trying to get access token <0x31862680>
50   09/08/14 13:38:00.206   luup_log:303: GCal3 gc_V 0.6.2:Device 303 released the semaphore <0x31862680>
50   09/08/14 13:38:00.208   luup_log:303: GCal3 gc_V 0.6.2:Next check will be in 10800 sec at 2014-09-08T16:38:00 <0x31862680>

I replaced my gmail email addy with a few xxxx's, but otherwise I  hope that's what you need.  I used the updated file too.
Thanks.

Hi - which vera model are you using ?

Try uploading GCAL3.json file again and capturing the start of the GCAL3 log sequence.
Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 08, 2014, 09:44:42 pm
Thanks for looking, it's a Vera 3

50   09/09/14 11:42:01.102   luup_log:304: GCal3 gc_V 0.6.2:Checking semaphore <0x31738680>
50   09/09/14 11:42:01.105   luup_log:304: GCal3 gc_V 0.6.2:Semaphore file returned 0 <0x31738680>
50   09/09/14 11:42:01.105   luup_log:304: GCal3 gc_V 0.6.2:Device 304 requested semaphore <0x31738680>
50   09/09/14 11:42:01.106   luup_log:304: GCal3 gc_V 0.6.2:Device 304 claimed semaphore <0x31738680>
50   09/09/14 11:42:01.107   luup_log:304: GCal3 gc_V 0.6.2:StartMin is 2014-09-09T00:00:00.000Z StartMax is 2014-09-10T04:42:01.000Z <0x31738680>
50   09/09/14 11:42:01.182   luup_log:304: GCal3 gc_V 0.6.2:Function: requestCalendar __LEAK__ this:212992 start:1032192 to 0x16aa000 <0x31738680>
50   09/09/14 11:42:01.182   luup_log:304: GCal3 gc_V 0.6.2:Getting new token <0x31738680>
50   09/09/14 11:42:01.183   luup_log:304: GCal3 gc_V 0.6.2:Client email is: 634xxxxxxxxxxxxxxx@developer.gserviceaccount.com <0x31738680>
50   09/09/14 11:42:01.205   luup_log:304: GCal3 gc_V 0.6.2:Command rm /etc/cmh-ludl/GCal3/GCal3304.token returned 256 <0x31738680>
50   09/09/14 11:42:01.223   luup_log:304: GCal3 gc_V 0.6.2:Command /usr/lib/lua/googlejwt.sh 634xxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3304.token returned 32512 <0x31738680>
50   09/09/14 11:42:01.224   luup_log:304: GCal3 gc_V 0.6.2:Could not execute the googlejwt.sh script <0x31738680>
50   09/09/14 11:42:01.224   luup_log:304: GCal3 gc_V 0.6.2:Fatal error trying to get access token <0x31738680>
50   09/09/14 11:42:01.225   luup_log:304: GCal3 gc_V 0.6.2:Device 304 released the semaphore __LEAK__ this:4096 start:1036288 to 0x16ab000 <0x31738680>
06   09/09/14 11:42:01.226   Device_Variable::m_szValue_set device: 304 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-09-09T14:40:50 now: 2014-09-09T14:42:01 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x31738680>
50   09/09/14 11:42:01.227   luup_log:304: GCal3 gc_V 0.6.2:Next check will be in 10800 sec at 2014-09-09T14:42:01 <0x317
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 08, 2014, 11:45:37 pm
Thanks for looking, it's a Vera 3

50   09/09/14 11:42:01.102   luup_log:304: GCal3 gc_V 0.6.2:Checking semaphore <0x31738680>
50   09/09/14 11:42:01.105   luup_log:304: GCal3 gc_V 0.6.2:Semaphore file returned 0 <0x31738680>
50   09/09/14 11:42:01.105   luup_log:304: GCal3 gc_V 0.6.2:Device 304 requested semaphore <0x31738680>
50   09/09/14 11:42:01.106   luup_log:304: GCal3 gc_V 0.6.2:Device 304 claimed semaphore <0x31738680>
50   09/09/14 11:42:01.107   luup_log:304: GCal3 gc_V 0.6.2:StartMin is 2014-09-09T00:00:00.000Z StartMax is 2014-09-10T04:42:01.000Z <0x31738680>
50   09/09/14 11:42:01.182   luup_log:304: GCal3 gc_V 0.6.2:Function: requestCalendar __LEAK__ this:212992 start:1032192 to 0x16aa000 <0x31738680>
50   09/09/14 11:42:01.182   luup_log:304: GCal3 gc_V 0.6.2:Getting new token <0x31738680>
50   09/09/14 11:42:01.183   luup_log:304: GCal3 gc_V 0.6.2:Client email is: 634xxxxxxxxxxxxxxx@developer.gserviceaccount.com <0x31738680>
50   09/09/14 11:42:01.205   luup_log:304: GCal3 gc_V 0.6.2:Command rm /etc/cmh-ludl/GCal3/GCal3304.token returned 256 <0x31738680>
50   09/09/14 11:42:01.223   luup_log:304: GCal3 gc_V 0.6.2:Command /usr/lib/lua/googlejwt.sh 634xxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com  https://www.googleapis.com/auth/calendar /etc/cmh-ludl/GCal3/GCal3.pem /etc/cmh-ludl/GCal3/GCal3304.token returned 32512 <0x31738680>
50   09/09/14 11:42:01.224   luup_log:304: GCal3 gc_V 0.6.2:Could not execute the googlejwt.sh script <0x31738680>
50   09/09/14 11:42:01.224   luup_log:304: GCal3 gc_V 0.6.2:Fatal error trying to get access token <0x31738680>
50   09/09/14 11:42:01.225   luup_log:304: GCal3 gc_V 0.6.2:Device 304 released the semaphore __LEAK__ this:4096 start:1036288 to 0x16ab000 <0x31738680>
06   09/09/14 11:42:01.226   Device_Variable::m_szValue_set device: 304 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-09-09T14:40:50 now: 2014-09-09T14:42:01 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x31738680>
50   09/09/14 11:42:01.227   luup_log:304: GCal3 gc_V 0.6.2:Next check will be in 10800 sec at 2014-09-09T14:42:01 <0x317
The problem is clearly that the  googlejwt.sh script is not creating a token file .   The script (I must admit) has minimal debug / error collection messages - something on my list of things to do.   Having said that, I've not had it fail with a valid GCal3.json file.

Unfortunately - my vera is bricked and I cannot create a better set of instrumented and vera tested code at he moment ..

Do you have SSH or WINSCP access to your vera ?  If so - can you look for the following:

Does the file 'bash' exist in the /bin directory.  What does 'ls -l /bin/bash' report ?

What files are in the /etc/cmh-ludl/GCal3 directory ?




Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 09, 2014, 02:38:19 am
The problem is clearly that the  googlejwt.sh script is not creating a token file .   The script (I must admit) has minimal debug / error collection messages - something on my list of things to do.   Having said that, I've not had it fail with a valid GCal3.json file.
I recreated a new one with a new projectid, (you can't use 'g3plugin', it seems to have to be unique each time), and tried again, uploading a new .json and giving it permission in the calendar, but no luck.

Quote
Unfortunately - my vera is bricked and I cannot create a better set of instrumented and vera tested code at he moment ..

That's a bummer!  Hope that doesn't happen too regularly!
Quote
Do you have SSH or WINSCP access to your vera ?


I do now! :)
Quote
If so - can you look for the following:

Does the file 'bash' exist in the /bin directory.  What does 'ls -l /bin/bash' report ?

What files are in the /etc/cmh-ludl/GCal3 directory ?

Here's some pics rather than trying to describe them:
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 09, 2014, 04:06:44 pm

Here's some pics rather than trying to describe them:

Ok - so this looks basically correct, except of course that there is no token.json file being created.  it could be an issue with the GCal3.pem file, but I'd still expect to see the token file created with some errors reported.

Lets try the following in order:
1.  what does ls -l /usr/lib/lua/googlejtw.sh  report ?   There may be a permission problem .....
2.  replace the existing version of googlejwt.sh with the attached into the directory /usr/lib/lua.  Then do chmod 777 /usr/lib/lua/googlejwt.sh
3. run the plugin again and get the output of the file /etc/cmh-ludl/GCal3/error.log - this should tell us where it's blowing up

PS - you do not have to recreate a new project in the developers console -- you just need to go to the existing project --> Credentials and then for your service account select "Generate new JSON key"  that way your permissions in the calendar do not need to be changed

Attachment removed

Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 09, 2014, 08:02:24 pm

Lets try the following in order:
1.  what does ls -l /usr/lib/lua/googlejtw.sh  report ?   There may be a permission problem
I presume that's a typo and you mean jwt, not jtw, but just in case I'll mention it.
Quote
2.  replace the existing version of googlejwt.sh with the attached into the directory /usr/lib/lua.  Then do chmod 777 /usr/lib/lua/googlejwt.sh
3. run the plugin again and get the output of the file /etc/cmh-ludl/GCal3/error.log - this should tell us where it's blowing up

I don't have an error.log, but attached are the other steps

Quote
PS - you do not have to recreate a new project in the developers console -- you just need to go to the existing project --> Credentials and then for your service account select "Generate new JSON key"  that way your permissions in the calendar do not need to be changed

Ok, thanks, was just trying again from scratch in case I screwed something up. :)
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 09, 2014, 11:27:18 pm
@ conchordian

ok - lets try steps 2 and 3 again with this file .......  the previous one got converted to a windows style file (CR/LF on line end) when I copied it over from my linux box (LF) where I tested the changes.   This causes problems when trying to execute on a linux box .......  So that's probably why it failed to get an error.log file.

Attachment Removed
Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 09, 2014, 11:47:43 pm
@Stuart

Still no error.log file, I'm afraid.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 10, 2014, 01:33:57 am
@Stuart

Still no error.log file, I'm afraid.

Hmm - ok, lets do it the basic way. There is something definitely getting in the way of the script executing - and it's not obvious ....

Here is a test file - you will need to edit it by entering your google service account where the [] are.  i.e. you need it to look like the arguments passed by the plugin when it tries to execute

/usr/lib/lua/googlejwt.sh 634xxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com   ...........

Edit this file (making sure it's saved as a unix file type (I used notepad++ and make sure you set Edit--> EOL COnversion --> Unix Format)
copy it to the  /usr/lib/lua directory
chmod 777 /usr/lib/lua/testjwt.sh
then execute it /usr/lib/lua/testjwt.sh

and lets see what the console output is.

Attachment Removed

Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 10, 2014, 02:05:49 am
Edit this file (making sure it's saved as a unix file type (I used notepad++ and make sure you set Edit--> EOL COnversion --> Unix Format)

That's greyed out in my Notepad++, but I went to 'save as' and saved as a UNIX file.

I wasn't sure whether to replace the [] or paste inside, but the result was the same:
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 10, 2014, 12:36:52 pm
Edit this file (making sure it's saved as a unix file type (I used notepad++ and make sure you set Edit--> EOL COnversion --> Unix Format)

That's greyed out in my Notepad++, but I went to 'save as' and saved as a UNIX file.

I wasn't sure whether to replace the [] or paste inside, but the result was the same:

This will get us closer - there was a typo in the googlejwt.sh file - basically asking to use a shell  that does not exist.  Also,   probably why the the blank lines are - trying to be interpreted as commands ......

I've made 2 changes - fixed the type and removed any blank lines.

Your service account email should replace the [] (including the brackets) - not inside.

So - as before .....   (sorry this is so tedious) ...  must get my vera fixed ......

1) modify testjwt.sh with your service email
2) copy both these files to /usr/lib/lua
3)chmod 777 /usr/lib/lua/testjwt.sh    and  chmod 777 /usr/lib/lua/googlejwt.sh
4) /usr/lib/lua/testjwt.sh  and hopfully (this time) we will get a token.json and an error.log file in /etc/cmh-ludl/GCal3


 Edit: removed attachments


Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 10, 2014, 09:09:59 pm
So - as before .....   (sorry this is so tedious) ...  must get my vera fixed ......

Not at all, thanks for persevering. :)

The events are showing up now, thanks, but there's some odd behaviour.  The event shows up, but the light doesn't come on for a minute or so, and it doesn't trigger scenes.  I've tried using the event names, and armed (yes, it's armed on the device), but it won't trigger.

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 10, 2014, 11:10:47 pm
So - as before .....   (sorry this is so tedious) ...  must get my vera fixed ......

Not at all, thanks for persevering. :)

The events are showing up now, thanks, but there's some odd behaviour.  The event shows up, but the light doesn't come on for a minute or so, and it doesn't trigger scenes.  I've tried using the event names, and armed (yes, it's armed on the device), but it won't trigger.

This is good news.  I deliberately have a 1 minute delay (on the current version) before an event start time and the event actually being 'on'.  This was to allow plenty of time for other plugins to see off to on transitions e.g. the end of a prior event and the start of the next.  From my testing, it looke like I can safely pull this back to 15 sec - but that's for the next code drop ....

As you have your system setup - the trigger you have defined is looking for a 'tripped' event.  For that to happen, you need to define a keyword in gc_Keyword.   With your definitions as they are (i.e. no keyword) you could look for an 'active' event in which case you need to set the trigger to look for "A calendar event is active" and tell it what event name to recognize ( all caps).

Try it either way :-)
Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on September 11, 2014, 12:45:01 am
This is good news.  I deliberately have a 1 minute delay (on the current version) before an event start time and the event actually being 'on'.  This was to allow plenty of time for other plugins to see off to on transitions e.g. the end of a prior event and the start of the next.  From my testing, it looke like I can safely pull this back to 15 sec - but that's for the next code drop ....

Ah ha, that makes sense.

Quote
As you have your system setup - the trigger you have defined is looking for a 'tripped' event.  For that to happen, you need to define a keyword in gc_Keyword.   With your definitions as they are (i.e. no keyword) you could look for an 'active' event in which case you need to set the trigger to look for "A calendar event is active" and tell it what event name to recognize ( all caps).

Cheers, as soon as I filled out the gc_Keyword, it tripped properly after a minute.

Thanks very much for your hard work. :)
Title: Overlapping Events
Post by: Stuart on September 16, 2014, 08:44:07 pm
For those who have asked about overlapping events - I've added some support that I hope will satisfy most.  It will be release via the marketplace in a couple of days.
I've added two new variables
The first is a simple comma delimited list of any overlapping / nested events.  This will just be the event names without any parameters.   Richard Schaefer will be adding a string operator for approximately equal  ... i.e. partial match to PLEG and that would allow a PLEG trigger to detect events based on this variable.  This could also be used with Luup / Lua code.
The second is a json encoded variable which is the event names as well as any associated parameters.  This would be for more advances use cases and require Luup / Lua.

So this post is just a 'heads up'  more details will be provided with the release notes
Title: Re: GCAL3 - Google Calendar 3 (Unit Busy)
Post by: guest141575 on September 17, 2014, 03:56:56 am
I've upgraded from GCal II to GCal 3.

Now, whenever Vera needs to make a reload it will take like ages. I have 4 defined calendar devices. The reload happens an arbitrary number of times, typically 4 times in a row. It says "Unit Busy", then it says "Running LUA Startup" or "Starting LUA Engine". Then it starts with "Unit Busy" and so on..  Before it was only a single cycle.

I had a long flight delay and was able to put in and test some semaphore code that should prevent this from happening.  It forces a staggered calendar refresh between instances of the plugin.

 The problem looked to be due to simultaneous https requests - but that's a bit speculative.  Can you try this version and let me know?  I could not get it to 'break' running two plugins at the same time trying for the same calendar ..... 

Attachment removed ...  had a bug

Stuart,

I had GCal 3 installed once again for testing if there was any improvements in reloading time. First I got version 0.6 installed and reloading time for Vera was timed to 2 minutes and 15 secs. After looking around I found version 0.6.2 and now Vera reloads in less than 15 seconds. Good work Stuart! Thank You.  ;D
Title: Re: GCAL3 - Google Calendar 3
Post by: mulb on September 17, 2014, 05:57:22 am
Hello all,

I'm trying to replace my old Gcal by this new one.
When I configure, sometimes it works, and sometimes, when I reboot the plugins just indicates
"successfully initialized", with no other info.

I can see the calendar in the calendar tab, but even with an event it does not turn the light on.

what can I do?

Mulb
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 17, 2014, 09:50:48 am
Hello all,

I'm trying to replace my old Gcal by this new one.
When I configure, sometimes it works, and sometimes, when I reboot the plugins just indicates
"successfully initialized", with no other info.

I can see the calendar in the calendar tab, but even with an event it does not turn the light on.

what can I do?

Mulb

Google's V3 credential requirements added a degree of complexity as there are more moving parts.  I've been adding more debug messages as we encounter different situations.  Also - there are differences between vera models (at least Vera 2) which get in the way.

Try downloading these two files (these will be released in the marketplace in a day or so).  There is more 'on screen' messaging and more debug logging.  The best way to debug is to set gc_debug to 3 and look at the log files (I use info viewer - see link on page 1)

EDIT
Removed attachments
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 18, 2014, 12:43:05 pm

I can see the calendar in the calendar tab, but even with an event it does not turn the light on.

what can I do?

Mulb

Do you have a keyword set ?  Exact match ?  No keyword set ?  etc.   There are many more options in this version than the old, original gcal.   They are spelled out in the documentation but the intent was that the defaults should provide the same behavior as the old gcal.

Let me know how it's going - it looks like you've downloaded the latest version.
Title: Version 0.7 Released in Marketplace
Post by: Stuart on September 20, 2014, 09:05:32 pm
Version 0.7 Released

Please see release notes on page 1
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 24, 2014, 06:36:41 am
When is gc_NextEvent set to "No events for the next 24 hrs" and when is it set to "No events for today"?

I have two calendars both of them with no events scheduled for the next 24 hours but gc_NextEvent is set to "No events for the next 24 hrs" in one of them and "No events for today" on the other.

In a PLEG, a condition needs to evaluate if there are any events for the current day and I wonder if
Code: [Select]
pNextEvent ne "No events for today" would do the trick or not. pNextEvent is a device property on calender device variable gc_NextEvent

 ;D ;D ;D
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 24, 2014, 12:19:37 pm
When is gc_NextEvent set to "No events for the next 24 hrs" and when is it set to "No events for today"?

I have two calendars both of them with no events scheduled for the next 24 hours but gc_NextEvent is set to "No events for the next 24 hrs" in one of them and "No events for today" on the other.

In a PLEG, a condition needs to evaluate if there are any events for the current day and I wonder if
Code: [Select]
pNextEvent ne "No events for today" would do the trick or not. pNextEvent is a device property on calender device variable gc_NextEvent

 ;D ;D ;D

Thanks for pointing this out.  There is a slight difference between the two messages and I probably need to make a small change in the wording for clarity ....

The first thing to note is that the 'window' for checking events is not exactly 24 hrs.   It's 24 hrs plus gc_Interval (defaults to 3 hrs) and further widened by the start and end delta (if not zero).   This is so we catch events in a timely manner.

"No events for today" means that when the google calendar was checked it did not see any events in the calendar between 'now' and the end of the nominal '24 hr' window.  I.e. the calendar was 'bare'.

If there are events, they are then filtered to an 'eligible' list based on the conditions you have set.  (e.g. keyword, ignore all day etc )

"No events for the next 24 hrs" means that for those events in the eligible list - none of them satisfied your conditions between 'now' and  the nominal '24hr' window.

So - I'm expecting  that you have two different calendars set up - correct ?

I will change the first message to "No events found today"
I will change the second message to "No more events today"

In terms of your PLEG question - the answer is 'possibly' given the remarks above - but it begs the question, what are you trying to achieve - a bit more precisely (an example would help)?   What do you mean by "Current Day" ?  A rolling window (as the calendar has) or the physical 'today' ending at midnight ?



Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 24, 2014, 01:03:54 pm
Thanks Stuart for making this clearer. I will have to read it once more after drinking my morning coffee. Anyway by "current day" i meant the calendar day (today). I want to have PLEG being able to determine if today is a school day e.g. there is at least one lesson coming up.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 24, 2014, 05:56:28 pm
Thanks Stuart for making this clearer. I will have to read it once more after drinking my morning coffee. Anyway by "current day" i meant the calendar day (today). I want to have PLEG being able to determine if today is a school day e.g. there is at least one lesson coming up.

Ok and do what sort of thing and at what time ?.    All event related actions have a start / and or an end.  So If it were a school day (or not) when would your event 'trigger'.  I'm trying to better understand if this is something I can help with inside GCal or how you might approach it in PLEG.
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 25, 2014, 02:23:39 am
Ok and do what sort of thing and at what time ?.    All event related actions have a start / and or an end.  So If it were a school day (or not) when would your event 'trigger'.  I'm trying to better understand if this is something I can help with inside GCal or how you might approach it in PLEG.

Thank You Stuart!

I've implementing a parental control PLEG that prevents accessive computer usage for my son. Without it he would unfortunately spend all his time in front of the computer. On school days he will have a certain amount of time and a little bit more on days without lessons. A GCAL 3 plugin connects to the school schedule calendar with gc_StartDelta and gc_EndDelta both set to -60 minutes. The DD-WRT router polls the Vera MultiSwitch plugin for changes and inserts or deletes appropriate iptables commands to control the traffic from some hosts.

More generically speaking I see a need to be able to determine if there are matching events found today or not regardless if they occured yet. (E.g. In my case, Is this calendar day a school day?)  Also it's useful to being able to tell if there are More events today" (E.g. In my case, are there any more lessons coming up today?) I'm not so good in explaining things Stuart, I apologize :D

Here is my PLEG condition expression which always evaluates to a number of seconds (Computer time left)
Code: [Select]
sAddTimeWeekday and (pNextEvent ne "No events for today") ? pAllocDay * 3600 :
(sAddTimeWeekend or (sAddTimeWeekday and (pNextEvent eq "No events for today")) ? pAllocWeekend :
((sAddTimeMorning1 or sAddTimeMorning2) and (pNextEvent ne "No events for today") ? pAllocMorning * 3600 :
(tAdd30Mins ? 30 * 60 :
(tAdd60Mins ? 60 * 60 :
((sPurgeTime1 or sPurgeTime2 or sPurgeTime3 or sPurgeTime4) and (cTimeRemaining > 300) ? 5 * 60 :
(((cTimeRemaining - (#NOW - #cTimeRemaining)) <= 0 ) ? 0 :
(((tTorsken and (tTorsken; NOW)) or (tPC and (tPC; NOW)) or (cTimeRemaining <= 300)) and (cTimeRemaining > 0) ? cTimeRemaining - (#NOW - #cTimeRemaining) :
cTimeRemaining)))))))
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 26, 2014, 05:27:08 pm

More generically speaking I see a need to be able to determine if there are matching events found today or not regardless if they occured yet. (E.g. In my case, Is this calendar day a school day?)  Also it's useful to being able to tell if there are More events today" (E.g. In my case, are there any more lessons coming up today?) I'm not so good in explaining things Stuart, I apologize :D

EDIT: Item 1 corrected.
So currently the plugin provides variables that
1.  a list of events from the start of the local day until 'now' plus 24(ish) hours as a json encoded string.  This is to catch all day events etc
2.  a list of currently active events as a json encoded string
3.  a list of currently active events as a comma delimited string

The intent of (3) was that it could be used in PLEG using a partial string match (upcoming capability in PLEG)

It would be fairly straightforward to  add a parameter that provided a comma delimited list of all events in the calendar for the current 'today' i.e. the local day  00:00 to 23:00.  I'd have to force an update of the calendar at 00:00 but that's doable

The normal update frequency is based on the start and end of each event in the calendar or every 3 hrs whichever is sooner.

The number of events remaining could be a number that gets updated with the normal updates and would be a count of events in the calendar  from 'now' until the end of the day.

The slightly trickier question would be any events seen in the calendar i.e. the equivalent of gc_Keyword being blank or events that take into account the settings for gc_keyword , gc_ignoreAllDayEvent and etc. 

What's your thoughts ?
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 27, 2014, 05:46:23 am
It would be fairly straightforward to  add a parameter that provided a comma delimited list of all events in the calendar for the current 'today' i.e. the local day  00:00 to 23:00.  I'd have to force an update of the calendar at 00:00 but that's doable

If there was a GCAL option (gc_LimitToday) it would be more versatile... (About the update at midnight it can be done from PLEG calling GCalCheck, so it's not really neccesary)

I've managed to implement a solution that I believe works for my needs.

Two schedules, s0005AM and s0010AM
A device property pJsonEvents

3 PLEG conditions that I put first in my PLEG

Lessons$None      s0005AM
Lessons$Exists   s0010AM and pJsonEvents ne "[]"
cSchoolDay      Lessons eq "Exists"

(Lessons becomes a PLEG State variable)
I put an action on Lessons$None that forces a GCalCheck.

One question though.... if I set gc_Interval to 0, would that disable automatic GCalChecks?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 27, 2014, 11:25:46 am
If there was a GCAL option (gc_LimitToday) it would be more versatile...

Not sure what you would want gc_LimitToday to represent - can you further explain?

(About the update at midnight it can be done from PLEG calling GCalCheck, so it's not really neccesary)

I was looking at the code last night and put it in anyway :-)

I've managed to implement a solution that I believe works for my needs.
I think it probably works because there are no early morning events.   The way the code currently works is that it has a rolling window fixed at 00:00 of the current local day so while gc_jsonEvents might = "[]" - if it were to check at (say) 22:00 the window would be 'all of today and all of tomorrow".   I think it would be worthwhile to add another 'local day' variable so as to avoid ambiguity (and strange 'data sensitive' behavior)

One question though.... if I set gc_Interval to 0, would that disable automatic GCalChecks?

gc_Interval cannot be 'turned off' in the current code - there is a default minimum (cannot remember off the top of my head what it is).  In any case - it would have no effect on GCalCheck - so you are safe there.  If anything you would set gc_Interval to a very large number (of minutes) to 'turn it off' - it would still check but not very often - but there may be unintended side effects if you are running your own 'refresh' scheme through triggering GCalChecks.

Let me take a look at some option ......  I think a proper 'eventstoday' indicator be it boolean, a count, a list makes sense as it removes ambiguity - and while I have no conceptual issue with using GCalChecks to force updates - it just seems that it's possibly offloading to something else, what ought to be self contained in the plugin - but maybe I'm chasing shadows .......

BRAVO - on getting it to work though !
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 27, 2014, 11:50:17 am
Not sure what you would want gc_LimitToday to represent - can you further explain?
Just a flag to prevent fetching calendar events not belonging to the present calendar day. :D

I was looking at the code last night and put it in anyway :-)
Great :D

I think it probably works because there are no early morning events.   The way the code currently works is that it has a rolling window fixed at 00:00 of the current local day so while gc_jsonEvents might = "[]" - if it were to check at (say) 22:00 the window would be 'all of today and all of tomorrow".   I think it would be worthwhile to add another 'local day' variable so as to avoid ambiguity (and strange 'data sensitive' behavior)

Yes it's true.

gc_Interval cannot be 'turned off' in the current code - there is a default minimum (cannot remember off the top of my head what it is).  In any case - it would have no effect on GCalCheck - so you are safe there.  If anything you would set gc_Interval to a very large number (of minutes) to 'turn it off' - it would still check but not very often - but there may be unintended side effects if you are running your own 'refresh' scheme through triggering GCalChecks.
Since I only need a single GCalCheck per day I tried to set it up to check every 24 hours but then gc_jsonEvents were pupulated with events scheduled 48 hours from now. :D I didn't want that so I set it back to check every 3 hours as being the default value. Being able to disable automatic GCalChecks would be a nice feature though, I think.

Let me take a look at some option ......  I think a proper 'eventstoday' indicator be it boolean, a count, a list makes sense as it removes ambiguity - and while I have no conceptual issue with using GCalChecks to force updates - it just seems that it's possibly offloading to something else, what ought to be self contained in the plugin - but maybe I'm chasing shadows .......

Thank You for all the work You put into this essential plugin Stuart! I wish I could do something for You in return.  ;D
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 28, 2014, 10:04:34 am

Thank You for all the work You put into this essential plugin Stuart! I wish I could do something for You in return.  ;D

Thanks for the complement.  You can help !   What does your Luup code look like for invoking GCalCheck ?    I'll put it in the documentation as a note for others.
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 28, 2014, 10:46:39 am
Thanks for the complement.  You can help !   What does your Luup code look like for invoking GCalCheck ?    I'll put it in the documentation as a note for others.

This will probably work:

Code: [Select]
local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
local GCAL_DEV = 141    -- The GCAL device number
luup.call_action(GCAL_SID, "GCalCheck", "", GCAL_DEV)

It works on my system when testing.

(I'm not using LUUP toinvoke a GCalCheck. I simply defined an advanced PLEG action on my GCalIII device.)
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 28, 2014, 06:52:43 pm
Let me take a look at some option ......  I think a proper 'eventstoday' indicator be it boolean, a count, a list makes sense as it removes ambiguity - and while I have no conceptual issue with using GCalChecks to force updates - it just seems that it's possibly offloading to something else, what ought to be self contained in the plugin - but maybe I'm chasing shadows .......

@ Farang

I made some changes - please try them out and let me know.  They should make your PLEG logic a bit simpler .....

(1) The calendar now checks at midnight (actually a second past) for events, independently of the normal checks
(2) A new variable gc_EventsToday - that gives a count of the number of events that match your selection criteria for the current day.  This gets checked at each event during the day but unless you add / delete events during the day - it will remain constant.
(3) A new variable gc_EventsLeftToday - that gives a count of the remaining number of events for the current day that match your selection criteria.  This gets updated at each event during the day.  It will start out (at midnight) being the same as gc_EventsToday and count down to zero (i.e. after the last event that day).  I suspect this might be useful but have not thought through how ......  I'm sure someone will find a use :-)

EDIT: Attachment removed
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 29, 2014, 03:49:31 am
Thank You Stuart. I'm exited to use these newly implemented variables and they sure makes Your plugin even more easy to use.  :) :) :)

(1) The calendar now checks at midnight (actually a second past) for events, independently of the normal checks

That is great. I wonder though if it still will check at midnight if I've set the gc_StartDelta variable ...
(I'm currently set both gc_StartDelta and gc_Enddelta to -60 so I can use the calendar for reminders 1 hour in advance.)

(2) A new variable gc_EventsToday - that gives a count of the number of events that match your selection criteria for the current day.  This gets checked at each event during the day but unless you add / delete events during the day - it will remain constant.

Seems to work perfectly. Very nice :D

(3) A new variable gc_EventsLeftToday - that gives a count of the remaining number of events for the current day that match your selection criteria.  This gets updated at each event during the day.  It will start out (at midnight) being the same as gc_EventsToday and count down to zero (i.e. after the last event that day).  I suspect this might be useful but have not thought through how ......  I'm sure someone will find a use :-)

I'm sure I will use it in the future :D It would be interesting though to know how setting gc_Enddelta will affect the value of gc_EventsLeftToday

I noticed something today that I haven't noticed before. As I mentioned earlier, I've currently set both gc_StartDelta and gc_Enddelta to -60 in the GCal 3 plugin for my sons school schedule. First lesson is at 9:00 AM to 9:20 AM. In the UI of the plugin it says that the lesson is between 8:00 AM to 9:21 AM. The plugin doesn't seem to adjust for my negative gc_EndDelta value. I had a quick look in the jsonEvents and they were also faulty in the same manner. I'm also confused by the extra minute added to the end time.

I'm not sure how to express my gratitude enough for Your efforts and great work. I hope a "Thank You" will do until I get the chance to buy You a beer or something :D
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 29, 2014, 10:57:18 am

I noticed something today that I haven't noticed before. As I mentioned earlier, I've currently set both gc_StartDelta and gc_Enddelta to -60 in the GCal 3 plugin for my sons school schedule. First lesson is at 9:00 AM to 9:20 AM. In the UI of the plugin it says that the lesson is between 8:00 AM to 9:21 AM. The plugin doesn't seem to adjust for my negative gc_EndDelta value. I had a quick look in the jsonEvents and they were also faulty in the same manner. I'm also confused by the extra minute added to the end time.


A copy / paste error on my part when adding in the new variables - was over writing gc_EndDelta.

EDIT: Removed Attachment

Try this.

I'll explain the other questions / aspects later today ....  gtg

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 29, 2014, 02:05:08 pm
That is great. I wonder though if it still will check at midnight if I've set the gc_StartDelta variable ...
(I'm currently set both gc_StartDelta and gc_Enddelta to -60 so I can use the calendar for reminders 1 hour in advance.)

gc_StartDelta and gc_Enddelta operate the same 'logical' way.   Negative values are back in time Positive are forward in time.  So setting both to -60 means that the start and end times are both 1 hr before the times for that event.  So a calendar event that you have set for 9:00 to 9:20 will actually be interpreted as 8:00 to 8:20.

In terms of the midnight check - there is no effect since the start delta and end delta are applied after the calendar retrieves the events to create an 'effective' start and end date.

Note that you can over-ride gc_StartDelta and gc_Enddelta but putting event specific start, end deltas into the event name in [] e.g. event [-60,60]  would create en effective start 1hr before and an effective end 1hr after the event times in the calendar.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 29, 2014, 11:36:30 pm
I'm sure I will use it in the future :D It would be interesting though to know how setting gc_Enddelta will affect the value of gc_EventsLeftToday

Here's an updated file.  I tidied up a couple of comparisons  .....

Basically  the number of events today and the number remaining are based on the effective dates, i.e. taking into account any start end deltas.  If part of the event is in 'today' then it is counted.  Today meaning 00:00:00 to 23:59:59

EDIT: Removed attachment
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 30, 2014, 12:07:37 am
I'm sure I will use it in the future :D It would be interesting though to know how setting gc_Enddelta will affect the value of gc_EventsLeftToday

Here's an updated file.  I tidied up a couple of comparisons  .....

Basically  the number of events today and the number remaining are based on the effective dates, i.e. taking into account any start end deltas.  If part of the event is in 'today' then it is counted.  Today meaning 00:00:00 to 23:59:59

Thanks!

Installed it and trying it out. Seems to work very well. I'm already using the new variable gc_EventsToday  ;D

Code: [Select]
cSchoolDay No pEventsToday > 0
cSchoolDayEnded No cSchoolDay and pEventsLeftToday == 0
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 30, 2014, 08:54:39 am
Code: [Select]
cSchoolDay No pEventsToday > 0
cSchoolDayEnded No cSchoolDay and pEventsLeftToday == 0

It seems like gc_EventsLeftToday doesn't update when an event finishes. Even though all events had passed today, it was still on 1. After doing a GCalCheck gc_EventsLeftToday changed to 0.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on September 30, 2014, 11:26:07 am
It seems like gc_EventsLeftToday doesn't update when an event finishes. Even though all events had passed today, it was still on 1. After doing a GCalCheck gc_EventsLeftToday changed to 0.

Were you looking at the advanced tab ?  If so it may not have refreshed (always use an F5 before looking).  Here's my output from a PLEG test.
I had an event that went from 9:05 to 9:10  For 'Left0' the event finished at 09:10 and the variable reflects that change (the previous change value was when I refreshed)

If you think it's still an issue (i.e. not the advanced tab)  - do you have a specific example I can try ?
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 30, 2014, 01:28:02 pm
Were you looking at the advanced tab ?  If so it may not have refreshed (always use an F5 before looking).  Here's my output from a PLEG test.
I had an event that went from 9:05 to 9:10  For 'Left0' the event finished at 09:10 and the variable reflects that change (the previous change value was when I refreshed)

If you think it's still an issue (i.e. not the advanced tab)  - do you have a specific example I can try ?

Things didn't happen when I expected them to, so I made a status report in my PLEG. I'm currently running a test and I'll get back to you. Thanks.
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on September 30, 2014, 01:57:50 pm
Stuart, have a look at my calendar, especially at the blue ring. That's how it looked like this afternoon. Two groups (a and b) have lessons at the same time but the rightmost calendar event starts later and ends earlier.

I'm sure gc_EventsLeftToday had value 1 when I looked before today but I wasn't able to reproduce the problem this evening with 2 similar test events. If You can't see anything obvious in the schedule that the plugin can't handle maybe we just have to wait and see if it happens again.

(My GCal 3 plugin has gc_StartDelta and gc_EndDelta set to -60. gc_Interval is set to 1440)



Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 01, 2014, 12:00:21 am
Stuart, have a look at my calendar, especially at the blue ring. That's how it looked like this afternoon. Two groups (a and b) have lessons at the same time but the rightmost calendar event starts later and ends earlier.

I'm sure gc_EventsLeftToday had value 1 when I looked before today but I wasn't able to reproduce the problem this evening with 2 similar test events. If You can't see anything obvious in the schedule that the plugin can't handle maybe we just have to wait and see if it happens again.

(My GCal 3 plugin has gc_StartDelta and gc_EndDelta set to -60. gc_Interval is set to 1440)

Looks like there was a timing issue because I had some <= and >= comparisons and depending on exactly when the check took place ....
I changed them to < and > and added in a second of leeway.  Seems to be working well now.   Let me know with this patched version.

Also here are my test results with two plugins: one with no start / end delta (Left0 --> EventsLeftToday) and one with start and end delta of -60 (Left60 --> EventsLeftToday)





Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 01, 2014, 12:45:45 am
Hi,

I installed a Gcal3 and everything worked well!
But today I installed 2 more ... And there Gcal3 is obviously much slower.
In the message I have. : Waiting for semaphore startup ... for 2 plug
Checking ... for 1 plug (I personally clicked)
After several "RELOAD" I have no change ...
Is this normal?

Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 01, 2014, 02:08:21 am
Looks like there was a timing issue because I had some <= and >= comparisons and depending on exactly when the check took place ....
I changed them to < and > and added in a second of leeway.  Seems to be working well now.   Let me know with this patched version.

Also here are my test results with two plugins: one with no start / end delta (Left0 --> EventsLeftToday) and one with start and end delta of -60 (Left60 --> EventsLeftToday)

Thank You Stuart. Patched version is installed. I will let You know the results within a week :D
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 01, 2014, 09:37:40 am
Hi,

I installed a Gcal3 and everything worked well!
But today I installed 2 more ... And there Gcal3 is obviously much slower.
In the message I have. : Waiting for semaphore startup ... for 2 plug
Checking ... for 1 plug (I personally clicked)
After several "RELOAD" I have no change ...
Is this normal?

Sorry that you are having trouble.  No it is not normal !  I routinely test with 3 plugins.   What version are you using ?  Are all three plugin instances pointing to the same calendar or different calendars ?    Do you have the same credentials set up for each calendar?

Please set gc_debug = 3 and get a log - this is the quickest way to figure out what's going on.   If you are unfamiliar with getting logs -- see the info here
http://forum.micasaverde.com/index.php/topic,26692.msg189513.html#msg189513
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 02, 2014, 07:04:01 am
Hello and thank you for your return

For the history I own Google calendar Switch ...
Before going on the market, I uploaded my Vera3 ui5 6 downloadable files on the first post.
After I installed from the market and everything went well for 3 plug ... I don uninstalled Google calendar switch. It was the day I was eui worries and since I tried the restoration of earlier dates but I have the same problem.
I think that there are corrupt files ...

I installed InfoViewer ...

In the log I have:
command ls etc/cmh-ludl/GCal3/ returned 0
checkin semaphore
command ls etc/cmh-ludl/GCal3/GCal3.sem returned 0
semaphore file returned '236
236 Blocked device semaphore request from semaphore 234

So I conclude that it is the 236 which pose problem ...

So I uninstalled all the device

But the problem is that I still have the same defect in the log ... I am surprised because the device is removed !!!
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 02, 2014, 12:39:38 pm
Hello and thank you for your return

For the history I own Google calendar Switch ...
Before going on the market, I uploaded my Vera3 ui5 6 downloadable files on the first post.
After I installed from the market and everything went well for 3 plug ... I don uninstalled Google calendar switch. It was the day I was eui worries and since I tried the restoration of earlier dates but I have the same problem.
I think that there are corrupt files ...

I installed InfoViewer ...

In the log I have:
command ls etc/cmh-ludl/GCal3/ returned 0
checkin semaphore
command ls etc/cmh-ludl/GCal3/GCal3.sem returned 0
semaphore file returned '236
236 Blocked device semaphore request from semaphore 234

So I conclude that it is the 236 which pose problem ...

So I uninstalled all the device

But the problem is that I still have the same defect in the log ... I am surprised because the device is removed !!!

This looks like a problem that was in the 0.6x release which is fixed in the 0.7x release.
Can I suggest the following to make sure:
(1) delete the devices using the UI ( the garbage / trash can icon)
(2) run this code by going to Apps--> Develop Apps --> Test Luup Code (Lua).  It will remove all GCal files
(3) reinstall Google Calendar 3 from the marketplace
(4) go through the setup (i.e. upload your GCal3.json credentials file and the calendar url)

Code: [Select]
local result = os.execute("rm -rf /etc/cmh-ludl/*GCal*")
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 02, 2014, 03:29:21 pm
Wonderful !!!  :D

However I have installed version 0.7 ... Before I had not installed version 0.62

A little question : What address should we learn when we want to have a GCal3 with public holidays?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 02, 2014, 03:56:38 pm
Wonderful !!!  :D

However I have installed version 0.7 ... Before I had not installed version 0.62

A little question : What address should we learn when we want to have a GCal3 with public holidays?

So does 'Wonderful' mean it is now working ?  I hope so.

If you subscribe to a holiday calendar as described here
http://www.guidingtech.com/2329/add-public-holidays-google-calendar/
you can then get the calendar ID and use that in a plugin instance BUT it results in an error code - 401 unauthorized
So it seems that those calendars do not work with the authentication that google requires for personal calendars

The simplest way (I'm assuming it is simple) would be to import public holidays into your personal calendar.  You cannot just subscribe to a holiday calendar as these events do not show up when GCal3 searches your calendar.

If I find out a better way - I will post it.
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 02, 2014, 04:07:29 pm
Ok perfect! I started my installation start ...

I meet a new worry: - /

I have a module that says:

2/10/14 22: 00: 56 216 luup_log: 243 GCal3 gc_V 0.7.0: Device 243 Claimed semaphore

But stuck on Checking ...

Re-lock it after the other modules ... I am forced to mail another agenda that goes Successfully but the log file shows this address:

2/10/14 22: 03: 31 392 luup_log: 241: GCal3 gc_V 0.7.0: Device initializing # 241 <0x2b535680>
50 02/10/14 22: 03: 31 420 luup_log: 241: GCal3 gc_V 0.7.0: Command ls / etc / cmh-Ludl / GCal3 / returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 421 luup_log: 241: GCal3 gc_V 0.7.0: Checking semaphore <0x2b535680>
50 02/10/14 22: 03: 31 447 luup_log: 241: GCal3 gc_V 0.7.0: Command ls-/etc/cmh ludl/GCal3/GCal3.sem returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 449 luup_log: 241: GCal3 gc_V 0.7.0 Semaphore file returned '243 <0x2b535680>
50 02/10/14 22: 03: 31 475 luup_log: 241: GCal3 gc_V 0.7.0: Command ls-/etc/cmh ludl/GCal3/GCal3.sem returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 475 luup_log: 241: GCal3 gc_V 0.7.0: Device 243 Blocked semaphore request from device 241 <0x2b535680>
50 02/10/14 22: 03: 31 482 luup_log: 242: GCal3 gc_V 0.7.0: Device initializing # 242 <0x2b535680>
50 02/10/14 22: 03: 31 511 luup_log: 242: GCal3 gc_V 0.7.0: Command ls / etc / cmh-Ludl / GCal3 / returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 512 luup_log: 242: GCal3 gc_V 0.7.0: Checking semaphore <0x2b535680>

50 02/10/14 22: 03: 31 588 luup_log: 242: GCal3 gc_V 0.7.0: Command ls-/etc/cmh ludl/GCal3/GCal3.sem returned '0 <0x2b535680>
50 02/10/14 22: 03: 31.600 luup_log: 242: GCal3 gc_V 0.7.0 Semaphore file returned '243 <0x2b535680>

50 02/10/14 22: 03: 31 636 luup_log: 242: GCal3 gc_V 0.7.0: Command ls-/etc/cmh ludl/GCal3/GCal3.sem returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 637 luup_log: 242: GCal3 gc_V 0.7.0: Device 243 Blocked semaphore request from device 242 <0x2b535680>
50 02/10/14 22: 03: 31 644 luup_log: 243 GCal3 gc_V 0.7.0: Device initializing # 243 <0x2b535680>

50 02/10/14 22: 03: 31.720 luup_log: 243 GCal3 gc_V 0.7.0: Command ls / etc / cmh-Ludl / GCal3 / returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 721 luup_log: 243 GCal3 gc_V 0.7.0: Checking semaphore <0x2b535680>

50 02/10/14 22: 03: 31 801 luup_log: 243 GCal3 gc_V 0.7.0: Command ls-/etc/cmh ludl/GCal3/GCal3.sem returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 813 luup_log: 243 GCal3 gc_V 0.7.0 Semaphore file returned '243 <0x2b535680>

50 02/10/14 22: 03: 31 890 luup_log: 243 GCal3 gc_V 0.7.0: Command ls-/etc/cmh ludl/GCal3/GCal3.sem returned '0 <0x2b535680>
50 02/10/14 22: 03: 31 891 luup_log: 243 GCal3 gc_V 0.7.0: Device 243 Claimed semaphore <0x2b535680>
50 02/10/14 22: 03: 31 915 luup_log: 243 GCal3 gc_V 0.7.0: 0.7.0 GCal3 gc_V: initialized variables ... <0x2b535680>

50 02/10/14 22: 03: 32 588 luup_log: 243 GCal3 gc_V 0.7.0: 0.7.0 GCal3 gc_V: Running Plugin ... <0x2b535680>
50 02/10/14 22: 03: 32 612 luup_log: 243 GCal3 gc_V 0.7.0: Device 243 released the semaphore - reason: initialization complete <0x2b535680>





50 02/10/14 22: 03: 34 310 luup_log: 243 GCal3 gc_V 0.7.0: Device 243 Claimed semaphore <0x30f35680>





50 02/10/14 22: 03: 41 109 luup_log: 242: GCal3 gc_V 0.7.0: Device # 242 initializing __LEAK__ this: 217088 start: 2183168 to 0x1990000 <0x30d35680>
50 02/10/14 22: 03: 41 116 luup_log: 241: GCal3 gc_V 0.7.0: Device initializing # 241 <0x30b35680>
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 02, 2014, 04:20:44 pm
Ok perfect! I started my installation start ...

I meet a new worry: - /

I have a module that says:

2/10/14 22: 00: 56 216 luup_log: 243 GCal3 gc_V 0.7.0: Device 243 Claimed semaphore

But stuck on Checking ...


Ok - so what this is saying is that device 243 is trying to start and is blocking the others while it is trying - at a high level - this is ok.  Now we need to understand why that device is not starting correctly.   Since the order of startup can be random - we cannot assume it wil be the same device each time .....
So set gc_debug = 3 for all 3 plugins and try again - there will be much more log information but that will help track down why one of the devices is 'stuck' (and therefore blocking the others)
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 02, 2014, 04:29:25 pm
Ok thank you I understand;-)
so, ive got this:


50      10/02/14 22:24:33.168   luup_log:241: GCal3 gc_V 0.7.0:Device # 241 initializing <0x2b5db680>
50      10/02/14 22:24:33.197   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 <0x2b5db680>
50      10/02/14 22:24:33.197   luup_log:241: GCal3 gc_V 0.7.0:Checking semaphore <0x2b5db680>
50      10/02/14 22:24:33.223   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.225   luup_log:241: GCal3 gc_V 0.7.0:Semaphore file returned 0 <0x2b5db680>
50      10/02/14 22:24:33.226   luup_log:241: GCal3 gc_V 0.7.0:Device 241 requested semaphore <0x2b5db680>
50      10/02/14 22:24:33.252   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.253   luup_log:241: GCal3 gc_V 0.7.0:Device 241 claimed semaphore <0x2b5db680>
50      10/02/14 22:24:33.266   luup_log:241: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Variables initialized ... <0x2b5db680>
50      10/02/14 22:24:33.291   luup_log:241: GCal3 gc_V 0.7.0:Command ls /bin/bash returned 0 <0x2b5db680>
50      10/02/14 22:24:33.316   luup_log:241: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2b5db680>

50      10/02/14 22:24:33.353   luup_log:241: GCal3 gc_V 0.7.0:Current version of /usr/lib/lua/googlejwt.sh is 0 <0x2b5db680>
50      10/02/14 22:24:33.378   luup_log:241: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/json.lua returned 0 <0x2b5db680>

50      10/02/14 22:24:33.450   luup_log:241: GCal3 gc_V 0.7.0:Existing openssl version is: 1.0.0d-1 <0x2b5db680>
50      10/02/14 22:24:33.450   luup_log:241: GCal3 gc_V 0.7.0:Function: checkforcredentials <0x2b5db680>
50      10/02/14 22:24:33.476   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b5db680>
50      10/02/14 22:24:33.502   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.pem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.503   luup_log:241: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Timezone is 2 hrs and 0 min <0x2b5db680>
50      10/02/14 22:24:33.504   luup_log:241: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Running Plugin ... <0x2b5db680>
50      10/02/14 22:24:33.506   luup_log:241: GCal3 gc_V 0.7.0:Device 241 released the semaphore - reason: initialization complete <0x2b5db680>
50      10/02/14 22:24:33.511   luup_log:242: GCal3 gc_V 0.7.0:Device # 242 initializing <0x2b5db680>
50      10/02/14 22:24:33.537   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 <0x2b5db680>
50      10/02/14 22:24:33.538   luup_log:242: GCal3 gc_V 0.7.0:Checking semaphore <0x2b5db680>
50      10/02/14 22:24:33.565   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.566   luup_log:242: GCal3 gc_V 0.7.0:Semaphore file returned 0 <0x2b5db680>
50      10/02/14 22:24:33.568   luup_log:242: GCal3 gc_V 0.7.0:Device 242 requested semaphore <0x2b5db680>
50      10/02/14 22:24:33.593   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.594   luup_log:242: GCal3 gc_V 0.7.0:Device 242 claimed semaphore <0x2b5db680>
50      10/02/14 22:24:33.606   luup_log:242: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Variables initialized ... <0x2b5db680>
50      10/02/14 22:24:33.632   luup_log:242: GCal3 gc_V 0.7.0:Command ls /bin/bash returned 0 <0x2b5db680>
50      10/02/14 22:24:33.657   luup_log:242: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2b5db680>

50      10/02/14 22:24:33.693   luup_log:242: GCal3 gc_V 0.7.0:Current version of /usr/lib/lua/googlejwt.sh is 0 <0x2b5db680>
50      10/02/14 22:24:33.718   luup_log:242: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/json.lua returned 0 <0x2b5db680>

50      10/02/14 22:24:33.786   luup_log:242: GCal3 gc_V 0.7.0:Existing openssl version is: 1.0.0d-1 <0x2b5db680>
50      10/02/14 22:24:33.786   luup_log:242: GCal3 gc_V 0.7.0:Function: checkforcredentials <0x2b5db680>
50      10/02/14 22:24:33.812   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b5db680>

50      10/02/14 22:24:33.867   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.pem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.868   luup_log:242: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Timezone is 2 hrs and 0 min <0x2b5db680>
50      10/02/14 22:24:33.868   luup_log:242: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Running Plugin ... <0x2b5db680>

50      10/02/14 22:24:33.913   luup_log:242: GCal3 gc_V 0.7.0:Device 242 released the semaphore - reason: initialization complete <0x2b5db680>
50      10/02/14 22:24:33.916   luup_log:243: GCal3 gc_V 0.7.0:Device # 243 initializing <0x2b5db680>

50      10/02/14 22:24:33.954   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 <0x2b5db680>
50      10/02/14 22:24:33.954   luup_log:243: GCal3 gc_V 0.7.0:Checking semaphore <0x2b5db680>
50      10/02/14 22:24:33.981   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2b5db680>
50      10/02/14 22:24:33.982   luup_log:243: GCal3 gc_V 0.7.0:Semaphore file returned 0 <0x2b5db680>
50      10/02/14 22:24:33.984   luup_log:243: GCal3 gc_V 0.7.0:Device 243 requested semaphore <0x2b5db680>

50      10/02/14 22:24:34.015   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2b5db680>
50      10/02/14 22:24:34.016   luup_log:243: GCal3 gc_V 0.7.0:Device 243 claimed semaphore <0x2b5db680>
50      10/02/14 22:24:34.028   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Variables initialized ... <0x2b5db680>
50      10/02/14 22:24:34.054   luup_log:243: GCal3 gc_V 0.7.0:Command ls /bin/bash returned 0 <0x2b5db680>
50      10/02/14 22:24:34.079   luup_log:243: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2b5db680>

50      10/02/14 22:24:34.134   luup_log:243: GCal3 gc_V 0.7.0:Current version of /usr/lib/lua/googlejwt.sh is 0 <0x2b5db680>

50      10/02/14 22:24:34.174   luup_log:243: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/json.lua returned 0 <0x2b5db680>

50      10/02/14 22:24:34.240   luup_log:243: GCal3 gc_V 0.7.0:Existing openssl version is: 1.0.0d-1 <0x2b5db680>
50      10/02/14 22:24:34.241   luup_log:243: GCal3 gc_V 0.7.0:Function: checkforcredentials <0x2b5db680>
50      10/02/14 22:24:34.266   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2b5db680>
50      10/02/14 22:24:34.292   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.pem returned 0 <0x2b5db680>
50      10/02/14 22:24:34.293   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Timezone is 2 hrs and 0 min <0x2b5db680>
50      10/02/14 22:24:34.293   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Running Plugin ... <0x2b5db680>
50      10/02/14 22:24:34.295   luup_log:243: GCal3 gc_V 0.7.0:Device 243 released the semaphore - reason: initialization complete <0x2b5db680>

50      10/02/14 22:24:35.104   luup_log:241: GCal3 gc_V 0.7.0:Checking semaphore <0x30bdb680>
50      10/02/14 22:24:35.124   luup_log:242: GCal3 gc_V 0.7.0:Checking semaphore <0x30ddb680>

50      10/02/14 22:24:35.177   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30ddb680>
50      10/02/14 22:24:35.178   luup_log:242: GCal3 gc_V 0.7.0:Semaphore file returned 0 <0x30ddb680>
50      10/02/14 22:24:35.187   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30bdb680>
50      10/02/14 22:24:35.188   luup_log:241: GCal3 gc_V 0.7.0:Semaphore file returned  <0x30bdb680>
50      10/02/14 22:24:35.211   luup_log:242: GCal3 gc_V 0.7.0:Device 242 requested semaphore <0x30ddb680>

50      10/02/14 22:24:35.248   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30ddb680>
50      10/02/14 22:24:35.248   luup_log:242: GCal3 gc_V 0.7.0:Device 242 claimed semaphore <0x30ddb680>
50      10/02/14 22:24:35.261   luup_log:242: GCal3 gc_V 0.7.0:StartMin is 2014-10-02T00:00:00.000Z StartMax is 2014-10-03T23:24:35.000Z <0x30ddb680>
50      10/02/14 22:24:35.286   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30bdb680>
50      10/02/14 22:24:35.286   luup_log:241: GCal3 gc_V 0.7.0:Device 242 blocked semaphore request from device 241 <0x30bdb680>
50      10/02/14 22:24:35.288   luup_log:241: GCal3 gc_V 0.7.0:Next check will be in 5 sec on 2014-10-02 at 22:24:40 <0x30bdb680>

50      10/02/14 22:24:35.483   luup_log:242: GCal3 gc_V 0.7.0:Function: requestCalendar <0x30ddb680>

50      10/02/14 22:24:35.540   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3242.token returned 0 <0x30ddb680>

50      10/02/14 22:24:36.103   luup_log:243: GCal3 gc_V 0.7.0:Checking semaphore <0x30fdb680>

50      10/02/14 22:24:36.137   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30fdb680>
50      10/02/14 22:24:36.138   luup_log:243: GCal3 gc_V 0.7.0:Semaphore file returned 242 <0x30fdb680>

50      10/02/14 22:24:36.188   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30fdb680>
50      10/02/14 22:24:36.188   luup_log:243: GCal3 gc_V 0.7.0:Device 242 blocked semaphore request from device 243 <0x30fdb680>
50      10/02/14 22:24:36.205   luup_log:243: GCal3 gc_V 0.7.0:Next check will be in 5 sec on 2014-10-02 at 22:24:41 <0x30fdb680>

50      10/02/14 22:24:36.425   luup_log:242: GCal3 gc_V 0.7.0:token info status: HTTP/1.1 200 OK <0x30ddb680>

50      10/02/14 22:24:36.463   luup_log:242: GCal3 gc_V 0.7.0:Token will expire in 1371 sec <0x30ddb680>
50      10/02/14 22:24:36.463   luup_log:242: GCal3 gc_V 0.7.0:Checking google calendar <0x30ddb680>
50      10/02/14 22:24:36.464   luup_log:242: GCal3 gc_V 0.7.0:Requested url: https://www.googleapis.com/calendar/v3/calendars/xxxxxxxxxxxxxxxxxxx@group.calendar.google.com/events?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxmH2&timeZone=utc&singleEvents=true&orderBy=startTime&timeMax=2014-10-03T23:24:35.000Z&timeMin=2014-10-02T00:00:00.000Z&fields=items(description%2Cend%2Cstart%2Csummary) <0x30ddb680>

50      10/02/14 22:24:36.928   luup_log:242: GCal3 gc_V 0.7.0:Calendar request status: HTTP/1.1 200 OK <0x30ddb680>
50      10/02/14 22:24:36.944   luup_log:242: GCal3 gc_V 0.7.0:Device 242 released the semaphore - reason: calendar check complete <0x30ddb680>
50      10/02/14 22:24:36.945   luup_log:242: GCal3 gc_V 0.7.0:Function: getEvents <0x30ddb680>
50      10/02/14 22:24:36.945   luup_log:242: GCal3 gc_V 0.7.0:There were 3 events retrieved <0x30ddb680>
50      10/02/14 22:24:36.947   luup_log:242: GCal3 gc_V 0.7.0:Effective Event Name A[0,0]{} <0x30ddb680>
50      10/02/14 22:24:36.960   luup_log:242: GCal3 gc_V 0.7.0:Effective Event Name VERTS[0,0]{} <0x30ddb680>
50      10/02/14 22:24:36.962   luup_log:242: GCal3 gc_V 0.7.0:Effective Event Name M[0,0]{} <0x30ddb680>
50      10/02/14 22:24:36.963   luup_log:242: GCal3 gc_V 0.7.0:Function: saveEvents <0x30ddb680>
50      10/02/14 22:24:36.964   luup_log:242: GCal3 gc_V 0.7.0:Active Events: A , VERTS <0x30ddb680>

50      10/02/14 22:24:37.022   luup_log:242: GCal3 gc_V 0.7.0:json event list [{'eventEnd':1412287200,'eventStart':1412200800,'eventParameter':'','eventName':'A'},{'eventEnd':1412287200,'eventStart':1412200800,'eventParameter':'','eventName':'VERTS'},{'eventEnd':1412373600,'eventStart':1412287200,'eventParameter':'','eventName':'M'}] <0x30ddb680>
50      10/02/14 22:24:37.024   luup_log:242: GCal3 gc_V 0.7.0:json active event list [{'eventParameter':'','eventName':'A'},{'eventParameter':'','eventName':'VERTS'}] <0x30ddb680>
50      10/02/14 22:24:37.025   luup_log:242: GCal3 gc_V 0.7.0:Function: getjsonEvents <0x30ddb680>
50      10/02/14 22:24:37.040   luup_log:242: GCal3 gc_V 0.7.0:Event 1: On 2014-10-02 event A will start at 00:00:00 and end at 00:00:00 <0x30ddb680>
50      10/02/14 22:24:37.044   luup_log:242: GCal3 gc_V 0.7.0:Event 2: On 2014-10-02 event VERTS will start at 00:00:00 and end at 00:00:00 <0x30ddb680>
50      10/02/14 22:24:37.045   luup_log:242: GCal3 gc_V 0.7.0:Event 3: On 2014-10-03 event M will start at 00:00:00 and end at 00:00:00 <0x30ddb680>
50      10/02/14 22:24:37.047   luup_log:242: GCal3 gc_V 0.7.0:Next Event: A -- 00:00 Oct 02 to 00:00 Oct 03 <0x30ddb680>
50      10/02/14 22:24:37.048   luup_log:242: GCal3 gc_V 0.7.0:Event-Start A 10/02 00:00 is already Active <0x30ddb680>
50      10/02/14 22:24:37.050   luup_log:242: GCal3 gc_V 0.7.0:Next check will be in 5724 sec on 2014-10-03 at 00:00:00 <0x30ddb680>





50      10/02/14 22:24:40.102   luup_log:241: GCal3 gc_V 0.7.0:Checking semaphore <0x30bdb680>
50      10/02/14 22:24:40.127   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30bdb680>
50      10/02/14 22:24:40.128   luup_log:241: GCal3 gc_V 0.7.0:Semaphore file returned 0 <0x30bdb680>
50      10/02/14 22:24:40.130   luup_log:241: GCal3 gc_V 0.7.0:Device 241 requested semaphore <0x30bdb680>
50      10/02/14 22:24:40.155   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30bdb680>
50      10/02/14 22:24:40.156   luup_log:241: GCal3 gc_V 0.7.0:Device 241 claimed semaphore <0x30bdb680>
50      10/02/14 22:24:40.157   luup_log:241: GCal3 gc_V 0.7.0:StartMin is 2014-10-02T00:00:00.000Z StartMax is 2014-10-03T23:24:40.000Z <0x30bdb680>

50      10/02/14 22:24:40.299   luup_log:241: GCal3 gc_V 0.7.0:Function: requestCalendar __LEAK__ this:49152 start:1654784 to 0x1c03000 <0x30bdb680>
50      10/02/14 22:24:40.325   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3241.token returned 0 <0x30bdb680>

50      10/02/14 22:24:41.102   luup_log:243: GCal3 gc_V 0.7.0:Checking semaphore <0x30fdb680>
50      10/02/14 22:24:41.128   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30fdb680>
50      10/02/14 22:24:41.130   luup_log:243: GCal3 gc_V 0.7.0:Semaphore file returned 241 <0x30fdb680>

50      10/02/14 22:24:41.176   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x30fdb680>
50      10/02/14 22:24:41.177   luup_log:243: GCal3 gc_V 0.7.0:Device 241 blocked semaphore request from device 243 <0x30fdb680>
50      10/02/14 22:24:41.178   luup_log:243: GCal3 gc_V 0.7.0:Next check will be in 5 sec on 2014-10-02 at 22:24:46 <0x30fdb680>

50      10/02/14 22:24:41.256   luup_log:241: GCal3 gc_V 0.7.0:token info status: HTTP/1.1 200 OK <0x30bdb680>
50      10/02/14 22:24:41.270   luup_log:241: GCal3 gc_V 0.7.0:Token will expire in 1040 sec <0x30bdb680>
50      10/02/14 22:24:41.271   luup_log:241: GCal3 gc_V 0.7.0:Checking google calendar <0x30bdb680>
50      10/02/14 22:24:41.271   luup_log:241: GCal3 gc_V 0.7.0:Requested url: https://www.googleapis.com/calendar/v3/calendars/xxxxxxxxxxxxxxx@group.calendar.google.com/events?access_token=xxxxxxxxxxxxxxxxxxxxxxxxx&timeZone=utc&singleEvents=true&orderBy=startTime&timeMax=2014-10-03T23:24:40.000Z&timeMin=2014-10-02T00:00:00.000Z&fields=items(description%2Cend%2Cstart%2Csummary) <0x30bdb680>





50      10/02/14 22:24:42.578   luup_log:241: GCal3 gc_V 0.7.0:Calendar request status: HTTP/1.1 200 OK __LEAK__ this:81920 start:1961984 to 0x1c4e000 <0x30bdb680>
50      10/02/14 22:24:42.584   luup_log:241: GCal3 gc_V 0.7.0:Device 241 released the semaphore - reason: calendar check complete <0x30bdb680>
50      10/02/14 22:24:42.584   luup_log:241: GCal3 gc_V 0.7.0:Function: getEvents <0x30bdb680>
50      10/02/14 22:24:42.585   luup_log:241: GCal3 gc_V 0.7.0:There were 2 events retrieved <0x30bdb680>
50      10/02/14 22:24:42.587   luup_log:241: GCal3 gc_V 0.7.0:Effective Event Name J[0,0]{} <0x30bdb680>
50      10/02/14 22:24:42.590   luup_log:241: GCal3 gc_V 0.7.0:Effective Event Name M[0,0]{} <0x30bdb680>
50      10/02/14 22:24:42.591   luup_log:241: GCal3 gc_V 0.7.0:Function: saveEvents <0x30bdb680>
50      10/02/14 22:24:42.592   luup_log:241: GCal3 gc_V 0.7.0:Active Events: J <0x30bdb680>
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 02, 2014, 04:33:38 pm
If i make a reload i've got this :

50      10/02/14 22:32:15.136   luup_log:241: GCal3 gc_V 0.7.0:Device # 241 initializing <0x2c3b7680>
50      10/02/14 22:32:15.164   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.165   luup_log:241: GCal3 gc_V 0.7.0:Checking semaphore <0x2c3b7680>
50      10/02/14 22:32:15.193   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.194   luup_log:241: GCal3 gc_V 0.7.0:Semaphore file returned 243 <0x2c3b7680>

50      10/02/14 22:32:15.238   luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 __LEAK__ this:53248 start:471040 to 0x1ca5000 <0x2c3b7680>
50      10/02/14 22:32:15.249   luup_log:241: GCal3 gc_V 0.7.0:Device 243 blocked semaphore request from device 241 __LEAK__ this:69632 start:540672 to 0x1cb6000 <0x2c3b7680>

50      10/02/14 22:32:15.366   luup_log:242: GCal3 gc_V 0.7.0:Device # 242 initializing <0x2c3b7680>

50      10/02/14 22:32:15.430   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 __LEAK__ this:163840 start:2027520 to 0x1e21000 <0x2c3b7680>
50      10/02/14 22:32:15.431   luup_log:242: GCal3 gc_V 0.7.0:Checking semaphore <0x2c3b7680>

50      10/02/14 22:32:15.496   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.497   luup_log:242: GCal3 gc_V 0.7.0:Semaphore file returned 243 <0x2c3b7680>

50      10/02/14 22:32:15.548   luup_log:242: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.552   luup_log:242: GCal3 gc_V 0.7.0:Device 243 blocked semaphore request from device 242 <0x2c3b7680>
50      10/02/14 22:32:15.558   luup_log:243: GCal3 gc_V 0.7.0:Device # 243 initializing <0x2c3b7680>

50      10/02/14 22:32:15.612   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.612   luup_log:243: GCal3 gc_V 0.7.0:Checking semaphore <0x2c3b7680>

50      10/02/14 22:32:15.668   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 __LEAK__ this:184320 start:2211840 to 0x1e4e000 <0x2c3b7680>

50      10/02/14 22:32:15.702   luup_log:243: GCal3 gc_V 0.7.0:Semaphore file returned 243 <0x2c3b7680>

50      10/02/14 22:32:15.773   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.774   luup_log:243: GCal3 gc_V 0.7.0:Device 243 claimed semaphore <0x2c3b7680>
50      10/02/14 22:32:15.785   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Variables initialized ... <0x2c3b7680>

50      10/02/14 22:32:15.825   luup_log:243: GCal3 gc_V 0.7.0:Command ls /bin/bash returned 0 <0x2c3b7680>

50      10/02/14 22:32:15.863   luup_log:243: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2c3b7680>

50      10/02/14 22:32:15.915   luup_log:243: GCal3 gc_V 0.7.0:Current version of /usr/lib/lua/googlejwt.sh is 0 <0x2c3b7680>
50      10/02/14 22:32:15.944   luup_log:243: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/json.lua returned 0 <0x2c3b7680>

50      10/02/14 22:32:16.011   luup_log:243: GCal3 gc_V 0.7.0:Existing openssl version is: 1.0.0d-1 <0x2c3b7680>
50      10/02/14 22:32:16.011   luup_log:243: GCal3 gc_V 0.7.0:Function: checkforcredentials <0x2c3b7680>
50      10/02/14 22:32:16.037   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2c3b7680>
50      10/02/14 22:32:16.065   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.pem returned 0 <0x2c3b7680>
50      10/02/14 22:32:16.066   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Timezone is 2 hrs and 0 min <0x2c3b7680>
50      10/02/14 22:32:16.067   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Running Plugin ... <0x2c3b7680>
50      10/02/14 22:32:16.068   luup_log:243: GCal3 gc_V 0.7.0:Device 243 released the semaphore - reason: initialization complete <0x2c3b7680>
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 02, 2014, 05:14:55 pm
If i make a reload i've got this :

.......................................
.......................................

50      10/02/14 22:32:15.558   luup_log:243: GCal3 gc_V 0.7.0:Device # 243 initializing <0x2c3b7680>

50      10/02/14 22:32:15.612   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/ returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.612   luup_log:243: GCal3 gc_V 0.7.0:Checking semaphore <0x2c3b7680>

50      10/02/14 22:32:15.668   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 __LEAK__ this:184320 start:2211840 to 0x1e4e000 <0x2c3b7680>

50      10/02/14 22:32:15.702   luup_log:243: GCal3 gc_V 0.7.0:Semaphore file returned 243 <0x2c3b7680>

50      10/02/14 22:32:15.773   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2c3b7680>
50      10/02/14 22:32:15.774   luup_log:243: GCal3 gc_V 0.7.0:Device 243 claimed semaphore <0x2c3b7680>
50      10/02/14 22:32:15.785   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Variables initialized ... <0x2c3b7680>

50      10/02/14 22:32:15.825   luup_log:243: GCal3 gc_V 0.7.0:Command ls /bin/bash returned 0 <0x2c3b7680>

50      10/02/14 22:32:15.863   luup_log:243: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/googlejwt.sh returned 0 <0x2c3b7680>

50      10/02/14 22:32:15.915   luup_log:243: GCal3 gc_V 0.7.0:Current version of /usr/lib/lua/googlejwt.sh is 0 <0x2c3b7680>
50      10/02/14 22:32:15.944   luup_log:243: GCal3 gc_V 0.7.0:Command ls /usr/lib/lua/json.lua returned 0 <0x2c3b7680>

50      10/02/14 22:32:16.011   luup_log:243: GCal3 gc_V 0.7.0:Existing openssl version is: 1.0.0d-1 <0x2c3b7680>
50      10/02/14 22:32:16.011   luup_log:243: GCal3 gc_V 0.7.0:Function: checkforcredentials <0x2c3b7680>
50      10/02/14 22:32:16.037   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3.json.lzo returned 256 <0x2c3b7680>
50      10/02/14 22:32:16.065   luup_log:243: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.pem returned 0 <0x2c3b7680>
50      10/02/14 22:32:16.066   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Timezone is 2 hrs and 0 min <0x2c3b7680>
50      10/02/14 22:32:16.067   luup_log:243: GCal3 gc_V 0.7.0:GCal3 gc_V 0.7.0:Running Plugin ... <0x2c3b7680>
50      10/02/14 22:32:16.068   luup_log:243: GCal3 gc_V 0.7.0:Device 243 released the semaphore - reason: initialization complete <0x2c3b7680>

This looks more-or-less normal in the sense that the semaphore (probably just before the refresh) was claimed by device 243.  The other two devices were trying to startup but had to wait on 243.   The last lines show that 243 completed it's initialization and then released the semaphore.   What happened next ?   If 243 got 'lucky' and tried to get calendar info it would show as checking but there would be log info that tells us where / if it got 'stuck (again ?).   If not 243 then one of the others would have claimed the semaphore and initialized.

Need to see the rest of the log ......  The semaphore and blocking is not the problem.  It's working as it should - something else is getting in the way.
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 02, 2014, 11:20:36 pm
I started from the beginning ... By removing all ...
I recreated a module (241) with my calendar, default was GCal3241.token ??
After a reload Successfully initialized (but blocked)  He tells me it is retained after a check.

50      10/03/14 5:16:01.701    luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3241.token returned 0 <0x30d4b680>

I feel that it comes from my google calendar but I do not understand because I do not have defects in .log

In fact I have two calendars that work well ...
All other even if I create them ask me problems.

I was wondering if it's because they had no event the day before or after ...

So I add "test" with recursion each day and the module works !!!!

Is there a minimum time between two events?

After my test if I do not program some thing 24 hours after the current day, the plug gets stuck on "Checking ..."

we advance ?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 03, 2014, 12:11:13 am
I started from the beginning ... By removing all ...
I recreated a module (241) with my calendar, default was GCal3241.token ??
After a reload Successfully initialized (but blocked)  He tells me it is retained after a check.

50      10/03/14 5:16:01.701    luup_log:241: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3241.token returned 0 <0x30d4b680>

I feel that it comes from my google calendar but I do not understand because I do not have defects in .log

In fact I have two calendars that work well ...
All other even if I create them ask me problems.

I was wondering if it's because they had no event the day before or after ...

So I add "test" with recursion each day and the module works !!!!
Is gc_debug set to 3 ?   If it is not then you will only get basic logging - not details.   I think this may be the situation.

Doe the content of GCal3241.token look like this ?

{
  "access_token" : "ya29.kgDML9AF5-abc123abc123L9ljNdfQzbf9oLARmEwHG672iXe-_mvuA",
  "token_type" : "Bearer",
  "expires_in" : 3600
}

This is a good token - so one of the things that says it's ok.

I really need to see the rest of the log.   If gc_debug is set to 3 then we should see the messages we are after.

If you remove some of the plugins (when troubleshooting) then the semaphore can get 'stuck'

Just to make sure -- run this before testing

Code: [Select]
local result = os.execute("rm -f /etc/cmh-ludl/GCal3/GCal3.sem")

This will clear the semaphore file and allow things to run again.   But without gc_debug set to 3 it will be impossible to see what is happening.

Start with one plugin - make sure it is working properly - get a log file
Add another plugin (make sure gc_debug set to 3) - get a log file

step by step and we will fix this .....
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 03, 2014, 02:00:43 am
Thank you for your help Stuart;-)

So I have 3 in debug mode, I follow your instructions step by step

I'll let the log work alone today ...

I just come back to the fact that if I have nothing the next 24 hours, the plug remains pending (Checking ...) and therefore block other ... If I program any event within 24 hours while normal returns and other plug ... and running again properly!

Also, if an event is not until around 6hours before it gets stuck
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 03, 2014, 09:56:35 am
Thank you for your help Stuart;-)

So I have 3 in debug mode, I follow your instructions step by step

I'll let the log work alone today ...

I just come back to the fact that if I have nothing the next 24 hours, the plug remains pending (Checking ...) and therefore block other ... If I program any event within 24 hours while normal returns and other plug ... and running again properly!

Also, if an event is not until around 6hours before it gets stuck

Please attach a copy of your log file so i can take a look
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 04, 2014, 01:43:22 am
I sent my log MP ...  ;)

We can see there has midnight blockage ... What i see is that there is nothing planned for the day or the next day ... I could be wrong but if i program something, the plug returns to work  :o
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 04, 2014, 03:09:55 am
Good morning Stuart!  ;D ;D ;D

No lessons scheduled today. gc_EventsToday is not zeroed (is zeroed even a word? I don't know) if no events found. Manual GCalCheck doesn't help either.

I wish you a nice weekend :D
Title: Re: GCAL3 - Google Calendar 3
Post by: geoay on October 04, 2014, 12:42:46 pm
I am facing some issues with the Plug-in.
I installed it successfully. I was able to see my Google Calendar.
But now it doesn't work anymore ...
When I start Vera  I got Successfully initialized in the Plug-in interface.
But when I click the check button,  then agenda... No more agenda displayed.
I  record some log and I got this :

Device_Variable::m_szValue_set device: 396 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-10-04T14:41:44 now: 2014-10-04T14:41:54 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x306b3680>
06   10/04/14 14:41:54.102   Device_Variable::m_szValue_set device: 396 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x306b3680>
50   10/04/14 14:41:54.102   luup_log:396: GCal3 gc_V 0.7.0:Checking semaphore <0x306b3680>
50   10/04/14 14:41:54.125   luup_log:396: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x306b3680>
50   10/04/14 14:41:54.125   luup_log:396: GCal3 gc_V 0.7.0:Semaphore file returned 396 <0x306b3680>
50   10/04/14 14:41:54.148   luup_log:396: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x306b3680>
50   10/04/14 14:41:54.149   luup_log:396: GCal3 gc_V 0.7.0:Device 396 claimed semaphore <0x306b3680>
50   10/04/14 14:41:54.150   luup_log:396: GCal3 gc_V 0.7.0:StartMin is 2014-10-04T00:00:00.000Z StartMax is 2014-10-05T15:41:54.000Z <0x306b3680>
50   10/04/14 14:41:54.151   luup_log:396: GCal3 gc_V 0.7.0:Function: requestCalendar <0x306b3680>
50   10/04/14 14:41:54.173   luup_log:396: GCal3 gc_V 0.7.0:Command ls /etc/cmh-ludl/GCal3/GCal3396.token returned 0 <0x306b3680>
50   10/04/14 14:41:54.418   luup_log:396: GCal3 gc_V 0.7.0:token info status: HTTP/1.1 200 OK __LEAK__ this:73728 start:2109440 to 0x1bc8000 <0x306b3680>
50   10/04/14 14:41:54.421   luup_log:396: GCal3 gc_V 0.7.0:Token will expire in 3196 sec <0x306b3680>
50   10/04/14 14:41:54.421   luup_log:396: GCal3 gc_V 0.7.0:Checking google calendar <0x306b3680>
50   10/04/14 14:41:54.422   luup_log:396: GCal3 gc_V 0.7.0:Requested url: https://www.googleapis.com/calendar/v3/calendars/xxxxxxxf8qbvhfr3ogmr73s2nio@group.calendar.google.com/events?access_token=xxxxxxxxx57meI4H-0TZEpBrnymDpR1maxA89bhBKPVdV-mmVoyYVh-6gnr&timeZone=utc&singleEvents=true&orderBy=startTime&timeMax=2014-10-05T15:41:54.000Z&timeMin=2014-10-04T00:00:00.000Z&fields=items(description%2Cend%2Cstart%2Csummary) <0x306b3680>
50   10/04/14 14:41:54.697   luup_log:396: GCal3 gc_V 0.7.0:Calendar request status: HTTP/1.1 200 OK __LEAK__ this:73728 start:2183168 to 0x1bda000 <0x306b3680>
01   10/04/14 14:41:54.698   LuaInterface::CallFunction_Timer-5 function GCalMain failed /usr/lib/lua/json.lua:366: Unexpected character at Line 2 character 13: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
Context:

(I put some xxx in token  for confidentiality)
What about this :function GCalMain failed ??
The most  strange is everything was running perfectly 3 days ago.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 04, 2014, 01:23:48 pm
Thanks guys -- this log info will be helpful.   I'll take a look later today and either have a fix or some instrumented code.  What it looks like is that there is a call 'hanging' .  This causes the semaphore to stay with the 'hung' plugin instance and block the others.
Title: Re: GCAL3 - Google Calendar 3
Post by: Fear Na Boinne on October 04, 2014, 02:36:36 pm
Just wanted to say Thanks for this plugin!   :D
Title: Re: GCAL3 - Google Calendar 3
Post by: geoay on October 04, 2014, 05:26:50 pm
It seems that if there is no event in the calendar for a period of 24 hours,  the Plug-in hangs..?
Not tested myself but viewed on the main French Home Automation forum.
If it can help.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 04, 2014, 10:27:19 pm
50   10/04/14 14:41:54.697   luup_log:396: GCal3 gc_V 0.7.0:Calendar request status: HTTP/1.1 200 OK __LEAK__ this:73728 start:2183168 to 0x1bda000 <0x306b3680>
01   10/04/14 14:41:54.698   LuaInterface::CallFunction_Timer-5 function GCalMain failed /usr/lib/lua/json.lua:366: Unexpected character at Line 2 character 13: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)

It seems that if there is no event in the calendar for a period of 24 hours,  the Plug-in hangs..?
Not tested myself but viewed on the main French Home Automation forum.
If it can help.

It looks like google calendar is returning something that is not being properly decoded - it's possible that there may be a language specific 'something' going on.

I'm running three plugin instances for testing and have not seen this issue and don't know how to recreate it .....

This patched version does two things (1) logs the raw calendar data (2) checks for an 'items' entry and (3) has some new (slightly experimental) code to remove any hanging semaphores during a restart.

My calendar - with no events - produces a log entry like this:
50      10/04/14 20:15:42.047   luup_log:10: GCal3 V 0.7.3:*************************************************************************** <0x2cc3f680>
50      10/04/14 20:15:42.047   luup_log:10: GCal3 V 0.7.3:{
 "items": []
}
 <0x2cc3f680>
50      10/04/14 20:15:42.047   luup_log:10: GCal3 V 0.7.3:***************************************************************************

These should get us much closer ....    please make sure gc_debug is set to 3 for each plugin and send the log file .....

EDIT: Attachment removed.
Title: Re: GCAL3 - Google Calendar 3
Post by: aboyer on October 05, 2014, 07:38:19 pm
Hi,
I have been using Google Calendar and PLEG to turn on a light in my bedroom in the morning using the following condition:

IsNight AND WorkDayMBRLightOn AND (GoogleCalendar ==0) AND (IsNight; WorkDayMBRLightOn)

If it is still dark outside (IsNight) and it is not a holiday or a day labelled as vacation in my google calendar, the light will turn on. I can't figure out what I should be replacing "GoogleCalendar ==0" now that I have upgraded to GCal3.

I thought I could use Trigger but that doesn't seem to work.

Thanks,
Antonio
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 05, 2014, 08:11:21 pm
50   10/04/14 14:41:54.697   luup_log:396: GCal3 gc_V 0.7.0:Calendar request status: HTTP/1.1 200 OK __LEAK__ this:73728 start:2183168 to 0x1bda000 <0x306b3680>
01   10/04/14 14:41:54.698   LuaInterface::CallFunction_Timer-5 function GCalMain failed /usr/lib/lua/json.lua:366: Unexpected character at Line 2 character 13: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)

It seems that if there is no event in the calendar for a period of 24 hours,  the Plug-in hangs..?
Not tested myself but viewed on the main French Home Automation forum.
If it can help.

It looks like google calendar is returning something that is not being properly decoded - it's possible that there may be a language specific 'something' going on.

I'm running three plugin instances for testing and have not seen this issue and don't know how to recreate it .....

This patched version does two things (1) logs the raw calendar data (2) checks for an 'items' entry and (3) has some new (slightly experimental) code to remove any hanging semaphores during a restart.

My calendar - with no events - produces a log entry like this:
50      10/04/14 20:15:42.047   luup_log:10: GCal3 V 0.7.3:*************************************************************************** <0x2cc3f680>
50      10/04/14 20:15:42.047   luup_log:10: GCal3 V 0.7.3:{
 "items": []
}
 <0x2cc3f680>
50      10/04/14 20:15:42.047   luup_log:10: GCal3 V 0.7.3:***************************************************************************

These should get us much closer ....    please make sure gc_debug is set to 3 for each plugin and send the log file .....

I was looking at a log provided by Eldoctor62 and noticed that there is a problem with the info viewer log output
Unfortunately - each point where the calendar data should be - it is missing.  This seems to be a characteristic of the info viewer that I had not noticed before.
Can you use WinSCP or some other tool to get the log directly ?   /var/log/cmh/LuaUPnP.log

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 05, 2014, 08:41:55 pm

I was looking at a log provided by Eldoctor62 and noticed that there is a problem with the info viewer log output
Unfortunately - each point where the calendar data should be - it is missing.  This seems to be a characteristic of the info viewer that I had not noticed before.
Can you use WinSCP or some other tool to get the log directly ?   /var/log/cmh/LuaUPnP.log

Edit
Or use this version 0.7.4 .  I escaped the non alpha numeric characters - so it now prints the main detail in info viewer
Edit
Slight update to attachment

EDIT:
Attachment Removed
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 06, 2014, 04:06:19 am
Hi, thanks Stuart

I installed the new file and I have reproduced the problem. The log was sent by message ;-)


Envoy? depuis mon iPhone
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 06, 2014, 10:50:21 am
Hi, thanks Stuart

I installed the new file and I have reproduced the problem. The log was sent by message ;-)


Envoy? depuis mon iPhone
@Eldoctor62 --

I sent you an IM - asking you send a log to my personal email.   The first log file did not show any errors BUT was also missing log information - I am guessing because google docs was trying to interpret the calendar data as format instructions ????   The second log file could not be read.
Title: Re: GCAL3 - Google Calendar 3
Post by: geoay on October 06, 2014, 05:22:33 pm
Very strange behavior of the Plug-in     ???
On the interface the Plug-in is displaying :Gcal3.sem ??
When I click Check,  Checking is displayed then again Gcal3.sem ??
I can see my agenda but strangely :
- an event positioned in the agenda at the current time slot doesn't appear
- an  event positioned a week later is visible
NextEvent always display nothing.
I don't understand how I can use the Plug-in..?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 06, 2014, 08:44:21 pm
Very strange behavior of the Plug-in     ???
On the interface the Plug-in is displaying :Gcal3.sem ??
When I click Check,  Checking is displayed then again Gcal3.sem ??
I can see my agenda but strangely :
- an event positioned in the agenda at the current time slot doesn't appear
- an  event positioned a week later is visible
NextEvent always display nothing.
I don't understand how I can use the Plug-in..?

Gcal3.sem ?? means that the plugin could not read the file GCal3.sem from your vera.  This should never happen.  Does a reload fix it ?

When you say an event positioned in the agenda at the current time slot doesn't appear - do you mean in the tab that says 'Calendar' ?  If so - this is just looking at your calendar from google and showing what is there.  The plugin is not doing any interpretation in this tab.  If there is no event showing up then the plugin cannot do anything.   Do you have more than one calendar and when you look at it in google you are seeing events from multiple calendars ?   The plugin can only react to events in the calendar you specify (even if others are visible from the google interface).

Have you read the instructions ?  The instructions will tell you different ways to use the plugin.  If the instructions are not clear - let me know and I can make them better.
The simplest way to test is to put an all day event in the calendar and you should see it in the plugin (after pressing check)




Title: Error with no events
Post by: Stuart on October 06, 2014, 11:00:55 pm
For those who are experiencing an error when there are no events in the calendar ... the error (from Eldoctor62 log file - thanks !) shows up when the json.lua module attempts to decode the json results returned by google.  In the log file it looks like the google results are the same as I get I get in my tests - BUT my json.lua does not create errors.

I am wondering if there is any chance that your vera's have a different json.lua to the one i'm using?.  If there was no json.lua in your system - the plugin downloads the version I am using.  If there was already a json.lua it does not.

So there is a possibility that some other plugin downloaded a different  json.lua module in the past ......

Attached is v0.7.5.  In prior versions, I tested to see if the first event was nil.  This test happened after converting the json to a Lua table.
In this version I am testing for the string that represents no events "items":[] .  If that string is there then I do not attempt to decode.

Lets see if this helps narrow down the problem


EDIT: Attachment Removed
Title: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 07, 2014, 01:48:53 am
Hello Stuart,

Thank you for your 0.7.5 file;-) he has passed the test without problem !! 

I'll leave it working normally and make available to the user French ... I will return to you

Nice work anyway, and thank you for your listening

have a nice day
Title: Re: GCAL3 - Google Calendar 3
Post by: geoay on October 07, 2014, 05:19:21 am
Very strange behavior of the Plug-in     ???
On the interface the Plug-in is displaying :Gcal3.sem ??
When I click Check,  Checking is displayed then again Gcal3.sem ??
I can see my agenda but strangely :
- an event positioned in the agenda at the current time slot doesn't appear
- an  event positioned a week later is visible
NextEvent always display nothing.
I don't understand how I can use the Plug-in..?

New Gcal3.lua loaded.
No more Gcal3.sem ?? displayed. Great !
And for the second issue...I apologize... ::)
I am not very familiar with Google Agenda and I put my events in an other Agenda than the one checked by the plugin (all agendas were displayed simultaneously, that why I have been confused) !
Now I can perfectly see all my events.
Next step : use them to trip scene !
Thank's again for your help  :) :)

Gcal3.sem ?? means that the plugin could not read the file GCal3.sem from your vera.  This should never happen.  Does a reload fix it ?

When you say an event positioned in the agenda at the current time slot doesn't appear - do you mean in the tab that says 'Calendar' ?  If so - this is just looking at your calendar from google and showing what is there.  The plugin is not doing any interpretation in this tab.  If there is no event showing up then the plugin cannot do anything.   Do you have more than one calendar and when you look at it in google you are seeing events from multiple calendars ?   The plugin can only react to events in the calendar you specify (even if others are visible from the google interface).

Have you read the instructions ?  The instructions will tell you different ways to use the plugin.  If the instructions are not clear - let me know and I can make them better.
The simplest way to test is to put an all day event in the calendar and you should see it in the plugin (after pressing check)
Title: Re: GCAL3 - Google Calendar 3
Post by: jrt8587 on October 07, 2014, 11:53:07 am
Putting this here in case anyone else has trouble. 

I created two GCal 3 instances - one for my calendar, the other for my wife's.

I followed the setup instructions completely for each instance, including the creation of a separate Google service API account for each instance.  When I configured the second instance, the first instance started giving an http 404 error.  After poking around in the logs, I discovered that (it appears) each GCal instance must use the same Google API account.  So it was as simple as sharing both calendars with the same Google API account email address (instead of using a different one for each calendar).  Hope this helps someone.

Thanks to Stuart for all his great work on this.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 07, 2014, 09:59:20 pm
Putting this here in case anyone else has trouble. 

I created two GCal 3 instances - one for my calendar, the other for my wife's.

I followed the setup instructions completely for each instance, including the creation of a separate Google service API account for each instance.  When I configured the second instance, the first instance started giving an http 404 error.  After poking around in the logs, I discovered that (it appears) each GCal instance must use the same Google API account.  So it was as simple as sharing both calendars with the same Google API account email address (instead of using a different one for each calendar).  Hope this helps someone.

Thanks to Stuart for all his great work on this.


This is correct - there is only one set of credentials (GCal3.json) shared across all the plugin instances.

Thank you for describing it perfectly.
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 07, 2014, 11:46:31 pm
Hi Stuart,

I currently have an event but the plug is not "Tripped" how is this possible?

Yet the bulb is turned on, the gc_TrippedEvent is knowledgeable ...
Title: Re: GCAL3 - Google Calendar 3
Post by: conchordian on October 08, 2014, 03:22:30 am
Hi Stuart,

I currently have an event but the plug is not "Tripped" how is this possible?

Yet the bulb is turned on, the gc_TrippedEvent is knowledgeable ...

Try putting the event name beside: gc_Keyword
Title: Re: GCAL3 - Google Calendar 3
Post by: geoay on October 08, 2014, 08:12:59 am
I have some issue with the reliability of gc_Value.  :(
I tried one time and it works perfectly.
Today new test...and nothing in the gc_Value. I checked the syntax of the event. It's fitting the model :  EVENT {value}.
Any explanation for this strange behavior.
(I had to reboot my Vera because again I was facing a Gcalsem??)
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 08, 2014, 12:23:31 pm
Try putting the event name beside: gc_Keyword
Yea thanks but Tripped it's just 0 or 1 ... This can be more boring for some events  ;)
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 08, 2014, 12:53:23 pm
I have some issue with the reliability of gc_Value.  :(
I tried one time and it works perfectly.
Today new test...and nothing in the gc_Value. I checked the syntax of the event. It's fitting the model :  EVENT {value}.
Any explanation for this strange behavior.
(I had to reboot my Vera because again I was facing a Gcalsem??)

I will need a log file to really help.  Are you on V0.7.5 ?
Are you using a keyword ?  What do the other settings look like ?

The more info the better !!  :-)
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 08, 2014, 12:55:08 pm
Try putting the event name beside: gc_Keyword
Yea thanks but Tripped it's just 0 or 1 ... This can be more boring for some events  ;)
Tripper or not tripped is a function of vera - not the plugin.
In the documentation there are described various alternatives that will likely give you some less boring possibilities :-)
Title: Re: GCAL3 - Google Calendar 3
Post by: geoay on October 08, 2014, 05:42:26 pm
How can I use the gc_Value provided by the Plug-in after a  tripped event?
I would like to use it in Lua code for parametring a scene.
More generally  how to access all the data than the Plug-in can deliver?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 08, 2014, 09:25:33 pm
How can I use the gc_Value provided by the Plug-in after a  tripped event?
I would like to use it in Lua code for parametring a scene.
More generally  how to access all the data than the Plug-in can deliver?

Use some code like this

Code: [Select]
local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
 -- change myGooglePlugin to be your GCal3 plugin device #
local myGooglePlugin = 8
local eventValue = luup.variable_get(GCAL_SID, "gc_Value",myGooglePlugin)
Title: Version 0.7.6
Post by: Stuart on October 08, 2014, 09:53:39 pm
I beefed up the recovery from a locked semaphore.

V 0.7.6

EDIT
Attachment removed
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 09, 2014, 02:26:28 pm
Thanks Stuart good Work ;-)


Envoy? depuis mon iPhone
Title: Re: GCAL3 - Google Calendar 3
Post by: Eldoctor62 on October 10, 2014, 11:45:14 am
hi,
I have a little question:

I would serve NextEvent variable.

But as we can see from the pictures ... For me the NextEvent would be "M"

But the plug lifts my "A" ...

Is it because it's the whole day.?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 10, 2014, 04:04:23 pm
hi,
I have a little question:

I would serve NextEvent variable.

But as we can see from the pictures ... For me the NextEvent would be "M"

But the plug lifts my "A" ...

Is it because it's the whole day.?

Screenshot from the documentation attached

What this means is that gc_Next Event indicates what the next event will be unless that event is happening 'now' - in which case it is the currently tripped or active event.  When the current event finishes, then gc_Next event will be the next one to trigger or become active.

Since you do not have any keyword set (gc_Keyword) then the event is 'active' as opposed to 'tripped' and hence Tripped=0

In your situation - the all day event is 'now'  so that is gc_NextEvent





Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 11, 2014, 02:43:06 am
Good morning Stuart!  ;D ;D ;D

No lessons scheduled today. gc_EventsToday is not zeroed (is zeroed even a word? I don't know) if no events found. Manual GCalCheck doesn't help either.

I wish you a nice weekend :D

Hi Stuart

The issue described in the quote above still exists. I was reminded today because the PLEG logic I rely on believes there are events in the calendar today. (But there is nothing at all in the Google Calendar for today.) The gc_EventsToday value, of 8 originates from yesterday. Otherwise the GCal III is working very well here. Thank You Stuart.

pEventsLeftToday   SchoolGCal   gc_EventsLeftToday   0   2014-10-10 13:35:02.002    2014-10-10 12:25:01.933
pEventsToday   SchoolGCal   gc_EventsToday   8   2014-10-09 00:00:07.897    2014-10-07 00:00:07.942
Title: Re: GCAL3 - Google Calendar 3
Post by: minimoibientot on October 11, 2014, 05:50:56 am
hello Stuart
I use this plug-in and thank you for the help

I have a slight concern with the variable : gc_Value

in my diary I have this event :
lampe{ext_on} or charge{ON}

GCal3 is no gc_keyword + gc_triggerNoKeyword = true

trigger scene : GCal3 + Armed event matches keyword + armed and tripped ( OK )

with GCal 1; my scene was this one ( OK )
Code: [Select]
luup :
-- Declarations
local json = require("json")
local Id_GCal = 102
-- Recuperation des evenements sur le GCAL Sensor
local gcalval = luup.variable_get("urn:utz-com:serviceId:GCal1", "gcalval", Id_GCal)
-- PROGRAMMES ON, OFF
if (gcalval == "ext_ON") then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=1}, Id_lampeExt)
end


with GCal 3 ; my modified scene ( no OK )
Code: [Select]
luup :
-- Declarations
local json = require("json")
local Id_GCal = 206
-- Recuperation des evenements sur le GCAL Sensor
local gc_Value = luup.variable_get("urn:srs-com:serviceId:GCalIII", "gc_Value", Id_GCal)
-- PROGRAMMES ON, OFF
if (gc_Value= "ext_ON") then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=1}, Id_lampeExt)
end
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 11, 2014, 11:01:39 am
Good morning Stuart!  ;D ;D ;D

No lessons scheduled today. gc_EventsToday is not zeroed (is zeroed even a word? I don't know) if no events found. Manual GCalCheck doesn't help either.

I wish you a nice weekend :D

Hi Stuart

The issue described in the quote above still exists. I was reminded today because the PLEG logic I rely on believes there are events in the calendar today. (But there is nothing at all in the Google Calendar for today.) The gc_EventsToday value, of 8 originates from yesterday. Otherwise the GCal III is working very well here. Thank You Stuart.

pEventsLeftToday   SchoolGCal   gc_EventsLeftToday   0   2014-10-10 13:35:02.002    2014-10-10 12:25:01.933
pEventsToday   SchoolGCal   gc_EventsToday   8   2014-10-09 00:00:07.897    2014-10-07 00:00:07.942


My Bad !  I had put in some additional code to detect 'no events' which was not working for some people.  Possibly because they had a different json.lua module already installed - possibly because of some data difference from google in different countries.  When I put this code in I forgot to zero gc_EventsToday.

I have made a change and done this quick test:
1) added an event today that is after 'now'
2) pressed 'check'
3) pressed F5 and then opened advanced tab - both gc_Events and gc_EventsToday = 1
4) removed the calendar event
2) pressed 'check'
3) pressed F5 and then opened advanced tab - both gc_Events and gc_EventsToday = 0

I have added a calendar event back in for today - and will check after the event has finished naturally.
EDIT:  By naturally, I mean after midnight i.e. tomorrow :-)

If you want to try the changed code - here it is:  V 0.7.7

  EDIT: Attachment Removed
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 11, 2014, 11:08:37 am
Thank You! I'm testing it now.  ;)
Title: Re: GCAL3 - Google Calendar 3
Post by: minimoibientot on October 14, 2014, 01:33:53 pm
good evening

no idea for :
gc_Value
in a scene ?

thank you
Title: Re: GCAL3 - Google Calendar 3
Post by: Maeglin on October 14, 2014, 06:01:23 pm
Thanks for the 0.7.7 update. I was having similar semaphore problems, but the 2 instances I have are now at least starting correctly.

I don't have time today to test for event triggering, but will do that later this week.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 14, 2014, 06:31:26 pm
good evening

no idea for :
gc_Value
in a scene ?

thank you

I'm not sure what you are asking ?   If you are asking what could you use it for - something like this

An event Heating {25}   and another event Heating {15}

When the first event is active gc_Value = 25 and when the second event active gc_Value = 15.   If you had an event based on the event 'Heating' you could set the temperature to 25 on the first event and 15 on the second.

Title: V 8.0 Beta
Post by: Stuart on October 14, 2014, 06:49:27 pm
For those who want to try it ....  It's the same as 0.7.7 with a few additions.
The main addition was to support public google calendars and the calendar set procedure.  I plan on testing for a couple more days and then releasing this as V0.8 in the marketplace.

The summary of changes from 0.7.0 is:

1. Changed the calendar set procedure.  No longer need to save and reload.  As soon as the CalendarId is set - the plugin will check and try to use it.
2. Added extra detection for 'no events' that was failing for some users, possibly to do with json decode module, possibly because of different data returned by google.
3. The calendar now checks at midnight (actually a second past) for events, independently of the normal checks
4. A new variable gc_EventsToday.  This gives a count of the number of events that match your selection criteria for the current day.
  This gets updated at each event during the day.  Unless you add / delete events during the day - it will remain constant.
5. A new variable gc_EventsLeftToday.  This gives a count of the remaining number of events for the current day that match your selection criteria.
  This gets updated at each event during the day.  It will start out (at midnight) being the same as gc_EventsToday and count down to zero
  (i.e. after the last event that day).
6. Improved the semaphore reset on startup.  Should not get any more semaphore locks. Blocking for a few seconds is normal !
7. Added support for public calendars (as a separate plugin instance).

NOTE to support more variety of google calendars- it was necessary to change the input for the CalendarID to a full url style.  This is because they are not identical in format .
Broadly speaking, any calendar of the form
https://www.google.com/calendar/ ...... &src=[something]@group.calendar.google.com ....
should work.

YOU WILL ALSO NEED TO CHANGE YOUR EXISTING PERSONAL CalendarID SETTING.
 
To get the correct url.  Go to your calendar setup page, select the calendar and where it says Embeded this Calendar copy the link where it says
"paste this code into your website" and use that link as the calendar ID for the plugin.  The plugin will extract the necessary portions.
Here is an example personal  site:
<iframe src="https://www.google.com/calendar/embed?src=yourgoogleid%40gmail.com
&ctz=America/Denver" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>


And here is a public site (this for the Miami Heat):
<iframe src="https://www.google.com/calendar/htmlembed?src=nba_14_%254diami%2B%2548eat%23sports%40group.v.calendar.google.com
&ctz=America/Denver" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>


Other public google calendars (which are not obtained from the google calendar setup) can be used and will be in the form .....
https://www.google.com/calendar ......  &src=[some calendar]@group.calendar.google.com&.........

If the link contains any of the following characters you need to substitute the encoded form.  This is a limitation of the vera input method.
The two that I know of are:
& - replace with %26
# - replace with %23
There may be others ....

For example, this link

https://www.google.com/calendar/hosted/worldcricketschedule.com/htmlembed?title=World+Cricket+Schedule&showDate=0
&showTabs=0&showCalendars=0&mode=AGENDA&height=300&wkst=1&bgcolor=%23FFFFFF
&src=vcricket.com_mbkd7ffnp0855jb3a62jq5tark@group.calendar.google.com&color=%232952A3&ctz=Asia/Calcutta

needs to be changed to

https://www.google.com/calendar/hosted/worldcricketschedule.com/htmlembed?title=World+Cricket+Schedule%26showDate=0
%26showTabs=0%26showCalendars=0%26mode=AGENDA%26height=300%26wkst=1%26bgcolor=%23FFFFFF
%26src=vcricket.com_mbkd7ffnp0855jb3a62jq5tark@group.calendar.google.com%26color=%232952A3%26ctz=Asia/Calcutta

If you are experimenting with private calendars and having an issue -- please report the full input you are entering into the CalendarID input field.

There are three files in the zip - all needed to be uploaded.

EDIT:
Version ar cumulative i.e. prior fixes are in latest versions
Newer GCal3.lua file with support for accented characters in keyword - otherwise identical to the one in the zip file.  Thanks to farang for the conversion
Version V 0.8 Beta2 - some changes to GCal3.lua
Version V 0.8 Beta3 - fixed upper / lower case issue with gc_Value

EDIT: Attachment Removed


Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 15, 2014, 02:42:06 am
Thank You Stuart for this lovely piece of programming art :D

I've installed the new version together with the GCal3.lua file with support for accented characters in keyword.

I had a minor problem with entering my personal calendar ID URL into the plugin.

Original:
Code: [Select]
https://www.google.com/calendar/embed?src=<whatever>%40gmail.com&ctz=Europe/Stockholm
Edited:
Code: [Select]
https://www.google.com/calendar/embed?src=<whatever>%40gmail.com%26ctz=Europe/Stockholm
When using the edited URL i get a 404 error. However, since the default time zone will do fine I could use the following URL:
Code: [Select]
https://www.google.com/calendar/embed?src=<whatever>%40gmail.com
Otherwise everything seems to run smoothly so far. Thank You Stuart!
Title: Re: GCAL3 - Google Calendar 3
Post by: minimoibientot on October 15, 2014, 07:11:41 am
@ Stuart

I want to use: gc_Value
for launch a action defined by the word {}

as for this stage with GCal 1

in my diary I have this event :
lampe{ext_on} or charge{ON}

GCal3 is no gc_keyword + gc_triggerNoKeyword = true

trigger scene : GCal3 + Armed event matches keyword + armed and tripped ( OK )

with GCal 1; my scene was this one ( OK )
Code: [Select]
luup :
-- Declarations
local json = require("json")
local Id_GCal = 102
-- Recuperation des evenements sur le GCAL Sensor
local gcalval = luup.variable_get("urn:utz-com:serviceId:GCal1", "gcalval", Id_GCal)
-- PROGRAMMES ON, OFF
if (gcalval == "ext_ON") then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=1}, Id_lampeExt)
end


with GCal 3 ; my modified scene ( no OK )
Code: [Select]
luup :
-- Declarations
local json = require("json")
local Id_GCal = 206
-- Recuperation des evenements sur le GCAL Sensor
local gc_Value = luup.variable_get("urn:srs-com:serviceId:GCalIII", "gc_Value", Id_GCal)
-- PROGRAMMES ON, OFF
if (gc_Value == "ext_ON") then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=1}, Id_lampeExt)
end
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 15, 2014, 12:51:40 pm
Thank You Stuart for this lovely piece of programming art :D

I've installed the new version together with the GCal3.lua file with support for accented characters in keyword.

I had a minor problem with entering my personal calendar ID URL into the plugin.

Original:
Code: [Select]
https://www.google.com/calendar/embed?src=<whatever>%40gmail.com&ctz=Europe/Stockholm
Edited:
Code: [Select]
https://www.google.com/calendar/embed?src=<whatever>%40gmail.com%26ctz=Europe/Stockholm
When using the edited URL i get a 404 error. However, since the default time zone will do fine I could use the following URL:
Code: [Select]
https://www.google.com/calendar/embed?src=<whatever>%40gmail.com
Otherwise everything seems to run smoothly so far. Thank You Stuart!



V 0.8 Beta2 should fix that problem.. Thanks
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 15, 2014, 12:58:24 pm
V 0.8 Beta2 should fix that problem.. Thanks

Thank You
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 15, 2014, 04:51:55 pm
@ Stuart

I want to use: gc_Value
for launch a action defined by the word {}

as for this stage with GCal 1

in my diary I have this event :
lampe{ext_on} or charge{ON}

GCal3 is no gc_keyword + gc_triggerNoKeyword = true

trigger scene : GCal3 + Armed event matches keyword + armed and tripped ( OK )

with GCal 1; my scene was this one ( OK )


In your code - you specify the event parameter as {ext_on} - did you mean {ext_ON} ?  The == test in the code must match the parameter exactly. If you change your code with the current version to test for gc_Value == 'EXT_ON' then it should work.  This is because there is a bug in the version you have.

gc_Value is supposed to be passed through from the event without change.  The bug was converting it to upper case.  i.e. gc_Value = EXT_ON.

I have corrected this bug in in V 0.8 beta 3

Here are the results of my test with V0.8 beta 3
the first is the event
the second shows the advanced settings when the event is active
the third shows the triggers when the event is active
the fourth shows the triggers if  gc_triggerNoKeyword = false


Please try the V0.8 Beta 3 version posted here
http://forum.micasaverde.com/index.php/topic,26692.msg197910.html#msg197910 (http://forum.micasaverde.com/index.php/topic,26692.msg197910.html#msg197910)
Title: Re: GCAL3 - Google Calendar 3
Post by: minimoibientot on October 16, 2014, 11:15:12 am
it works perfectly with the 0.8 beta 3
thank you Stuart

Another little question:
is it possible to display an event in three days or see more?

example:
in my calendar, I have an event with a recurrence every 3 days
Currently, my GCal 3 displays "no event found today"
Title: Re: GCAL3 - Google Calendar 3
Post by: guest141575 on October 16, 2014, 11:20:26 am
Another little question:
is it possible to display an event in three days or see more?

What happens if You set gc_Interval to 4320? It's just an idea and I'm not sure it will work. A side effect would be that automatic updates will happen every midnight only.
Title: Re: GCAL3 - Google Calendar 3
Post by: minimoibientot on October 16, 2014, 11:53:12 am
this is perfect
thank you farang
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 16, 2014, 12:53:12 pm
Another little question:
is it possible to display an event in three days or see more?

What happens if You set gc_Interval to 4320? It's just an idea and I'm not sure it will work. A side effect would be that automatic updates will happen every midnight only.

Another side effect is that if you add an event to your calendar that would occur between 'now' and midnight (and you wanted the plugin to react to)  - that event would not show up unless you manually did a 'check' on the plugin after you entered the event in the calendar.
Title: Re: GCAL3 - Google Calendar 3
Post by: korttoma on October 23, 2014, 12:21:37 am
Hi Stuart, seems like no one has reported any issues with v 0.8 in a week so will it be available through the app store soon?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 23, 2014, 06:33:36 pm
Hi Stuart, seems like no one has reported any issues with v 0.8 in a week so will it be available through the app store soon?

I sent it to the marketplace today.   May be out tomorrow (Oct 24) but more likely Monday Oct 27.
Title: Re: GCAL3 - Google Calendar 3
Post by: korttoma on October 24, 2014, 12:08:32 am
Thanks @Stuart. time has come for me to ditch the old (original) google calender switch ;)
Title: Re: GCAL3 - Google Calendar 3
Post by: kariem112 on October 27, 2014, 07:47:00 am
I have installed the plugin, but I think something is wrong. I am using the latest version (from this thread, version 8) . I can see my calendar in the plugin. I can also see the next event. The only problem is that this (and all other events) event is called NO NAME. I created several test events, filled out name, description etc. In the advanced tab, I can see the correct ammount of events for the rest of the day, but not the correct name.

I am using a private calendar and UI7 on my vera.

Any clue on how to solve this?

ps. I am using this link for my calendar:
https://www.google.com/calendar/embed?src=info%XXXXXXX.nl
Title: Re: GCAL3 - Google Calendar 3
Post by: clippermiami on October 27, 2014, 11:53:31 am
1. I am attempting to install this Plug in. I have followed all the directions and I get "GCal3.email ??" but the calendar data is displayed properly in the calendar Tab. Is this normal?

2. I have the key JSON file on my notebook. Because its a key does this mean the calendar information will not be available on a tablet without the key JSON file?
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 27, 2014, 12:17:11 pm
I have installed the plugin, but I think something is wrong. I am using the latest version (from this thread, version 8) . I can see my calendar in the plugin. I can also see the next event. The only problem is that this (and all other events) event is called NO NAME. I created several test events, filled out name, description etc. In the advanced tab, I can see the correct ammount of events for the rest of the day, but not the correct name.

I am using a private calendar and UI7 on my vera.

Any clue on how to solve this?

ps. I am using this link for my calendar:
https://www.google.com/calendar/embed?src=info%XXXXXXX.nl

I can see that you are BRAVE  ......   using UI7 .......   ;D
I have not tested on UI7 yet - or even installed UI7 on my vera (as I have a couple of things I want to complete before I do that)
I'm willing to try and figure out (if it's just a configuration issue) if you are.

The url looks to be of the correct form and it shows in the calendar tab - so that's a good thing.
I have not seen this problem before with UI5 so -- can you get a log file please (make sure gc_debug is set to 3)? 
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 27, 2014, 12:30:31 pm
1. I am attempting to install this Plug in. I have followed all the directions and I get "GCal3.email ??" but the calendar data is displayed properly in the calendar Tab. Is this normal?

2. I have the key JSON file on my notebook. Because its a key does this mean the calendar information will not be available on a tablet without the key JSON file?

The GCal3.json keyfile needs to be uploaded to the vera.   The details are in the instructions (you can use the V0.7 instructions).   This error you are seeing is likely to be happening because you have not yet uploaded the GCal3.json file.

Also - which version are you using ?   Did you install V0.7 and then the V0.8beta3 patches ?

V0.8 was submitted to the marketplace two days ago and should be released in the next day or two.

Title: Re: GCAL3 - Google Calendar 3
Post by: clippermiami on October 27, 2014, 01:25:21 pm
1. I uploaded the JSON file
2. I set the calendar address
3. I closed the plugin, reloaded and refreshed the browser
4. I correctly see the calendar and the test event on the calendar tab
5. I get "http error code 404" on the opening tile and control tab

So, its working but it isn't working.

This is version 0.7 from the App store. BTW, the App "Help'" leads to a non-existent web page

UPDATE: I went back to Google Calendar and despite having entered AND SAVED the client email address TWICE it wasn't  there. So I entered and saved it yet again and now the plug in seems to be working (and the client email address is finally in the shared list. Third time is the charm i guess.)

Anyway its working so ...

Thanks
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 27, 2014, 01:42:54 pm
1. I uploaded the JSON file
2. I set the calendar address
3. I closed the plugin, reloaded and refreshed the browser
4. I correctly see the calendar and the test event on the calendar tab
5. I get "http error code 404" on the opening tile and control tab

So, its working but it isn't working.

This is version 0.7 from the App store. BTW, the App "Help'" leads to a non-existent web page

The error code 404 usually means that the calendar cannot be found ....  but that seems a little strange given that it appears in the calendar tab.  It can also happen if the credentials are incorrect.

Please update the three files posted here:

http://forum.micasaverde.com/index.php/topic,26692.msg197910.html#msg197910

This will bring you up to the V0.8beta3 version (identical to the V0.8 that will be in the marketplace shortly).  Pay particular attention to the notes on setting the CalendarID that are in this post.  The CalendarID was changed between V0.7 and V0.8.


I'll fix the broken link on the help -- but the help is the documentation and it can be found here (page 1 of this thread)

http://forum.micasaverde.com/index.php/topic,26692.msg189513.html#msg189513

If you still have a problem - please get an error log with gc_debug set to 3.   If you are unfamiliar with getting logs - the very nice Info Viewer plugin is terrific.  It can be found here:

http://forum.micasaverde.com/index.php/topic,13477.0.html



Title: Re: GCAL3 - Google Calendar 3
Post by: clippermiami on October 27, 2014, 04:35:22 pm
I have no idea but for some reason I had to share/save the address three times in Google before it actually did. Once it actually saved it everything seems to be OK.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 27, 2014, 09:58:33 pm
I have no idea but for some reason I had to share/save the address three times in Google before it actually did. Once it actually saved it everything seems to be OK.

A mystery then ..... ???

Good that it's working now .... enjoy.
Title: Re: GCAL3 - Google Calendar 3
Post by: kariem112 on October 28, 2014, 05:18:44 am
I have installed the plugin, but I think something is wrong. I am using the latest version (from this thread, version 8) . I can see my calendar in the plugin. I can also see the next event. The only problem is that this (and all other events) event is called NO NAME. I created several test events, filled out name, description etc. In the advanced tab, I can see the correct ammount of events for the rest of the day, but not the correct name.

I am using a private calendar and UI7 on my vera.

Any clue on how to solve this?

ps. I am using this link for my calendar:
https://www.google.com/calendar/embed?src=info%XXXXXXX.nl

I can see that you are BRAVE  ......   using UI7 .......   ;D
I have not tested on UI7 yet - or even installed UI7 on my vera (as I have a couple of things I want to complete before I do that)
I'm willing to try and figure out (if it's just a configuration issue) if you are.

The url looks to be of the correct form and it shows in the calendar tab - so that's a good thing.
I have not seen this problem before with UI5 so -- can you get a log file please (make sure gc_debug is set to 3)?

 8) living on the edge with UI7. I have to admit that the latest release is kinda stable  ;) but it has some problems with some plugins. One of them is the log file viewer. This is the Lualog, how can I get the complete logfile for you?

(I have set debug level to 3 and did a manual check:

Code: [Select]
08 10/28/14 10:14:52.235 JobHandler_LuaUPnP::HandleActionRequest device: 34 service: urn:srs-com:serviceId:GCalIII action: GCalCheck <0x2d6b4680>
08 10/28/14 10:14:52.235 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=34 <0x2d6b4680>
08 10/28/14 10:14:52.236 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:srs-com:serviceId:GCalIII <0x2d6b4680>
08 10/28/14 10:14:52.236 JobHandler_LuaUPnP::HandleActionRequest argument action=GCalCheck <0x2d6b4680>
06 10/28/14 10:14:52.236 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: 17:30 Oct 28 to 18:30 Oct 28 now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2d6b4680>
06 10/28/14 10:14:52.251 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: NO NAME now: Checking ... #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2d6b4680>
06 10/28/14 10:14:53.101 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-10-28 at 10:12:49 now: 2014-10-28 at 10:14:53 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2cab4680>
06 10/28/14 10:14:53.102 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [{'eventEnd':1414517435,'eventStart':1414513835,'eventParameter':'','eventName':'NO NAME'}] now: [] #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2cab4680>
50 10/28/14 10:14:53.136 luup_log:34: GCal3 V 0.8 Beta3:Device 34 claimed semaphore <0x2cab4680>
06 10/28/14 10:14:53.301 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Accessing Calendar #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 __LEAK__ this:81920 start:1196032 to 0x13bb000 <0x2cab4680>
06 10/28/14 10:14:53.302 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2cab4680>
06 10/28/14 10:14:53.482 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Accessing Calendar now: Calendar Access Success #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 __LEAK__ this:73728 start:1269760 to 0x13cd000 <0x2cab4680>
06 10/28/14 10:14:53.482 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2cab4680>
50 10/28/14 10:14:53.484 luup_log:34: GCal3 V 0.8 Beta3:Device 34 released the semaphore - reason: calendar check complete <0x2cab4680>
06 10/28/14 10:14:53.484 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Calendar Access Success now: Checking Events #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2cab4680>
06 10/28/14 10:14:53.485 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2cab4680>
06 10/28/14 10:14:53.493 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_EventsToday was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2cab4680>
06 10/28/14 10:14:53.493 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_EventsLeftToday was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2cab4680>
06 10/28/14 10:14:53.494 Device_Variable::m_szValue_set device: 34 service: urn:srs-com:serviceId:GCalIII variable: gc_ActiveEvents was:  now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2cab4680>
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 28, 2014, 11:49:53 am

(I have set debug level to 3 and did a manual check:


The log file is incomplete - perhaps UI7 changed the log setup ?

Try using this from your browser
http://[your local ip]/cgi-bin/cmh/log.sh?Device=LuaUPnP

In the limited log file - I looks like it's working properly and getting the data from the calendar

I can see from the line

gc_jsonEvents was: [{'eventEnd':1414517435,'eventStart':1414513835,'eventParameter':'','eventName':'NO NAME'}] now: []

The calendar previously returning ONE event - the calendar provides 'NO NAME', not the plugin.   Then the calendar says there are no events i.e. [].   Does that make sense relative to what you actually have in your calendar - apart from event titles ?

One possibility - If your calendar is set to be public and only show free/busy time then the events will show up but with 'NO NAME'

Title: Re: GCAL3 - Google Calendar 3
Post by: kariem112 on October 28, 2014, 02:27:19 pm

(I have set debug level to 3 and did a manual check:


The log file is incomplete - perhaps UI7 changed the log setup ?

Try using this from your browser
http://[your local ip]/cgi-bin/cmh/log.sh?Device=LuaUPnP

In the limited log file - I looks like it's working properly and getting the data from the calendar

I can see from the line

gc_jsonEvents was: [{'eventEnd':1414517435,'eventStart':1414513835,'eventParameter':'','eventName':'NO NAME'}] now: []

The calendar previously returning ONE event - the calendar provides 'NO NAME', not the plugin.   Then the calendar says there are no events i.e. [].   Does that make sense relative to what you actually have in your calendar - apart from event titles ?

One possibility - If your calendar is set to be public and only show free/busy time then the events will show up but with 'NO NAME'
:) thanxs, that got me on the right track. I dont know why, but the shared option in my calender was "show free/busy only. Changed it, and now the events come in with their correct name!

Title: Re: GCAL3 - Google Calendar 3
Post by: bubaleta on October 29, 2014, 07:49:05 am
Hello,

I'm using version 0.8 and have some similar symptoms.
Also got  the GCal3.email ?? error at first.
Now it seams to work ok and events are triggered, but I can't see the calendar tab.
It only shows 404 error, despite events are working correctly.



Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 29, 2014, 02:55:32 pm
Hello,

I'm using version 0.8 and have some similar symptoms.
Also got  the GCal3.email ?? error at first.
Now it seams to work ok and events are triggered, but I can't see the calendar tab.
It only shows 404 error, despite events are working correctly.

Since the web UI does not refresh automatically - is it possible that this 404 message is left over from the previous steps ?   Try F5 to refresh and see if the calendar tab shows your calendar.

If it still does not - open the advanced tab an copy the link information from gc_CalendarID  this is what is being used to try and display the info in the calendar tab.  See if it works from directly from the browser.  If it still does not work - can you IM me the link so I can see if it's got anything strange in it.
Title: Re: GCAL3 - Google Calendar 3
Post by: korttoma on October 30, 2014, 04:39:22 am
Successfully replaced Gcal with GCal3 V. 0.8. Everything seems to work as expected. Thanks again Stuart for your awesome work!

Still running UI5, btw... not courageous enough to update (maybe next year).
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 30, 2014, 11:49:53 am

 :) thanxs, that got me on the right track. I dont know why, but the shared option in my calender was "show free/busy only. Changed it, and now the events come in with their correct name!

This is good news.  Are you using the calendar as private ? That is no checkboxes ? and using credentials ?     The reason I ask is I'm very interested in your experience on UI7.
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 30, 2014, 11:52:25 am
Successfully replaced Gcal with GCal3 V. 0.8. Everything seems to work as expected. Thanks again Stuart for your awesome work!

Still running UI5, btw... not courageous enough to update (maybe next year).

Excellent.    Maybe Kariem112's experience will be positive - lets hope so.    I will switch over to UI7 soon - but want to make sure we have a very stable version for UI5 just in case the code needs to be different for UI7.
Title: Re: GCAL3 - Google Calendar 3
Post by: Don Diego on October 30, 2014, 12:42:25 pm
Successfully replaced Gcal with GCal3 V. 0.8. Everything seems to work as expected. Thanks again Stuart for your awesome work!

Still running UI5, btw... not courageous enough to update (maybe next year).

Excellent.    Maybe Kariem112's experience will be positive - lets hope so.    I will switch over to UI7 soon - but want to make sure we have a very stable version for UI5 just in case the code needs to be different for UI7.

Stuart

 So am I to assume that for some time you'll maintain both UI5 and UI7 versions? Or will the UI7 version be backward compatible?

  Thanks for your  efforts.

   Don
Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on October 30, 2014, 04:00:35 pm


Stuart

 So am I to assume that for some time you'll maintain both UI5 and UI7 versions? Or will the UI7 version be backward compatible?

  Thanks for your  efforts.

   Don

Well -- the theory is that UI7 will allow backward compatibility.  If that turns out to be true, then great - which is why I'm interested in Kariem112's experience.   I have not been brave enough to switch to UI7 yet  :o

UI4 and UI5 were able to be compatible by including slightly different code (UI related) with exactly the same execution code.

From what I can see - the core executable code will not be affected so any differences would (hopefully) be small and probably only affect static parts of the code.  If the compatibility claim turns out to be false or difficult then I'll create two versions.   
Title: Re: GCAL3 - Google Calendar 3
Post by: Ronald on November 03, 2014, 09:35:46 am
Well -- the theory is that UI7 will allow backward compatibility.  If that turns out to be true, then great - which is why I'm interested in Kariem112's experience.   I have not been brave enough to switch to UI7 yet  :o

I called the Vera company to get my Vera 3 downgraded again.
Massive trouble with SRT321 thermostats in UI7, that made my complete heating a mess.
As I didn't like the look and feel of UI7 anyway, I am glad to have UI5 again.
Think twice, or more, before upgrading
Title: V0.9 Beta1 - Google Calendar 3
Post by: Stuart on November 03, 2014, 11:57:50 pm
This is a slightly experimental version with 2 changes from V0.8

1.  I've changed (streamlined) some of the credentials code and it's possible you may have to upload your GCal3.json file again.  On the plus side it will be a bit quicker and have less overhead with better debugging possibilities.  Basically I got rid of a shell script and absorbed most of it into Lua code.  This part is pretty robust and has been stable on my system for over a week.

2.  Some users have asked for ical support.  This is the experimental part.  I've made progress but the tricky part is the start and end times.   The way that data is stored in ical is inconsistent (allowed by the spec) .   I will be able to handle calendars that specify the start/end in utc or an unspecified 'local' time.  Usually this will be fine so long as the ical sets the events to the same time time as the vera expects or uses utc.   If the calendar has a different timezone and does not save the time in utc - then it will be difficult to interpret accurately without a lot of code ....  Also the ical link can only point to a PUBLIC calendar.  Note that the calendar tab will not work and may try to download a copy of your calendar data (such is the way of iCal) ......  but you should be able to see your events (on the front panel) and be able to trigger on those events.  Basically, the plugin (if it sees a url with 'ical' in it) downloads the calendar data, extracts the required fields and reformats them to look like a google calendar feed.

feedback welcome  ;D

EDIT:  Note that if you are trying the ical feature - the easiest way to tell if you have a 'good' url is to paste it into a browser and see if the browser attempts to download a calendar file for you.  Also the url must be in the form of http:// or https://

for example this (from google using the ICAL link)
https://www.google.com/calendar/ical/en.australian%23holiday%40group.v.calendar.google.com/public/basic.ics

or this:
 http://sports.yahoo.com/nfl/teams/sfo/ical.ics


EDIT: Attachments removed
Title: Re: GCAL3 - Google Calendar 3
Post by: kariem112 on November 04, 2014, 12:40:12 pm

 :) thanxs, that got me on the right track. I dont know why, but the shared option in my calender was "show free/busy only. Changed it, and now the events come in with their correct name!

This is good news.  Are you using the calendar as private ? That is no checkboxes ? and using credentials ?     The reason I ask is I'm very interested in your experience on UI7.
Sorry for the late reply. I am using a private calendar with no checkboxes. I have used the "share with specific people" option, and added the google developer email adres there. I am using google business apps. It works correctly in UI7. (using the latest version).
Title: Re: GCAL3 - Google Calendar 3
Post by: kariem112 on November 04, 2014, 12:41:37 pm
Well -- the theory is that UI7 will allow backward compatibility.  If that turns out to be true, then great - which is why I'm interested in Kariem112's experience.   I have not been brave enough to switch to UI7 yet  :o

I called the Vera company to get my Vera 3 downgraded again.
Massive trouble with SRT321 thermostats in UI7, that made my complete heating a mess.
As I didn't like the look and feel of UI7 anyway, I am glad to have UI5 again.
Think twice, or more, before upgrading

I am using UI7 and have the same SRT. No problems whatsover.
Title: Re: V0.9 Beta1 - Google Calendar 3
Post by: neurolizer on November 04, 2014, 02:08:04 pm
This is a slightly experimental version with 2 changes from V0.8

1.  I've changed (streamlined) some of the credentials code and it's possible you may have to upload your GCal3.json file again.  On the plus side it will be a bit quicker and have less overhead with better debugging possibilities.  Basically I got rid of a shell script and absorbed most of it into Lua code.  This part is pretty robust and has been stable on my system for over a week.

2.  Some users have asked for ical support.  This is the experimental part.  I've made progress but the tricky part is the start and end times.   The way that data is stored in ical is inconsistent (allowed by the spec) .   I will be able to handle calendars that specify the start/end in utc or an unspecified 'local' time.  Usually this will be fine so long as the ical sets the events to the same time time as the vera expects or uses utc.   If the calendar has a different timezone and does not save the time in utc - then it will be difficult to interpret accurately without a lot of code ....  Also the ical link can only point to a PUBLIC calendar.  Note that the calendar tab will not work and may try to download a copy of your calendar data (such is the way of iCal) ......  but you should be able to see your events (on the front panel) and be able to trigger on those events.  Basically, the plugin (if it sees a url with 'ical' in it) downloads the calendar data, extracts the required fields and reformats them to look like a google calendar feed.

feedback welcome  ;D

EDIT:  Note that if you are trying the ical feature - the easiest way to tell if you have a 'good' url is to paste it into a browser and see if the browser attempts to download a calendar file for you.  Also the url must be in the form of http:// or https://

for example this (from google using the ICAL link)
https://www.google.com/calendar/ical/en.australian%23holiday%40group.v.calendar.google.com/public/basic.ics

or this:
 http://sports.yahoo.com/nfl/teams/sfo/ical.ics

Loaded your new experimental GCal3.lua on top of the GCal3 v0.8 I had installed from the marketplace. I did have to re-upload my GCal3.json credentials for it to recognize them. More importantly for me though, the new iCal functionality looks to be working great. Both of my Airbnb calendars are showing the next event with the correct timezone and all. I'll to follow up later to confirm it is loading new events correctly once I get some more bookings.

Perhaps an optional timezone hour offset variable would alleviate any issues with not being able to interpret iCal timezone correctly?

Thank you so much for adding the iCal functionality and so quickly!
Title: Re: V0.9 Beta1 - Google Calendar 3
Post by: Stuart on November 04, 2014, 04:31:26 pm

Perhaps an optional timezone hour offset variable would alleviate any issues with not being able to interpret iCal timezone correctly?

Thank you so much for adding the iCal functionality and so quickly!

Good news - although I will not rejoice yet since your ical was used for some of the testing !!

On the timezone - the plugin already calculates what timezone the vera unit is in (otherwise 'all day' events would not start / stop correctly).   I apply that offset to ical if it does not specify the times in utc time.  So it looks like that is working for you.    There is a possible issue when the author of the calendar specifies a different fixed timezone.  There are (unfortunately) many ways they could define it and they are not necessarily 'standard'.
Title: Re: GCAL3 - Google Calendar 3
Post by: Ronald on November 10, 2014, 08:43:05 am
Hi Stuart,

Thanks for all your work on GCAL3!
I would like to improve funtionality by reading the eventname as a variable.
That would i.e. enable the kitchen to switch to 20 degrees centrigrad.
In that case the eventname could be something like "kitchen 20" or "kitchen [20]"

Is that already possible, or something that can be made easy?

Furthermore: is it possible to work with several calendars, and thus with several instances of the app? I suspect problems as you work with a .json file with a fixed name: GCal3.json
Would it be possible to retreive the name of the event in the calendar as a variable?

regards,
Ronald
i.e. have an eventname like "kitchen 20"
Title: Re: GCAL3 - Google Calendar 3
Post by: garrettwp on November 10, 2014, 09:15:15 am
The event name would be in the form of Kitchen{20}. For multiple calendars you would create another instance of the plugin.

- Garrett

Title: Re: GCAL3 - Google Calendar 3
Post by: Stuart on November 10, 2014, 12:26:02 pm
The variables of likely interest to you are:

Variable                    Value                                                                                    Comments
gc_TrippedEvent     An event Name or Blank                                                       Set by the device.  The name of the currently tripped event
gc_Value                 The value of an optional parameter for the tripped event       Set by the device for a triggered event. The event name can have optional text in { } at the end.
                                                                                                                            If present it will be placed into this variable as is ? without the {}

Other variables and some examples of use can be found in the documentation.
Title: V 0.9 Released to Marketplace
Post by: Stuart on November 11, 2014, 02:53:38 pm
This should be available in the next day or two.
The update notes are on the first page of this topic:
1. Updated credential handling
2. iCal support
3. Some UI changes

Three files were updated - if you cannot wait   ;) - here they are

EDIT: removed Attachments
Title: Bypass not working
Post by: Stuart on November 11, 2014, 05:39:38 pm
I have just noticed that 'Bypass'  is not doing anything in GCal3 (and probably was not doing anything possibly from the original GCal).

What I mean is that the behavior or the plugin completely ignores whether it is Armed or Bypassed.

There are three event available but two are exactly the same:
Event Matches Keyword  and Armed - Event Matches Keyword behave exactly the same.
Event has specified name, of course, is different.

I propose changing the behavior in the following way:

(1) When the plugin is Bypassed, it simply does nothing, i.e. it does not check the calendar at all.
(2) Rename  Armed-Event Matches Keyword to Armed(D)-Event Matches Keyword.  Th (D) will indicate that it is to be deleted.  Anyone using it then has time to change to the Event Matches Keyword option.  I will delete Armed(D)-Event Matches Keyword in 2 versions from now (a couple of months).

Of course I could just leave Event Matches Keyword  and Armed - Event Matches Keyword  as they are but the redundancy will likely cause confusion in the future and it's 'untidy'.

Appreciate any feedback and thoughts or alternative ideas.


Title: Re: GCAL3 - V 0.9 Released
Post by: roquej on November 15, 2014, 11:33:49 pm
Am I doing this right?

Trying to use PLEG with "Event has specific name" but is not working.  My logic is:

Trigger:  GCal3 Sensor has event with name: TEST EVENT

Condition: Even_TestON = Event_Test
Condition: Event_TestOFF = !Event_Test

Even_TestON never becomes true, or false for that matter.  Now, if I use property eq "TEST EVENT" it works.

Any ideas?
Title: Re: GCAL3 - V 0.9 Released
Post by: mda on November 17, 2014, 02:12:59 am
@Stuart - I installed Gcal3 .9 and yesterday and it seemed to be working. This evening i saw "GCal3.sem ??" in UI 5 (vera UI 1.5.622). I reloaded Luup and it went away (replaced by my upcoming event tomorrow, which is also what was displayed earlier today before this happened).

It looks like the problem started at 18:20:11.211 and it continued trying every 5 seconds until i reloaded Luup a few minutes ago at 22:59:56.483. Here is a log snippet from the start. I still have the old Gcal running (until i can go a few days with GCal3 solid, then i will remove the old GCal).

Please let me know if there is anything i can do to help debug. Thanks!

Code: [Select]
06 11/16/14 18:20:11.101 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-11-16 at 15:20:06 now: 2014-11-16 at 18:20:11 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:11.176 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [{'eventEnd':1416155700,'eventStart':1416155400,'eventParameter':'','eventName':'WAKE_SAM'},{'eventEnd':1416157500,'eventStart':1416157200,'eventParameter':'','eventName':'WAKE_MASTER'},{'eventEnd':1416235800,'eventStart':1416235500,'eventParameter':'','eventName':'WAKE_SAM'},{'eventEnd':1416236700,'eventStart':1416236400,'eventParameter':'','eventName':'WAKE_MASTER'}] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:11.211 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: WAKE_SAM now: GCal3.sem ?? #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:11.212 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: 06:45 Nov 17 to 06:50 Nov 17 now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:11.213 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: GCal3.sem ?? now: GCal3.sem ?? #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:11.214 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:11.215 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-11-16 at 18:20:10 now: 2014-11-16 at 18:20:16 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:16.102 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-11-16 at 18:20:11 now: 2014-11-16 at 18:20:16 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:16.130 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:16.131 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: GCal3.sem ?? now: GCal3.sem ?? #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:16.131 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:16.133 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: GCal3.sem ?? now: GCal3.sem ?? #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:16.133 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:16.134 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-11-16 at 18:20:16 now: 2014-11-16 at 18:20:21 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:21.102 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2014-11-16 at 18:20:16 now: 2014-11-16 at 18:20:21 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
06 11/16/14 18:20:21.160 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:21.161 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: GCal3.sem ?? now: GCal3.sem ?? #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:21.162 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:21.163 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: GCal3.sem ?? now: GCal3.sem ?? #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:21.163 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x314db680>
06 11/16/14 18:20:21.164 Device_Variable::m_szValue_set device: 272 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2014-11-16 at 18:20:21 now: 2014-11-16 at 18:20:26 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x314db680>
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 17, 2014, 10:49:10 am
@Stuart - I installed Gcal3 .9 and yesterday and it seemed to be working. This evening i saw "GCal3.sem ??" in UI 5 (vera UI 1.5.622). I reloaded Luup and it went away (replaced by my upcoming event tomorrow, which is also what was displayed earlier today before this happened).

It looks like the problem started at 18:20:11.211 and it continued trying every 5 seconds until i reloaded Luup a few minutes ago at 22:59:56.483. Here is a log snippet from the start. I still have the old Gcal running (until i can go a few days with GCal3 solid, then i will remove the old GCal).

Please let me know if there is anything i can do to help debug. Thanks!


Of the top of my head - the only thing I can thing of is that you may have a notification set ?    There has been a long standing (and unexplained by mcv) reload problem in certain situations (with a standard scene trigger and notification) - but this would only manifest itself when an event starts.  Note that this problem does not happen if you are using PLEG.

The best way to get to the bottom of this is to set gc_debug to 3 (verbose logging) and then capture a log file (preferably filtered for GCal3).  The plugin has quite a bit a of debug code and this should allow us to figure what was going on.

The GCal3.sem??  tells us that the plugin could not find a control (semaphore) file that gets created.  This is usual on the first installation (since it does not exist at that time) and subsequently it should clear.

Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 17, 2014, 10:55:15 am
Am I doing this right?

Trying to use PLEG with "Event has specific name" but is not working.  My logic is:

Trigger:  GCal3 Sensor has event with name: TEST EVENT

Condition: Even_TestON = Event_Test
Condition: Event_TestOFF = !Event_Test

Even_TestON never becomes true, or false for that matter.  Now, if I use property eq "TEST EVENT" it works.

Any ideas?

Because it works on testing for the property - I suspect the plugin is working correctly and the condition is not set correctly in PLEG.

Take a look at the PLEG "Status" to see what is set and when.  From memory the issue may simply be that you are using = (which is a numeric comparison ?) as opposed to "eq" (for a string ?)

In any case there is some good documentation on PLEG in one of the forums.
Title: Re: GCAL3 - V 0.9 Released
Post by: mda on November 17, 2014, 02:01:48 pm
Thanks. No notifications setup. I had one but Vera would reboot (not luup reload, Unix reboot) and never send it, so I removed the notification :). If the .sem problem happens again I will turn on logging and send over the extract when I catch it. Thanks!
Title: Re: GCAL3 - V 0.9 Released
Post by: jennyfur on November 18, 2014, 09:20:43 am
Hi, I'm a new Vera owner and I'm trying to find instructions on how to set this plugin up. Thanks.
Title: Re: GCAL3 - V 0.9 Released
Post by: SM2k on November 18, 2014, 09:39:09 am
I'm still running the original gcal plugin. This morning I noticed that none of the virtual devices are working anymore. Google has indeed made good on their threat to remove support for older API's.

So I haven't paid any attention to the development efforts of GCal3. Does this plugin have any sort of concept of start or end deltas?
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 18, 2014, 10:04:46 am
I'm still running the original gcal plugin. This morning I noticed that none of the virtual devices are working anymore. Google has indeed made good on their threat to remove support for older API's.

So I haven't paid any attention to the development efforts of GCal3. Does this plugin have any sort of concept of start or end deltas?

Good to see that huge corporations make good on their promises .....  :o

GCal3 has many more features than the original and they are documented in an attachment to the first post in this thread.

As to start / end delta - yes!  There are four ways (in order of precedence): in the keyword(s) definitions, in the event name, in the description, or globally for the plugin

1.   There are two optional parameters that can be used in defining keywords (in the plugin), events  and / or descriptions (in the calendar).  These are  :
[x,y]   and  {some parameters}
[x,y] specifies a start(x) and end(y) delta (in minutes)
{some parameter } is used to populate gc_Value and can be used by other plugins as input.
While event names, descriptions and keywords are all forced to upper case anything in {} is left as-is

2.     There is a strict order of precedence for these optional parameters ? meaning that if [] or {} are used, then the first time they are encountered they are used and subsequent uses (for an event) are ignored.  The order is: 
Keyword  if specified for a plugin keyword, this over-rides anything below in precedence
Event if specified in the event, this over-rides anything below in precedence
Description if specified in the description, this over-rides anything below in precedence
Default the default for [x,y] is [gc_startDelta,gc_endDelta] and for {} is ?? i.e. empty string

The optional parameters can be used in any order and different levels of precedence ? although it?s probably simpler and easier to be sure of what is happening if you use one level



Title: GCAL3 - V 0.9 Released
Post by: mda on November 18, 2014, 10:22:08 am
@Stuart without using pleg is there a way to have one instance of the plugin trigger scenes based on keywords/event names and also trigger other scenes based on a start delta for those keywords? The use case is I currently trigger two different wake up scenes based on events with two different names and it would be great to also trigger other scenes 30 min before the wake up events are scheduled to turn on the various bathroom heaters. Thanks.
Title: Re: GCAL3 - V 0.9 Released
Post by: SM2k on November 18, 2014, 11:08:43 am
@Stuart without using pleg is there a way to have one instance of the plugin trigger scenes based on keywords/event names and also trigger other scenes based on a start delta for those keywords? The use case is I currently trigger two different wake up scenes based on events with two different names and it would be great to also trigger other scenes 30 min before the wake up events are scheduled to turn on the various bathroom heaters. Thanks.

@Stuart, thanks! great work!

@mda, what I usually do is set each sensor to trip at the earliest event, then call other functions with a delay from the original scene.
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 18, 2014, 04:35:05 pm
@Stuart without using pleg is there a way to have one instance of the plugin trigger scenes based on keywords/event names and also trigger other scenes based on a start delta for those keywords? The use case is I currently trigger two different wake up scenes based on events with two different names and it would be great to also trigger other scenes 30 min before the wake up events are scheduled to turn on the various bathroom heaters. Thanks.

The answer is "possibly"  ::)  depending on exactly what you want ......

Maybe something like this:  Lets say you had 3 non-overlapping events defined as

EVENT1
EVENT2 [-30,0]
EVENT3[-30,10]

and you used the "event has specified name" as the trigger for 3 scenes (one for each 'specified name' : EVENT1,EVENT2,EVENT3) respectively

Scene 1 would start and end on time; Scenes 2 would start 30 minutes early and end on-time, Scene 3 would start 30 minutes early and end 10 minutes 'late'.
Title: Re: GCAL3 - V 0.9 Released
Post by: SM2k on November 18, 2014, 05:37:45 pm
@Stuart without using pleg is there a way to have one instance of the plugin trigger scenes based on keywords/event names and also trigger other scenes based on a start delta for those keywords? The use case is I currently trigger two different wake up scenes based on events with two different names and it would be great to also trigger other scenes 30 min before the wake up events are scheduled to turn on the various bathroom heaters. Thanks.

@mda, Here's the luup code I have in my morning routine scene. It demonstrates my approach to multiple stages occurring at intervals. This is almost exactly your use case. morning routine's main purpose is to crank up the heat 30 minutes before my alarm goes off, and call a function to turn on some lights a bit later. caveat: This code will not work if you copy/paste it since pretty much all of it calls functions I've defined elsewhere--but hopefully it's readable.

Code: [Select]
cLog("*** Starting 'morning routine' Luup code ***")

local vacation = getDeviceStatus(VACATION_ID)
if vacation == 0 then
    setHVACTarget("Cool", "up", my_data.dayCoolTarget)
    setHVACTarget("Heat", "up", my_data.dayHeatTarget)
else
  cLog("Not setting HVAC because vacation mode is enabled")
end
luup.call_delay("turnOnMorningLights", my_data.morningLightDelay)

if getValue("Christmas") == 1 then
  setDeviceStatus(CHRISTMAS_LIGHTS_ID, 1)
end

cLog("*** End 'morning routine' Luup code ***")
return true

of particular interest to your question is the use of luup.call_delay. It calls the "turnOnMorningLights" 30 minutes after the heat kicks on--which happens to correspond to when my alarm clock goes off...

So in short, I use the gcal plugin to run the earliest scene I need to deal with, then call other functions with the proper delay.

keep in mind that if you use this approach: if for whatever reason your vera reboots while there are any functions waiting to run via luup.call_delay, those follow on functions will not be run. PLEG does not have this issue thanks to the way @RichardTSchaefer queues pending events.
Title: Re: GCAL3 - V 0.9 Released
Post by: mda on November 19, 2014, 12:40:28 am
Thanks !
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 19, 2014, 11:41:27 am

So in short, I use the gcal plugin to run the earliest scene I need to deal with, then call other functions with the proper delay.


I like this approach - especially for 'within event' control.

One thought that might make it a bit more flexible (if that were desirable) would be to include a functionname  and time delay in the calendar event as a parameter e.g. {turnOnMorningLights, 30}.  That way you could build a more generic scene , get the parameter (gc_Value), parse it and have the scene do 'whatever' i.e. luup.call_delay(func, delay).

I'm not sure what google's limit is on the string size of an event name - but you could perhaps include multiple events in the parameter string.

Perhaps on some days you want the coffee machine to start 20 min after the heat and the lights 30 min after the heat   ;D   
Title: Re: GCAL3 - V 0.9 Released
Post by: SM2k on November 19, 2014, 02:10:26 pm
I just took the time to re-create all my previously existing gcal sensors using the gcal3 plugin. I'm happy to report it's working like a champ. Thanks for such a fantastic plugin @Stuart
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 19, 2014, 02:39:10 pm
I just took the time to re-create all my previously existing gcal sensors using the gcal3 plugin. I'm happy to report it's working like a champ. Thanks for such a fantastic plugin @Stuart

Thanks for the kind words.

 I will have a Version 1.0 out later today.  It's functionally identical to 0.9 but with 2 UI's one- for UI5 and another for UI7.  It will automatically detect which version and adjust accordingly.  If you use this newer version you should not have to change anything.
Title: Re: GCAL3 - V 0.9 Released
Post by: Don Diego on November 20, 2014, 09:33:04 am
I just took the time to re-create all my previously existing gcal sensors using the gcal3 plugin. I'm happy to report it's working like a champ. Thanks for such a fantastic plugin @Stuart

Thanks for the kind words.

 I will have a Version 1.0 out later today.  It's functionally identical to 0.9 but with 2 UI's one- for UI5 and another for UI7.  It will automatically detect which version and adjust accordingly.  If you use this newer version you should not have to change anything.

Stuart

  Great plugin.

  I just installed version 0.9. When is 1.0 due out?

  Also, the calendar tab gives me a 404 error. I guess it can't find the calendar. BUT I tested the calendar, plugin, etc and it works fine (it just can't find the calendar through the tab is the only problem).

  Also, when I set an event for all day on the google calendar, it shows from 0200 today to 0200 tomorrow. Not sure why??

   Don
Title: Re: GCAL3 - V 0.9 Released
Post by: SM2k on November 20, 2014, 09:43:44 am

Stuart

  Great plugin.

  I just installed version 0.9. When is 1.0 due out?

  Also, the calendar tab gives me a 404 error. I guess it can't find the calendar. BUT I tested the calendar, plugin, etc and it works fine (it just can't find the calendar through the tab is the only problem).

  Also, when I set an event for all day on the google calendar, it shows from 0200 today to 0200 tomorrow. Not sure why??

   Don

I get the 404 as well, but I assumed it's because I used a calendar ID that looks like an email address, not a URL. I'd be curious to see if I could supply a value that'd make the calendar show up tho :)

as far as the 2 AM issue, things I'd check would be the time zone of the calendar, vs the vera. It's not likely that you set a StartDelta or EndDelta, but if those values aren't 0, they would affect start/end times from the sensor's point of view.
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 20, 2014, 05:51:49 pm

I get the 404 as well, but I assumed it's because I used a calendar ID that looks like an email address, not a URL. I'd be curious to see if I could supply a value that'd make the calendar show up tho :)

as far as the 2 AM issue, things I'd check would be the time zone of the calendar, vs the vera. It's not likely that you set a StartDelta or EndDelta, but if those values aren't 0, they would affect start/end times from the sensor's point of view.

@Don Diego and 2M2K

Try replacing %40 in the url with @  - I found a bug (that I have fixed in V 1.0) that does not play nice with %40.  Also make sure that you are putting in a url of the form described in the release notes for V 0.8.
Broadly speaking, any calendar of the form
https://www.google.com/calendar/ ...... &src=[something]@group.calendar.google.com ....
should work.
Note that "yourcalendar@gmail.com" will no longer work.  Also make sure you are putting them into the calendar ID input on the control tab and using "Set".  Do not place directly into the advanced tab as I do some reformatting to make everything work.

The 2am issue is most likely as 2M2K pointed out.  Google does not include a time component for all day events - so the plugin has to set it to start and stop at midnight.  So it should show up correctly as long as your vera is set to the local timezone.

Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 20, 2014, 05:58:32 pm
For those who don't want to wait for the plugin to appear in the Marketplace.

Attached is the complete package

EDIT: Attachment Removed  -please use the marketplace version
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 21, 2014, 02:56:22 am
For those who don't want to wait for the plugin to appear in the Marketplace.

Attached is the complete package

Hi Stuart. I've updated to 1.0.

In Vera Web GUI -> My Apps, it still reads that I'm on an older verson (0.6) which is obviously not correct. I guess it has to do with that I've manually updated the files. It's not just a cosmetic isssue because I can not enable "Auto update" because Vera thinks it's still a beta version.

Do you know how to make Vera reflect the current version in the GUI?
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 21, 2014, 03:13:32 am
Quote
(2) Added new icons.  Grey = waiting for an event;  Blue = no keword is set and an event is Active; Green = an event matches a keyword and is Tripped.

I think there might be an issue with the new icons. I'm on mios 1.5.622 using Firefox (I've done reloads and cleared the web cache) and the plugin device icons remain grey even when the device is tripped.
Title: Re: GCAL3 - V 1.0 Released
Post by: fabs29 on November 21, 2014, 10:07:26 am
Hi
I'm using version 1.0, and it have been very difficult to make it works...

I had error "fatal getting credential"

I had switched debug to 3, and had looked at the logs (thanks to the infoViewver plugin !)

I had found the reason why it was not working : my credential file was called Gcal3.json, and the plugin were looking for GCal3.json !

Maybe my experience will help other users  ;-)
Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 21, 2014, 10:11:35 am
Quote
(2) Added new icons.  Grey = waiting for an event;  Blue = no keword is set and an event is Active; Green = an event matches a keyword and is Tripped.

I think there might be an issue with the new icons. I'm on mios 1.5.622 using Firefox (I've done reloads and cleared the web cache) and the plugin device icons remain grey even when the device is tripped.

It's entirely possible there is a problem with the new icons.  Unfortunately I had to do that bit 'blind' as I only have one vera and it's now on UI7.

Also - it will take about 15 sec after an event has tripped for the icon to change - this is a deliberate delay built into the plugin to allow other plugins time to react to changes.   As well - the plugin remembers the prior state, so it does not create multiple trigger events.  So try this too:   (1) make sure there are no events 'now'.   (2) Hit the check button  (3) go to calendar and put an event in that is for 'now' (4) hit 'check again.  The plugin should see the event and in 15 sec the icon should change.

Let me know please.
Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 21, 2014, 10:19:18 am
For those who don't want to wait for the plugin to appear in the Marketplace.

Attached is the complete package

Hi Stuart. I've updated to 1.0.

In Vera Web GUI -> My Apps, it still reads that I'm on an older verson (0.6) which is obviously not correct. I guess it has to do with that I've manually updated the files. It's not just a cosmetic isssue because I can not enable "Auto update" because Vera thinks it's still a beta version.

Do you know how to make Vera reflect the current version in the GUI?

I'm assuming UI7 ?

I saw something very similar yesterday when I was doing some additional testing - likely the 'Create Another' button is also missing from Apps ->My Apps -> pluginname.  ??

This looks to be a setting from the marketplace that does not get updated if you do a manual install for the first time (for the plugin) in UI7.   Try deleting the plugin and re-installing from the marketplace (it was approved over night).   It looks like once it's set by the marketplace - its ok.
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 21, 2014, 10:55:52 am
Also - it will take about 15 sec after an event has tripped for the icon to change - this is a deliberate delay built into the plugin to allow other plugins time to react to changes.   As well - the plugin remembers the prior state, so it does not create multiple trigger events.  So try this too:   (1) make sure there are no events 'now'.   (2) Hit the check button  (3) go to calendar and put an event in that is for 'now' (4) hit 'check again.  The plugin should see the event and in 15 sec the icon should change.

Let me know please.

It stays grey all the time.
Title: Re: GCAL3 - V 1.0 Released
Post by: SM2k on November 21, 2014, 11:08:41 am
Also - it will take about 15 sec after an event has tripped for the icon to change - this is a deliberate delay built into the plugin to allow other plugins time to react to changes.   As well - the plugin remembers the prior state, so it does not create multiple trigger events.  So try this too:   (1) make sure there are no events 'now'.   (2) Hit the check button  (3) go to calendar and put an event in that is for 'now' (4) hit 'check again.  The plugin should see the event and in 15 sec the icon should change.

Let me know please.

It stays grey all the time.

I'm still on 0.9 and the icons are working. This is a new issue since you updated?
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 21, 2014, 11:11:02 am
I'm still on 0.9 and the icons are working. This is a new issue since you updated?

Yes, I didn't see this issue in 0.9. However It's not critical for me.  ;D
Title: Re: GCAL3 - V 0.9 Released
Post by: Don Diego on November 21, 2014, 01:36:41 pm

I get the 404 as well, but I assumed it's because I used a calendar ID that looks like an email address, not a URL. I'd be curious to see if I could supply a value that'd make the calendar show up tho :)

as far as the 2 AM issue, things I'd check would be the time zone of the calendar, vs the vera. It's not likely that you set a StartDelta or EndDelta, but if those values aren't 0, they would affect start/end times from the sensor's point of view.

@Don Diego and 2M2K

Try replacing %40 in the url with @  - I found a bug (that I have fixed in V 1.0) that does not play nice with %40.  Also make sure that you are putting in a url of the form described in the release notes for V 0.8.
Broadly speaking, any calendar of the form
https://www.google.com/calendar/ ...... &src=[something]@group.calendar.google.com ....
should work.
Note that "yourcalendar@gmail.com" will no longer work.  Also make sure you are putting them into the calendar ID input on the control tab and using "Set".  Do not place directly into the advanced tab as I do some reformatting to make everything work.

The 2am issue is most likely as 2M2K pointed out.  Google does not include a time component for all day events - so the plugin has to set it to start and stop at midnight.  So it should show up correctly as long as your vera is set to the local timezone.

Hi Stuart

   I changed the email address and the calendar still doesn't display.

    Don
Title: Re: GCAL3 - V 1.0 Released
Post by: fabs29 on November 21, 2014, 06:33:53 pm
hi

I've installed the last release using the mios market (1.0)

I think there is a bug for events between 00:00 and 00:59 : these events are not reported by gcal3
Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 21, 2014, 06:37:06 pm
I'm still on 0.9 and the icons are working. This is a new issue since you updated?

Yes, I didn't see this issue in 0.9. However It's not critical for me.  ;D

For anyone  running UI5 and GCal3 V1.0 - please upload the following file.  This will put the icons back the way they were in V0.9

EDIT: - Well, almost .... sorry, please see the file posted here which has been validated by users on UI5

http://forum.micasaverde.com/index.php/topic,26692.msg204092.html#msg204092
Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 21, 2014, 06:59:49 pm
hi

I've installed the last release using the mios market (1.0)

I think there is a bug for events between 00:00 and 00:59 : these events are not reported by gcal3

Can you give me a bit more info ?   I just created an event that starts at 00:05 am and 00:15am and the plugin see's it.  I also changed the event to start at 00:00 and end at 00:59 and it sees that as well.

Do you have a keyword set and the event does not match the keyword ?

No code in this area has changed recently - at least not on purpose  :-[
Title: Re: GCAL3 - V 0.9 Released
Post by: Stuart on November 21, 2014, 07:27:27 pm

Hi Stuart

   I changed the email address and the calendar still doesn't display. How can I tell what GCAAL3 version I'm running?

    Don

The quickest way to get to the bottom of what's happening is with a log file.  Set gc_debug to 3 and filter the log file with GCal3.   The log messages will tell which version is being used.
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 22, 2014, 04:19:15 am
For anyone  running UI5 and GCal3 V1.0 - please upload the following file.  This will put the icons back the way they were in V0.9

Lovely! Thank You Stuart  ;D


In Vera Web GUI -> My Apps, it still reads that I'm on an older verson (0.6) which is obviously not correct. I guess it has to do with that I've manually updated the files. It's not just a cosmetic isssue because I can not enable "Auto update" because Vera thinks it's still a beta version.

Do you know how to make Vera reflect the current version in the GUI?

I hope I won't have to uninstall and reinstall the plugin...  ???

 ;D ;D ;D Thank You Stuart for all the hard work you put into this project.  ;D ;D ;D

Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 22, 2014, 12:17:20 pm
For anyone  running UI5 and GCal3 V1.0 - please upload the following file.  This will put the icons back the way they were in V0.9

Lovely! Thank You Stuart  ;D


In Vera Web GUI -> My Apps, it still reads that I'm on an older verson (0.6) which is obviously not correct. I guess it has to do with that I've manually updated the files. It's not just a cosmetic isssue because I can not enable "Auto update" because Vera thinks it's still a beta version.

Do you know how to make Vera reflect the current version in the GUI?

I hope I won't have to uninstall and reinstall the plugin...  ???

 ;D ;D ;D Thank You Stuart for all the hard work you put into this project.  ;D ;D ;D

Hi Farang -- Sorry but I do not know how to make vera do what you ask.  There is some interplay between the marketplace settings and the UI that apparently gets confused.
This post gives some clue as to the issue but not a complete answer.  You may find a post with more info ....

http://forum.micasaverde.com/index.php?topic=27512.0

For V1.0 I set the marketplace to auto update so that should carry through from now (with any luck).

I would recommend uninstalling your plugin and then re-installing from the marketplace V1.0 then uploading the D_GCal3.json file (from 3 posts above) if you are on UI5.   You should not loose any credentials but you will need to put your CalendarID back in.  This should only take 5 min and might be the quickest.
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 22, 2014, 01:53:42 pm
I'm just afraid that if I temporary delete the GCal devices, PLEG will start to purge actions for unknown devices that are referenced in the code. I will ask my question in a more generic forum and we will see if someone knows how to do this. Thank You Stuart.

EDIT:

I found a way  ;D

I just forced an update with this command and it seems it worked!

Code: [Select]
http://MY-VERA-IP:3480/data_request?id=update_plugin&Plugin=7016
(After that, do the Vera-dance)

 ;)
Title: UI7 Issue
Post by: Stuart on November 22, 2014, 08:17:34 pm
For those exploring UI7 with GCal3 (yes .. all three of us ?)

There is a problem creating a trigger (other than plugin tripped).  The plugin mechanics seem to be working fine but UI7 will not allow an event name to be set.

I have asked MCV dev about this and hope to have an answer soon - ah the joys of vera ......   or put another way ....  crowd QA .....
Title: GCAL3 Flying buttons
Post by: guest141575 on November 24, 2014, 02:58:54 am
Hello Stuart!

I noticed that the buttons on my GCal devices are flying away ... (1.0 + iconfix @ 1.5.622)  ;D
Title: Re: GCAL3 Flying buttons
Post by: Stuart on November 24, 2014, 11:58:27 am
Hello Stuart!

I noticed that the buttons on my GCal devices are flying away ... (1.0 + iconfix @ 1.5.622)  ;D

Yikes - this is crazy. I just looked at the code again and no reason why this should have happened (that I can tell) .  Does it fix itself if you reboot the unit ?  Sometimes the browsers cash old stuff.

If it's still there after a reboot - try this and let me know please.

EDIT:  The file has been validated by UI5 users and is now posted here

http://forum.micasaverde.com/index.php/topic,26692.msg204092.html#msg204092
Title: Re: GCAL3 Flying buttons
Post by: guest141575 on November 24, 2014, 02:55:29 pm
Hello Stuart!

I noticed that the buttons on my GCal devices are flying away ... (1.0 + iconfix @ 1.5.622)  ;D

Yikes - this is crazy. I just looked at the code again and no reason why this should have happened (that I can tell) .  Does it fix itself if you reboot the unit ?  Sometimes the browsers cash old stuff.

If it's still there after a reboot - try this and let me know please.

Thank You Stuart.

After a reboot and a few Vera dances the buttons are still on the run ... I noticed it's the same problem in IE so it can not be a web cache problem. I tried your new file but it didn't change anything. Also, all other plugins and devices are behaving normal.

Someone else using GCAL3 V 1.00 on 1.5.622 with the lastest modified D_GCal3.json who can confirm please?
Title: Re: GCAL3 Flying buttons
Post by: Stuart on November 24, 2014, 03:12:08 pm

After a reboot and a few Vera dances the buttons are still on the run ... I noticed it's the same problem in IE so it can not be a web cache problem. I tried your new file but it didn't change anything. Also, all other plugins and devices are behaving normal.

Someone else using GCAL3 V 1.00 on 1.5.622 with the lastest modified D_GCal3.json who can confirm please?

It would be really helpful if someone on UI5 could comment.  I (perhaps foolishly) made the leap to UI7 as I wanted to get a start on getting a version ready - so I cannot test UI5.  The core code is identical between UI7 and UI5 just the UI files are different.
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 24, 2014, 03:17:38 pm
And what's more strange ... right now the buttons have returned to their original places.  I don't know why. I didn't do anything.
Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 24, 2014, 04:04:28 pm
And what's more strange ... right now the buttons have returned to their original places.  I don't know why. I didn't do anything.

So it's working correctly now ?

To make sure we are on the same page - can you
(1)  give a screenshot of the way things look now
(2) download from your vera the D_GCal3.json file and attach it to your reply.  I want to be sure we have the actual file on your vera so we can be sure.

Thanks in advance
Title: Re: GCAL3 Flying buttons
Post by: Don Diego on November 24, 2014, 06:22:51 pm

After a reboot and a few Vera dances the buttons are still on the run ... I noticed it's the same problem in IE so it can not be a web cache problem. I tried your new file but it didn't change anything. Also, all other plugins and devices are behaving normal.

Someone else using GCAL3 V 1.00 on 1.5.622 with the lastest modified D_GCal3.json who can confirm please?

It would be really helpful if someone on UI5 could comment.  I (perhaps foolishly) made the leap to UI7 as I wanted to get a start on getting a version ready - so I cannot test UI5.  The core code is identical between UI7 and UI5 just the UI files are different.

Hi Stuart

  I uploaded the patch you provided for GCAL3 on UI5. Now I'm having the same flying buttonsas farang.

    Don
Title: Re: GCAL3 Flying buttons
Post by: Stuart on November 24, 2014, 06:57:34 pm


Hi Stuart

  I uploaded the patch you provided for GCAL3 on UI5. Now I'm having the same flying buttonsas farang.

    Don

Did you try the patch from 5 posts above ?  That is to say the one I asked farang to try ?   Looks like he is reporting that fixed the problem.
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 25, 2014, 01:38:07 am
And what's more strange ... right now the buttons have returned to their original places.  I don't know why. I didn't do anything.

So it's working correctly now ?

To make sure we are on the same page - can you
(1)  give a screenshot of the way things look now
(2) download from your vera the D_GCal3.json file and attach it to your reply.  I want to be sure we have the actual file on your vera so we can be sure.

Thanks in advance

Hi Stuart!

I downloaded the D_GCal3.json from my Vera and the file size reported by ₩indo₩$ is 13,3 kB (13 629 byte) . I ensure you that everything looks normal right now. However I'm also sure that initially after installing the json-file I still saw the flying windows, I believe that I made reloads and empying cache also after installing that json-file but I'm not 100% sure. I haven't seen any buttons flying around since yesterday but if I do I will report back immediately.

Thank You Stuart!  :)

EDIT: Attachment Removed
Title: Re: GCAL3 - V 1.0 Released
Post by: Don Diego on November 25, 2014, 07:01:40 am
And what's more strange ... right now the buttons have returned to their original places.  I don't know why. I didn't do anything.

So it's working correctly now ?

To make sure we are on the same page - can you
(1)  give a screenshot of the way things look now
(2) download from your vera the D_GCal3.json file and attach it to your reply.  I want to be sure we have the actual file on your vera so we can be sure.

Thanks in advance

Hi Stuart!

I downloaded the D_GCal3.json from my Vera and the file size reported by ₩indo₩$ is 13,3 kB (13 629 byte) . I ensure you that everything looks normal right now. However I'm also sure that initially after installing the json-file I still saw the flying windows, I believe that I made reloads and empying cache also after installing that json-file but I'm not 100% sure. I haven't seen any buttons flying around since yesterday but if I do I will report back immediately.

Thank You Stuart!  :)

Hi Farang

   After uploading your file in 1.5.622 the flying window problem was fixed..

  Thanks Stuart and Farang..

    Don
Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on November 25, 2014, 09:58:32 am

Hi Stuart!

I downloaded the D_GCal3.json from my Vera and the file size reported by ₩indo₩$ is 13,3 kB (13 629 byte) . I ensure you that everything looks normal right now.
Thank You Stuart!  :)

Farang - thank you very much for testing this.    I will roll the correct file into V1.1.
Title: Re: GCAL3 - V 1.0 Released
Post by: guest141575 on November 25, 2014, 02:42:03 pm

Hi Stuart!

I downloaded the D_GCal3.json from my Vera and the file size reported by ₩indo₩$ is 13,3 kB (13 629 byte) . I ensure you that everything looks normal right now.
Thank You Stuart!  :)

Farang - thank you very much for testing this.    I will roll the correct file into V1.1.
I'm just happy if I can assist in any way. :D
Title: Re: GCAL3 - V 1.0 Released
Post by: minxster on November 27, 2014, 10:10:35 am
Hi - just been updating to GCal3 (used market place version) when I saw this thread on some issues I was having. I was worried that things were not "tripping" correctly becuase I didn't see any icon changes, though I workout everything was working correctly afterall  8)

Anywho - thanks to one and all for this plugin along with fixing the icons  :D .... My heating is now back in automatic mode  ;D
Title: Re: GCAL3 - V 1.0 Released
Post by: korttoma on December 01, 2014, 02:51:05 am
Updated from Version 0.8 to 1.0 using this method:

To Update GCal3
https://<remoteaddress>/<username>/<password>/<veraID>/data_request?id=update_plugin&Plugin=7016

remoteaddress example: fwd7.mios.com

I also got the Fatal error getting credentials so I checked if GCal3.json was available on my vera but all I found was "G" (see picture).
So I re uploaded the file and restarted now everything is fine but again the file is gone and all I see is "G" like in the picture but it is working so no worries.

Is this some security feature?



Title: Re: GCAL3 - V 1.0 Released
Post by: Stuart on December 01, 2014, 10:46:36 am
Updated from Version 0.8 to 1.0 using this method:

To Update GCal3
https://<remoteaddress>/<username>/<password>/<veraID>/data_request?id=update_plugin&Plugin=7016

remoteaddress example: fwd7.mios.com

I also got the Fatal error getting credentials so I checked if GCal3.json was available on my vera but all I found was "G" (see picture).
So I re uploaded the file and restarted now everything is fine but again the file is gone and all I see is "G" like in the picture but it is working so no worries.

Is this some security feature?

There was a change in the way security was handed between 0.8 and 0.9 which required GCal3.json to be downloaded again.  Part of the change was to make the code easier to maintain and debug - part of the change was to store the tokens in memory (they were previously in files).

All of the working files for the plugin are placed / created in a directory called GCal3 (including the GCal3.json file).  So only the program files should be visible in the screen shot you made.  GCal3 (the directory) is visible in the UI7 interface but I cannot remember how it shows up in the UI5 interface.  From the look of the screen shot - maybe it's the GCal3 directory but not fully named ?

I do not have a "G" file on my system.  You could always try and download it and take a look - or use putty / winscp to take a look. 
Title: Re: GCAL3 - V 1.0 Released
Post by: korttoma on December 01, 2014, 02:32:10 pm
Thanks for the clarification Stuart.

If I try to view or download the "G" I get:
a new window :veraIP/cgi-bin/cmh/view_upnp_file.sh?file=GCal3
 
This page contains the following errors:

error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.


And if I log in to vera and check the cmh-ludl folder I see a folder called GCal3 so my guess is that the folder can not be displayed properly on the Vera interface.
Title: Re: GCAL3 - V 0.9 Released
Post by: jennyfur on December 03, 2014, 05:42:43 am
Hi, I'm a new Vera owner and I'm trying to find instructions on how to set this plugin up. Thanks.
Still looking for some information regarding this. The links on the first post are all inactive (specifically the "Setting up a Google V3 API Service Account" and the "Installation and User Guide" which I assume would be what I need).
Title: Re: GCAL3 - V 1.0 Released
Post by: korttoma on December 03, 2014, 06:19:30 am
There is an pdf attachement on the bottom of the first post I'll try to put a link to it -> http://forum.micasaverde.com/index.php?action=dlattach;topic=26692.0;attach=19456
Title: Re: GCAL3 - V 1.0 Released
Post by: jennyfur on December 03, 2014, 09:42:40 am
There is an pdf attachement on the bottom of the first post I'll try to put a link to it -> http://forum.micasaverde.com/index.php?action=dlattach;topic=26692.0;attach=19456
Thank you! That's a start at least. Finally have the plugin tied to my calendar. :)
Title: Re: GCAL3 - V 1.1 Released
Post by: SM2k on January 23, 2015, 03:32:21 pm
I use a lot of luup.variable_watch functions to respond to state changes in my google calendar sensors.

One thing I've noticed about the GCal3 plugin that differs from previous incarnations of this plugin is that it triggers calls to my handler functions even when the value didn't change. @Stuart, does the plugin call variable_set regardless of if the value changed or something?

one example of how this causes an unintended side effect: I use a multiswitch for various "states" for the house. like "guests" or "vacation". I also have calendar switches for some of those. the variable_watch functions for the calendar switches simply sets the state of the multiswitch. the point of using both is that I can schedule vacation in advance or simply change the state quickly directly from the multiswitch if something comes up. the trouble is that if the GCal3 plugin sets the state of "guests" from 0 to 0, for instance, it effectively clears at random intervals any mode I had set manually. I can go re-code all the handler functions I wrote back from the GCal1 days, but I thought I'd mention this because it seems like the wrong behavior by the plugin--it's possible it's causing spurious scene executions for anybody that's using GCal3 as a trigger.

thanks for writing the GCal3 plugin, @Stuart. It's absolutely fantastic!
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on January 23, 2015, 04:31:26 pm
I use a lot of luup.variable_watch functions to respond to state changes in my google calendar sensors.

One thing I've noticed about the GCal3 plugin that differs from previous incarnations of this plugin is that it triggers calls to my handler functions even when the value didn't change. @Stuart, does the plugin call variable_set regardless of if the value changed or something?

one example of how this causes an unintended side effect: I use a multiswitch for various "states" for the house. like "guests" or "vacation". I also have calendar switches for some of those. the variable_watch functions for the calendar switches simply sets the state of the multiswitch. the point of using both is that I can schedule vacation in advance or simply change the state quickly directly from the multiswitch if something comes up. the trouble is that if the GCal3 plugin sets the state of "guests" from 0 to 0, for instance, it effectively clears at random intervals any mode I had set manually. I can go re-code all the handler functions I wrote back from the GCal1 days, but I thought I'd mention this because it seems like the wrong behavior by the plugin--it's possible it's causing spurious scene executions for anybody that's using GCal3 as a trigger.

thanks for writing the GCal3 plugin, @Stuart. It's absolutely fantastic!

What specific variables are you watching ?   There are several in GCal3 that get overwritten each time the plugin checks the calendar - although I'd think most of these would not have even been in the old GCal1 (but clearly some were).  In general - I did not deliberately attempt to only update on changes, since this would require quite a bit of code.  From memory, the old GCal did not do that either, although it may have worked out that way.

Give me some specifics and I'll see what can be done.
Title: Re: GCAL3 - V 1.1 Released
Post by: Kmitchel on January 24, 2015, 02:13:24 pm
I'm trying to set this up and I am stuck on step 7.  I changed the name of the json file and found an online json file viewer to open the file for step 7. 

I am using this viewer:  https://www.jsoneditoronline.org/

Is there a better way to read the json?
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on January 24, 2015, 04:33:23 pm
I'm trying to set this up and I am stuck on step 7.  I changed the name of the json file and found an online json file viewer to open the file for step 7. 

I am using this viewer:  https://www.jsoneditoronline.org/

Is there a better way to read the json?

No need to try and open it in anything fancy - just a text editor like notepad++ will do (which is what I used)

But with jsoneditoronline - the bit you want to copy will be in the right hand pane as the value for client_email :  which is already presented without the quotes
Title: Re: GCAL3 - V 1.1 Released
Post by: SM2k on January 26, 2015, 10:34:52 am

What specific variables are you watching ?   There are several in GCal3 that get overwritten each time the plugin checks the calendar - although I'd think most of these would not have even been in the old GCal1 (but clearly some were).  In general - I did not deliberately attempt to only update on changes, since this would require quite a bit of code.  From memory, the old GCal did not do that either, although it may have worked out that way.

Give me some specifics and I'll see what can be done.

Oops, good point, I didn't mention that. In general the only variable I actually watch is "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped".
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on January 26, 2015, 12:01:24 pm

What specific variables are you watching ?   There are several in GCal3 that get overwritten each time the plugin checks the calendar - although I'd think most of these would not have even been in the old GCal1 (but clearly some were).  In general - I did not deliberately attempt to only update on changes, since this would require quite a bit of code.  From memory, the old GCal did not do that either, although it may have worked out that way.

Give me some specifics and I'll see what can be done.

Oops, good point, I didn't mention that. In general the only variable I actually watch is "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped".

I looked at the code, there are only 4 times that  "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped" gets changed or rewritten (to the same value as before):
1) During a reload - rewrite
2) In response to a new event starting - change
3) In response to an event ending - change
4) when there is calendar check - rewrite

# 4 and some other variables are re-written at each calendar check and is some really old code when I though you could manually change a variable in the advanced tab and mios would just update it.

My experience since then is that mios always reloads when you change a variable so there is no point in that old code ..... although I have to check / validate this with UI7 as well ........ I'll do some tests to see if it's redundant .....

But - unless the variable_watch is reporting a change in response to #4 (even though the variable would not normally change) - I'm not sure what situation would cause the issue you are seeing.

If you can describe a reproducible scenario and include a log file covering the period when it happens, (pls set gc_debug to 3 before creating the log file) - then we should be able to narrow down and hopefully fix

Title: Re: GCAL3 - V 1.1 Released
Post by: SM2k on January 26, 2015, 12:41:25 pm
I looked at the code, there are only 4 times that  "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped" gets changed or rewritten (to the same value as before):
1) During a reload - rewrite
2) In response to a new event starting - change
3) In response to an event ending - change
4) when there is calendar check - rewrite

# 4 and some other variables are re-written at each calendar check and is some really old code when I though you could manually change a variable in the advanced tab and mios would just update it.

My experience since then is that mios always reloads when you change a variable so there is no point in that old code ..... although I have to check / validate this with UI7 as well ........ I'll do some tests to see if it's redundant .....

But - unless the variable_watch is reporting a change in response to #4 (even though the variable would not normally change) - I'm not sure what situation would cause the issue you are seeing.

If you can describe a reproducible scenario and include a log file covering the period when it happens, (pls set gc_debug to 3 before creating the log file) - then we should be able to narrow down and hopefully fix

The two cases where the Tripped state gets rewritten (#1 reload and #4 calendar check) is exactly what I'm seeing my variable_watch code getting triggered. It'll take a bit before I can collect logs, but I recall seeing a line being logged stating that "Tripped" was changed from "0" to "0" for instance. I can reliably reproduce this by reloading my vera, it'll just take a bit to sift thru the logs and pull out the dozen lines or so you need.
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on January 26, 2015, 02:00:12 pm

The two cases where the Tripped state gets rewritten (#1 reload and #4 calendar check) is exactly what I'm seeing my variable_watch code getting triggered. It'll take a bit before I can collect logs, but I recall seeing a line being logged stating that "Tripped" was changed from "0" to "0" for instance. I can reliably reproduce this by reloading my vera, it'll just take a bit to sift thru the logs and pull out the dozen lines or so you need.

I have not fully tested - but if you are feeling brave, you could try this version:  I removed the updates to "Tripped" at #1 and MAY have miss-spoke about #4 (although there may be a side affect I have yet to find).

EDIT: Attachment removed
Title: Re: GCAL3 - V 1.1 Released
Post by: Kmitchel on January 26, 2015, 03:43:20 pm

I'm trying to set this up and I am stuck on step 7.  I changed the name of the json file and found an online json file viewer to open the file for step 7. 

I am using this viewer:  https://www.jsoneditoronline.org/

Is there a better way to read the json?

No need to try and open it in anything fancy - just a text editor like notepad++ will do (which is what I used)

But with jsoneditoronline - the bit you want to copy will be in the right hand pane as the value for client_email :  which is already presented without the quotes

When I opened the JSON in Notepad, it looks like Chinese.


Sent from my iPhone using Tapatalk
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on January 26, 2015, 04:14:24 pm

I'm trying to set this up and I am stuck on step 7.  I changed the name of the json file and found an online json file viewer to open the file for step 7. 

I am using this viewer:  https://www.jsoneditoronline.org/

Is there a better way to read the json?

No need to try and open it in anything fancy - just a text editor like notepad++ will do (which is what I used)

But with jsoneditoronline - the bit you want to copy will be in the right hand pane as the value for client_email :  which is already presented without the quotes

When I opened the JSON in Notepad, it looks like Chinese.


Sent from my iPhone using Tapatalk

Notepad++ is not Notepad - it's much nicer in many ways.  Notepad does not format well and depending on the encoding you have set, may well look like Chinese :-)

http://notepad-plus-plus.org/download/v6.7.4.html

 or just use jsoneditoronline as you had started to do.



Title: Re: GCAL3 - V 1.1 Released
Post by: iLLphiL on January 30, 2015, 02:19:49 pm
Hate to be that guy.. I cant seem to find the setup information for this plugin. I keep getting an error, Its attached as an image... cant seem to figure out what it is i am doing wrong.
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 09, 2015, 03:54:51 am
Hello
I have a little trouble with a GCal3 in v1.1 under UI5

at 6:20, it remained tripped until I make a check around 7:40
While the event lasts 2 minutes

yesterday morning my vera planted was also cause for my GCAL3
I have these concerns since I went in 1.1

Thank you

edit
error : Fatal error - access token
check  = checking ... faor many minutes

Code: [Select]
02/09/15 20:23:37.160 luup_log:206: GCal3 V 1.1:Device 206 claimed semaphore <0x2f291680>
01 02/09/15 20:23:37.163 LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 1.1"  ..."]:220: attempt to concatenate field 'access_token' (a nil value) <0x2f291680>
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 09, 2015, 04:01:54 pm
Hate to be that guy.. I cant seem to find the setup information for this plugin. I keep getting an error, Its attached as an image... cant seem to figure out what it is i am doing wrong.

They are on the very first post of this thread. Enjoy.
Title: Re: GCAL3 - Google Calendar 3
Post by: Octoplayer on February 09, 2015, 06:44:14 pm
Quote

I have a 'one word' answer ....... PLEG.  .

Hi,
I have been using PLEG (another wonderful plugin) to generate events, and then run an appropriate Scene. Having finally got my TRVs and Ping Sensors under control, I want to make a more flexible control process. My intent is to use the GCal plugin, as it looks ideal for family access.
 
So far I have got GCal3 set up and reading events into gc_jsonEVENTS. (I get 404 on the calendar tab, and nothing in _value yet, but early days).

My thinking is to create events saying SCENE{Bedtime} or SCENE{Holiday}, trigger PLEG with an action that then runs the scene as defined in parameter gc_value field. I have been through all the posts, and cannot see anything that looks like that - before I start reinventing the wheel... has anyone tried such a process, or is there a simpler way to do it?

Thanks
Title: Re: GCAL3 - V 1.1 Released
Post by: Octoplayer on February 12, 2015, 08:10:46 am
Quote
My thinking is to create events saying SCENE{Bedtime} or SCENE{Holiday}, trigger PLEG with an action that then runs the scene as defined in parameter gc_value field

FWIW, I now have this working: I can now create GCal events saying Scene{50} or Scene{51} for example, and it executes the appropriate scene  :)

I look for a keyword SCENE, have a PLEG trigger (tGCal) on the GCAL trip, with a Device Property input looking gc_value (pGCalValue). I check for a condition of tGCal being true, then the action is to Run Scene, with {(pGCalValue)} as the scene to run.

For some reason, putting the Scene name in as the parameter does not work, which would make the calendar more readable. I have been doing some tests, but cannot find a format that works (yet).

Octoplayer



Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 12, 2015, 01:32:33 pm
again of the problems this morning:
lock on "succefull initialized"
  ???
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 12, 2015, 09:18:45 pm
again of the problems this morning:
lock on "succefull initialized"
  ???
The problem is being caused (based on your earlier post) because the plugin is unable to get a valid access token from google.  This could be for a number of reasons including not being able to contact google.

The snippit of the log file you sent is a symptom not the cause i.e. the real problem occurred before that line of code.  Please set gc_debug to 3 and get a log file and we can see where the error is occurring.  I'll also look to see if the failure can be made more graceful.
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 14, 2015, 05:12:37 am
Code: [Select]
50 02/14/15 10:40:23.101 luup_log:203: GCal3 V 1.1:Delay = delayedstart <0x2ecdb680>
50 02/14/15 10:40:23.101 luup_log:203: GCal3 V 1.1:Checking semaphore <0x2ecdb680>
50 02/14/15 10:40:23.143 luup_log:204: GCal3 V 1.1:Delay = delayedstart <0x2eedb680>
50 02/14/15 10:40:23.143 luup_log:204: GCal3 V 1.1:Checking semaphore <0x2eedb680>
50 02/14/15 10:40:23.171 luup_log:204: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2eedb680>
50 02/14/15 10:40:23.191 luup_log:204: GCal3 V 1.1:Semaphore file returned 194 <0x2eedb680>
50 02/14/15 10:40:23.213 luup_log:203: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecdb680>
50 02/14/15 10:40:23.215 luup_log:203: GCal3 V 1.1:Semaphore file returned 194 <0x2ecdb680>
06 02/14/15 10:40:23.264 Device_Variable::m_szValue_set device: 193 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 2410 now: 5450 #hooks: 0 upnp: 0 v:0xdf70e8/NONE duplicate:0 <0x3131c680>
06 02/14/15 10:40:23.265 Device_Variable::m_szValue_set device: 193 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Log was: 2410,2291,3010,1423906821,622 now: 5450,2291,5450,1423906823,624 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x3131c680>
50 02/14/15 10:40:23.283 luup_log:203: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecdb680>
50 02/14/15 10:40:23.301 luup_log:203: GCal3 V 1.1:Device 194 blocked semaphore request from device 203 <0x2ecdb680>
06 02/14/15 10:40:23.301 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecdb680>
06 02/14/15 10:40:23.301 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecdb680>
50 02/14/15 10:40:23.292 luup_log:204: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2eedb680>
50 02/14/15 10:40:23.320 luup_log:204: GCal3 V 1.1:Device 194 blocked semaphore request from device 204 <0x2eedb680>
06 02/14/15 10:40:23.321 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2eedb680>
06 02/14/15 10:40:23.322 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2eedb680>
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 14, 2015, 11:10:41 am
Code: [Select]
50 02/14/15 10:40:23.101 luup_log:203: GCal3 V 1.1:Delay = delayedstart <0x2ecdb680>
50 02/14/15 10:40:23.101 luup_log:203: GCal3 V 1.1:Checking semaphore <0x2ecdb680>
50 02/14/15 10:40:23.143 luup_log:204: GCal3 V 1.1:Delay = delayedstart <0x2eedb680>
50 02/14/15 10:40:23.143 luup_log:204: GCal3 V 1.1:Checking semaphore <0x2eedb680>
50 02/14/15 10:40:23.171 luup_log:204: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2eedb680>
50 02/14/15 10:40:23.191 luup_log:204: GCal3 V 1.1:Semaphore file returned 194 <0x2eedb680>
50 02/14/15 10:40:23.213 luup_log:203: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecdb680>
50 02/14/15 10:40:23.215 luup_log:203: GCal3 V 1.1:Semaphore file returned 194 <0x2ecdb680>
06 02/14/15 10:40:23.264 Device_Variable::m_szValue_set device: 193 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 2410 now: 5450 #hooks: 0 upnp: 0 v:0xdf70e8/NONE duplicate:0 <0x3131c680>
06 02/14/15 10:40:23.265 Device_Variable::m_szValue_set device: 193 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Log was: 2410,2291,3010,1423906821,622 now: 5450,2291,5450,1423906823,624 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x3131c680>
50 02/14/15 10:40:23.283 luup_log:203: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecdb680>
50 02/14/15 10:40:23.301 luup_log:203: GCal3 V 1.1:Device 194 blocked semaphore request from device 203 <0x2ecdb680>
06 02/14/15 10:40:23.301 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecdb680>
06 02/14/15 10:40:23.301 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecdb680>
50 02/14/15 10:40:23.292 luup_log:204: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2eedb680>
50 02/14/15 10:40:23.320 luup_log:204: GCal3 V 1.1:Device 194 blocked semaphore request from device 204 <0x2eedb680>
06 02/14/15 10:40:23.321 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2eedb680>
06 02/14/15 10:40:23.322 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2eedb680>

This portion of the log tells me that you have 3 GCal3 devices 203,204 and 194.  Device 194 is either trying to startup (more likely) or busy doing something(less likely)  -so we need to see the portion of the log before this to see shat device 194 is doing - probably what errors it is reporting.

These semaphore messages are normal - not an error - but can point to which device is causing an error.
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 15, 2015, 07:47:50 am
Here are the logs
GCal3 blocking Today # 206 of checking

Code: [Select]
08 02/15/15 13:19:18.979 JobHandler_LuaUPnP::HandleActionRequest device: 206 service: urn:srs-com:serviceId:GCalIII action: GCalCheck <0x3128b680>
08 02/15/15 13:19:18.979 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=206 <0x3128b680>
08 02/15/15 13:19:18.979 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:srs-com:serviceId:GCalIII <0x3128b680>
08 02/15/15 13:19:18.979 JobHandler_LuaUPnP::HandleActionRequest argument action=GCalCheck <0x3128b680>
08 02/15/15 13:19:18.980 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.10461730132162972 <0x3128b680>
06 02/15/15 13:19:18.980 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Checking ... #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x3128b680>
06 02/15/15 13:19:18.981 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x3128b680>
06 02/15/15 13:19:19.455 Device_Variable::m_szValue_set device: 193 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 3080 now: 3060 #hooks: 0 upnp: 0 v:0xb1dbb0/NONE duplicate:0 <0x30048680>
06 02/15/15 13:19:19.456 Device_Variable::m_szValue_set device: 193 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Log was: 3080,2996,5150,1424002756,2957 now: 3060,2996,5150,1424002759,2960 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x30048680>
02 02/15/15 13:19:19.526 ZW_Send_Data node 4 NO ROUTE (nil) <0x2b807680>
06 02/15/15 13:19:20.004 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 12:55:20 now: 2015-02-15 at 13:19:20 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ea07680>
06 02/15/15 13:19:20.005 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ea07680>
50 02/15/15 13:19:20.006 luup_log:206: GCal3 V 1.1:Checking semaphore <0x2ea07680>
50 02/15/15 13:19:20.055 luup_log:206: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ea07680>
50 02/15/15 13:19:20.056 luup_log:206: GCal3 V 1.1:Semaphore file returned 206 <0x2ea07680>
50 02/15/15 13:19:20.128 luup_log:206: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ea07680>
50 02/15/15 13:19:20.129 luup_log:206: GCal3 V 1.1:Device 206 claimed semaphore <0x2ea07680>
50 02/15/15 13:19:20.131 luup_log:206: GCal3 V 1.1:StartMin is 2015-02-15T00:00:00.000Z StartMax is 2015-02-16T15:19:20.000Z <0x2ea07680>
50 02/15/15 13:19:20.131 luup_log:206: GCal3 V 1.1:End of day is 2015-02-15T23:59:59 <0x2ea07680>
50 02/15/15 13:19:20.131 luup_log:206: GCal3 V 1.1:Function: requestCalendar <0x2ea07680>
50 02/15/15 13:19:20.132 luup_log:206: GCal3 V 1.1:Function: get_access_token <0x2ea07680>
06 02/15/15 13:19:21.109 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:16 now: 2015-02-15 at 13:19:21 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:21.171 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:21.227 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:21 now: 2015-02-15 at 13:19:26 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:21.228 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:26 <0x2e607680>
02 02/15/15 13:19:21.656 ZW_Send_Data node 4 USING ROUTE 3.0.0.0 <0x2b807680>
04 02/15/15 13:19:21.797 <0x2b407680>
06 02/15/15 13:19:26.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:21 now: 2015-02-15 at 13:19:26 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:26.135 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:26.191 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:26 now: 2015-02-15 at 13:19:31 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:26.192 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:31 <0x2e607680>
06 02/15/15 13:19:31.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:26 now: 2015-02-15 at 13:19:31 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:31.222 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:31.289 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:31 now: 2015-02-15 at 13:19:36 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:31.290 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:36 <0x2e607680>
01 02/15/15 13:19:35.159 LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 1.1"  ..."]:222: attempt to concatenate local 'status' (a nil value) <0x2ea07680>
06 02/15/15 13:19:36.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:31 now: 2015-02-15 at 13:19:36 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:36.162 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:36.219 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:36 now: 2015-02-15 at 13:19:41 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:36.220 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:41 <0x2e607680>
06 02/15/15 13:19:41.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:36 now: 2015-02-15 at 13:19:41 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:41.133 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:41.192 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:41 now: 2015-02-15 at 13:19:46 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:41.193 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:46 <0x2e607680>
06 02/15/15 13:19:46.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:41 now: 2015-02-15 at 13:19:46 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:46.133 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:46.189 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:46 now: 2015-02-15 at 13:19:51 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:46.190 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:51 <0x2e607680>
02 02/15/15 13:19:47.103 ZW_Send_Data node 11 USING ROUTE 3.0.0.0 <0x2b807680>
06 02/15/15 13:19:51.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:46 now: 2015-02-15 at 13:19:51 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:51.135 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:19:51.191 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:19:51 now: 2015-02-15 at 13:19:56 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:19:51.192 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:19:56 <0x2e607680>
02 02/15/15 13:19:51.387 ZW_Send_Data node 11 USING ROUTE 3.0.0.0 <0x2b807680>
06 02/15/15 13:19:56.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:51 now: 2015-02-15 at 13:19:56 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:19:56.205 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:20:01.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:19:56 now: 2015-02-15 at 13:20:01 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:20:01.132 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>
06 02/15/15 13:20:01.190 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:20:01 now: 2015-02-15 at 13:20:06 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
50 02/15/15 13:20:01.191 luup_log:203: GCal3 V 1.1:Next check will be in 5 sec on 2015-02-15 at 13:20:06 <0x2e607680>
06 02/15/15 13:20:06.101 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:20:01 now: 2015-02-15 at 13:20:06 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e607680>
06 02/15/15 13:20:06.159 Device_Variable::m_szValue_set device: 203 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2e607680>

and
Quote
http error code : closed

Code: [Select]
06 02/15/15 13:55:00.101 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-15 at 13:39:27 now: 2015-02-15 at 13:55:00 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ee09680>
06 02/15/15 13:55:00.131 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonEvents was: [{'eventEnd':1423958460,'eventStart':1423958400,'eventParameter':'ON','eventName':'CHARGE'},{'eventEnd':1423978020,'eventStart':1423977900,'eventParameter':'LED_cuisine_ON','eventName':'LAMPE'},{'eventEnd':1423979820,'eventStart':1423979700,'eventParameter':'\'PROG\':\'JOUR\'','eventName':'CHAUFF'},{'eventEnd':1423980000,'eventStart':1423979880,'eventParameter':'OFF','eventName':'CHARGE'},{'eventEnd':1423980420,'eventStart':1423980300,'eventParameter':'LED_cuisine_OFF','eventName':'LAMPE'},{'eventEnd':1423998360,'eventStart':1423998300,'eventParameter':'ON','eventName':'CHARGE'},{'eventEnd':1424004960,'eventStart':1424004900,'eventParameter':'OFF','eventName':'CHARGE'},{'eventEnd':1424017920,'eventStart':1424017800,'eventParameter':'LED_cuisine_ON','eventName':'LAMPE'},{'eventEnd':1424025120,'eventStart':1424025000,'eventParameter':'\'PROG\':\'NUIT\'','eventName':'CHAUFF'},{'eventEnd':1424025660,'eventStart':1424025600,'eventParameter':'chLampe_ON','eventName':'LAMPE'},{'eventEnd':1424027460,'eventStart':1424027400,'eventParameter':'fleurs_ON','eventName':'LAMPE'},{'eventEnd':1424034420,'eventStart':1424034300,'eventParameter':'fleurs_OFF','eventName':'LAMPE'},{'eventEnd':1424035860,'eventStart':1424035800,'eventParameter':'chLampe_OFF','eventName':'LAMPE'},{'eventEnd':1424037120,'eventStart':1424037000,'eventParameter':'LED_cuisine_OFF','eventName':'LAMPE'},{'eventEnd':1424044860,'eventStart':1424044800,'eventParameter':'ON','eventName':'CHARGE'},{'eventEnd':1424064420,'eventStart':1424064300,'eventParameter':'LED_cuisine_ON','eventName':'LAMPE'},{'eventEnd':1424066220,'eventStart':1424066100,'eventParameter':'\'PROG\':\'JOUR\'','eventName':'CHAUFF'},{'eventEnd':1424066400,'eventStart':1424066280,'eventParameter':'OFF','eventName':'CHARGE'},{'eventEnd':1424066820,'eventStart':1424066700,'eventParameter':'LED_cuisine_OFF','eventName':'LAMPE'},{'eventEnd':1424084760,'eventStart':1424084700,'eventParameter':'ON','eventName':'CHARGE'},{'eventEnd':1424091360,'eventStart':1424091300,'eventParameter':'OFF','eventName':'CHARGE'}] now: [] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ee09680>
50 02/15/15 13:55:00.131 luup_log:206: GCal3 V 1.1:Checking semaphore <0x2ee09680>
50 02/15/15 13:55:00.157 luup_log:206: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ee09680>
50 02/15/15 13:55:00.157 luup_log:206: GCal3 V 1.1:Semaphore file returned 0 <0x2ee09680>
50 02/15/15 13:55:00.158 luup_log:206: GCal3 V 1.1:Device 206 requested semaphore <0x2ee09680>
50 02/15/15 13:55:00.183 luup_log:206: GCal3 V 1.1:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ee09680>
50 02/15/15 13:55:00.184 luup_log:206: GCal3 V 1.1:Device 206 claimed semaphore <0x2ee09680>
50 02/15/15 13:55:00.187 luup_log:206: GCal3 V 1.1:StartMin is 2015-02-15T00:00:00.000Z StartMax is 2015-02-16T15:55:00.000Z <0x2ee09680>
50 02/15/15 13:55:00.187 luup_log:206: GCal3 V 1.1:End of day is 2015-02-15T23:59:59 <0x2ee09680>
50 02/15/15 13:55:00.188 luup_log:206: GCal3 V 1.1:Function: requestCalendar <0x2ee09680>
50 02/15/15 13:55:00.188 luup_log:206: GCal3 V 1.1:Function: get_access_token <0x2ee09680>
50 02/15/15 13:55:02.267 luup_log:206: GCal3 V 1.1:Token info status: HTTP/1.1 200 OK <0x2ee09680>
50 02/15/15 13:55:02.272 luup_log:206: GCal3 V 1.1:Token will expire in 2666 sec <0x2ee09680>
50 02/15/15 13:55:02.272 luup_log:206: GCal3 V 1.1:Checking google calendar <0x2ee09680>
06 02/15/15 13:55:02.273 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: CHARGE now: Accessing Calendar #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ee09680>
06 02/15/15 13:55:02.274 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: 13:55 Feb 15 to 13:56 Feb 15 now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ee09680>
50 02/15/15 13:55:02.275 luup_log:206: GCal3 V 1.1:Requested url: https://www.googleapis.com/calendar/v3/calendars/cb99pkuse41r6f4fjkatc3unpc@group.calendar.google.com/events?access_token=ya29.GwGJHiXFXxv87hi4ux4M4An9aoB7O3A65KNs4K9sF85k9lAcI2Ha49VE&timeZone=utc&singleEvents=true&orderBy=startTime&timeMax=2015-02-16T15:55:00.000Z&timeMin=2015-02-15T00:00:00.000Z&fields=items(description%2Cend%2Cstart%2Csummary) <0x2ee09680>
50 02/15/15 13:55:34.467 luup_log:206: GCal3 V 1.1:Http request error. Code : closed <0x2ee09680>
06 02/15/15 13:55:34.468 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Accessing Calendar now: http error code: closed #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ee09680>
06 02/15/15 13:55:34.469 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ee09680>
50 02/15/15 13:55:34.471 luup_log:206: GCal3 V 1.1:Device 206 released the semaphore - reason: calendar check complete <0x2ee09680>
06 02/15/15 13:55:34.473 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-15 at 13:55:00 now: 2015-02-15 at 16:55:00 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2ee09680>
50 02/15/15 13:55:34.473 luup_log:206: GCal3 V 1.1:Next check will be in 10800 sec on 2015-02-15 at 16:55:00 <0x2ee09680>
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 15, 2015, 11:29:03 am
@minimoibientot

It looks a time out on the request to get the calendar data.  There is a ~30 sec delay between the request for the data and the error and this is the same as the request timeout setting.

50   02/15/15 13:55:34.467   luup_log:206: GCal3 V 1.1:Http request error. Code : closed <0x2ee09680>

Also - the error code "closed" is not a http error code and may be being generated by the lua module that is making the call.

I will post a version of GCal3.lua later today that has some debug code around this to see if we can figure out what's going on.

My best guess is that this is a network or google related error.  Do you have a very reliable network ?   Do you sometimes have trouble accessing google ?

Also - what version of vera UI, what vera hardware and what release level are you using ?  The reason I ask is that there are differences - so I want to make sure we understand if that's a possibility.
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 15, 2015, 11:54:10 am
thank you for the help

what is strange is that I have 5 GCal3
and only the # 206 raises concerns

I am under :
UI5
1.5.622FR
GCal3 v1.1
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 15, 2015, 03:05:39 pm
thank you for the help

what is strange is that I have 5 GCal3
and only the # 206 raises concerns

I am under :
UI5
1.5.622FR
GCal3 v1.1

What happens if you set device 206 to a different calendar (i.e. one of the other calendars that you have set and which work ?).  There is no problem pointing 2 instances of GCal3 to the same calendar.
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 15, 2015, 03:31:44 pm
I actually #206 and #203 that are on the same schedule
1 Trigge on "chauff"
and another without keyword


and only #206 indicates errors
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 15, 2015, 05:56:08 pm
I actually #206 and #203 that are on the same schedule
1 Trigge on "chauff"
and another without keyword


and only #206 indicates errors

Try this version og GCal3.lua.  I do not expect it to fix anything - just give a bit more debug info.  Also - I noticed an error being thrown after what looks like the https.request timeout which I  hope is now suppressed.

Then take a look at the lines that look like this - for both #206 and #203

Requested url: https://www.googleapis.com/calendar/v3/calendars/cb99pkuse41r6f4fjkatc3unpc@group.calendar.google.com/events?access_token=ya29.GwGJHiXFXxv87hi4ux4M4An9aoB7O3A65KNs4K9sF85k9lAcI2Ha49VE&timeZone=utc&singleEvents=true&orderBy=startTime&timeMax=2015-02-16T15:55:00.000Z&timeMin=2015-02-15T00:00:00.000Z&fields=items(description%2Cend%2Cstart%2Csummary)

They should be identical.

EDIT: Removed attachment
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 16, 2015, 04:51:29 am
file installed
thank you

I watch the logs
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 24, 2015, 12:43:08 pm
file installed
thank you

I watch the logs

How is it working ?
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 25, 2015, 01:05:21 pm
goodnight Stuart

until today to 12:10
yes i do  ;)

but since "fatal error"

Code: [Select]
06 02/25/15 18:08:24.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:19 now: 2015-02-25 at 18:08:24 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:24.193 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:24 now: 2015-02-25 at 18:08:29 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:24.194 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:29 <0x2f867680>
06 02/25/15 18:08:29.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:24 now: 2015-02-25 at 18:08:29 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:29.204 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:29 now: 2015-02-25 at 18:08:34 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:29.206 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:34 <0x2f867680>
06 02/25/15 18:08:34.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:29 now: 2015-02-25 at 18:08:34 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:34.189 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:34 now: 2015-02-25 at 18:08:39 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:34.260 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:39 <0x2f867680>
06 02/25/15 18:08:39.102 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:34 now: 2015-02-25 at 18:08:39 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:39.188 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:39 now: 2015-02-25 at 18:08:44 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:39.189 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:44 <0x2f867680>
06 02/25/15 18:08:44.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:39 now: 2015-02-25 at 18:08:44 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:44.187 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:44 now: 2015-02-25 at 18:08:49 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:44.188 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:49 <0x2f867680>
06 02/25/15 18:08:49.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:44 now: 2015-02-25 at 18:08:49 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:49.189 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:49 now: 2015-02-25 at 18:08:54 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:49.190 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:54 <0x2f867680>
06 02/25/15 18:08:54.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:49 now: 2015-02-25 at 18:08:54 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:08:54.214 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:54 now: 2015-02-25 at 18:08:59 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:54.216 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:08:59 <0x2f867680>
08 02/25/15 18:08:57.321 JobHandler_LuaUPnP::HandleActionRequest device: 206 service: urn:srs-com:serviceId:GCalIII action: GCalCheck <0x325a8680>
08 02/25/15 18:08:57.321 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=206 <0x325a8680>
08 02/25/15 18:08:57.322 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:srs-com:serviceId:GCalIII <0x325a8680>
08 02/25/15 18:08:57.322 JobHandler_LuaUPnP::HandleActionRequest argument action=GCalCheck <0x325a8680>
08 02/25/15 18:08:57.322 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.2834179020163041 <0x325a8680>
06 02/25/15 18:08:57.323 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Fatal error - access token now: Checking ... #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x325a8680>
06 02/25/15 18:08:57.323 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x325a8680>
02 02/25/15 18:08:57.368 ZW_Send_Data node 12 USING ROUTE 3.0.0.0 <0x2c467680>
06 02/25/15 18:08:59.101 Device_Variable::m_szValue_set device: 206 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 16:55:27 now: 2015-02-25 at 18:08:59 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f667680>
50 02/25/15 18:08:59.102 luup_log:206: GCal3 V 1.2B:Checking semaphore <0x2f667680>
06 02/25/15 18:08:59.120 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:54 now: 2015-02-25 at 18:08:59 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:59.174 luup_log:206: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2f667680>
50 02/25/15 18:08:59.176 luup_log:206: GCal3 V 1.2B:Semaphore file returned 206 <0x2f667680>
50 02/25/15 18:08:59.223 luup_log:206: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2f667680>
50 02/25/15 18:08:59.226 luup_log:206: GCal3 V 1.2B:Device 206 claimed semaphore <0x2f667680>
50 02/25/15 18:08:59.228 luup_log:206: GCal3 V 1.2B:StartMin is 2015-02-25T00:00:00.000Z StartMax is 2015-02-26T20:08:59.000Z <0x2f667680>
50 02/25/15 18:08:59.228 luup_log:206: GCal3 V 1.2B:End of day is 2015-02-25T23:59:59 <0x2f667680>
50 02/25/15 18:08:59.229 luup_log:206: GCal3 V 1.2B:Function: requestCalendar <0x2f667680>
50 02/25/15 18:08:59.229 luup_log:206: GCal3 V 1.2B:Function: get_access_token <0x2f667680>
01 02/25/15 18:08:59.229 LuaInterface::CallFunction_Timer-5 function GCalMain failed [string "local GCAL_VERSION = "V 1.2B"  ..."]:227: attempt to concatenate field 'access_token' (a nil value) <0x2f667680>
06 02/25/15 18:08:59.431 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:08:59 now: 2015-02-25 at 18:09:04 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:08:59.432 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:09:04 <0x2f867680>
02 02/25/15 18:08:59.519 ZW_Send_Data node 12 USING ROUTE 3.0.0.0 <0x2c467680>
06 02/25/15 18:09:04.102 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:08:59 now: 2015-02-25 at 18:09:04 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:09:04.186 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:09:04 now: 2015-02-25 at 18:09:09 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:09:04.187 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:09:09 <0x2f867680>
06 02/25/15 18:09:09.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:09:04 now: 2015-02-25 at 18:09:09 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:09:09.188 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:09:09 now: 2015-02-25 at 18:09:14 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:09:09.189 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:09:14 <0x2f867680>
06 02/25/15 18:09:14.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:09:09 now: 2015-02-25 at 18:09:14 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
06 02/25/15 18:09:14.196 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:09:14 now: 2015-02-25 at 18:09:19 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f867680>
50 02/25/15 18:09:14.197 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:09:19 <0x2f867680>

or lock on "checking"  :-\

Code: [Select]
02/25/15 18:24:48.266 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:24:53 <0x2f0f5680>
06 02/25/15 18:24:53.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:24:48 now: 2015-02-25 at 18:24:53 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
06 02/25/15 18:24:53.180 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:24:53 now: 2015-02-25 at 18:24:58 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
50 02/25/15 18:24:53.181 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:24:58 <0x2f0f5680>
50 02/25/15 18:24:54.101 luup_log:204: GCal3 V 1.2B:Delay = delayedstart <0x2ecf5680>
50 02/25/15 18:24:54.101 luup_log:204: GCal3 V 1.2B:Checking semaphore <0x2ecf5680>
50 02/25/15 18:24:54.126 luup_log:204: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecf5680>
50 02/25/15 18:24:54.127 luup_log:204: GCal3 V 1.2B:Semaphore file returned 206 <0x2ecf5680>
50 02/25/15 18:24:54.151 luup_log:204: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecf5680>
50 02/25/15 18:24:54.152 luup_log:204: GCal3 V 1.2B:Device 206 blocked semaphore request from device 204 <0x2ecf5680>
06 02/25/15 18:24:54.153 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecf5680>
06 02/25/15 18:24:54.153 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecf5680>
06 02/25/15 18:24:58.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:24:53 now: 2015-02-25 at 18:24:58 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
06 02/25/15 18:24:58.178 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:24:58 now: 2015-02-25 at 18:25:03 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
50 02/25/15 18:24:58.179 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:25:03 <0x2f0f5680>
06 02/25/15 18:25:03.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:24:58 now: 2015-02-25 at 18:25:03 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
06 02/25/15 18:25:03.179 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:25:03 now: 2015-02-25 at 18:25:08 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
50 02/25/15 18:25:03.179 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:25:08 <0x2f0f5680>
50 02/25/15 18:25:04.100 luup_log:204: GCal3 V 1.2B:Delay = delayedstart <0x2ecf5680>
50 02/25/15 18:25:04.101 luup_log:204: GCal3 V 1.2B:Checking semaphore <0x2ecf5680>
50 02/25/15 18:25:04.127 luup_log:204: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecf5680>
50 02/25/15 18:25:04.128 luup_log:204: GCal3 V 1.2B:Semaphore file returned 206 <0x2ecf5680>
50 02/25/15 18:25:04.152 luup_log:204: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecf5680>
50 02/25/15 18:25:04.153 luup_log:204: GCal3 V 1.2B:Device 206 blocked semaphore request from device 204 <0x2ecf5680>
06 02/25/15 18:25:04.153 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecf5680>
06 02/25/15 18:25:04.154 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecf5680>
02 02/25/15 18:25:04.258 ZW_Send_Data node 11 USING ROUTE 255.152.193.190 <0x2bcf5680>
06 02/25/15 18:25:08.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:25:03 now: 2015-02-25 at 18:25:08 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
06 02/25/15 18:25:08.178 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:25:08 now: 2015-02-25 at 18:25:13 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 __LEAK__ this:20480 start:4034560 to 0x1b54000 <0x2f0f5680>
50 02/25/15 18:25:08.179 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:25:13 <0x2f0f5680>
06 02/25/15 18:25:13.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:25:08 now: 2015-02-25 at 18:25:13 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
06 02/25/15 18:25:13.188 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:25:13 now: 2015-02-25 at 18:25:18 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 __LEAK__ this:4096 start:4100096 to 0x1b64000 <0x2f0f5680>
50 02/25/15 18:25:13.189 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:25:18 <0x2f0f5680>
50 02/25/15 18:25:14.101 luup_log:204: GCal3 V 1.2B:Delay = delayedstart __LEAK__ this:8192 start:4108288 to 0x1b66000 <0x2ecf5680>
50 02/25/15 18:25:14.101 luup_log:204: GCal3 V 1.2B:Checking semaphore <0x2ecf5680>
50 02/25/15 18:25:14.126 luup_log:204: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecf5680>
50 02/25/15 18:25:14.127 luup_log:204: GCal3 V 1.2B:Semaphore file returned 206 <0x2ecf5680>
50 02/25/15 18:25:14.151 luup_log:204: GCal3 V 1.2B:Command ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x2ecf5680>
50 02/25/15 18:25:14.152 luup_log:204: GCal3 V 1.2B:Device 206 blocked semaphore request from device 204 <0x2ecf5680>
06 02/25/15 18:25:14.152 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Waiting for startup now: Waiting for startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecf5680>
06 02/25/15 18:25:14.153 Device_Variable::m_szValue_set device: 204 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ecf5680>
06 02/25/15 18:25:18.101 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-02-25 at 18:25:13 now: 2015-02-25 at 18:25:18 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f0f5680>
06 02/25/15 18:25:18.190 Device_Variable::m_szValue_set device: 230 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-02-25 at 18:25:18 now: 2015-02-25 at 18:25:23 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 __LEAK__ this:28672 start:4136960 to 0x1b6d000 <0x2f0f5680>
50 02/25/15 18:25:18.191 luup_log:230: GCal3 V 1.2B:Next check will be in 5 sec on 2015-02-25 at 18:25:23 <0x2f0f5680>
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 25, 2015, 01:19:08 pm
Code: [Select]
os.execute( 'reboot' )
and returned in order
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 25, 2015, 03:47:32 pm
file installed
thank you

I watch the logs

Ok - I made a small change that will fix one part of the problem - a symptom.

What's happening is that sometimes the plugin is unable to get an access token from google and that was causing the plugin to crash some time later.  I've fixed that behavior.  If it fails to get a valid token it will retry after 60 seconds.

Maybe now we will get to the part of the code where it tells us why it was not getting an access token.

Try this update

EDIT: removed attachment
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 25, 2015, 04:00:09 pm
thank you for your speed

I just set up
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on February 25, 2015, 08:56:08 pm
thank you for your speed

I just set up

Added a front panel message if there is an error
Title: Re: GCAL3 - V 1.1 Released
Post by: minimoibientot on February 26, 2015, 12:15:06 pm
file installed
 ;)
Title: V1.2 Beta with add event to Calendar
Post by: Stuart on March 05, 2015, 06:19:02 pm
This release (V1.2B) rolls up some minor corrections and better handling of iCal date format.

The BIG news is that I've added the capability to create events in google calendar - it leverages the authentication already built into GCal3 - so there is no additional login / credential checking etc.

The attached 3 files (S_GCal3.xml, I_GCal3.xml and GCal3.lua) update V1.1 from the marketplace.  Several things to note:
(1) This only works when the plugin is associated with a google calendar NOT an iCalendar (i.e. do not use the iCal reference to a google calendar)
(2) You need to make sure that your calendar sharing is set so that service account can Make Changes to events

Here's an example of how to create an event - there are three mandatory inputs startDate, endDate and title - description is optional.  Be careful to preserve the JSON structure.  The example shows one event inside the  [] but the code will handle multiple events [{event1},{event2}, ....... ,{eventn}].
title and description can have the optional [start,end] offset and the {parameter} attributes that are recognised by GCal3.
startDate and endDate MUST be in the form yyyy-mm-ddThh:mm:ss for local time OR  yyyy-mm-ddThh:mm:ssZ for utc.  No other representations are allowed
The parameter passed into the  luup.call_action call must be an array of the form
ArrayName.CalendarEvent as 'CalendarEvent' is the name of the parameter that the plugin is expecting e.g.' Event.CalendarEvent' in the example below.

Please provide feedback !

Code: [Select]
-- Sample code for adding event
local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
local GCAL_DEV = 3    -- The GCAL device number
local startDate = os.date("%Y-%m-%dT%H:%M:%S", os.time()+(1*3600)) -- plus one hour
local endDate = os.date("%Y-%m-%dT%H:%M:%S", os.time()+(1.5*3600)) -- plus 1.5 hour
local title = "TEST[-5,-5]"
local description = "MyDescription1{event parameter}"
local Event = {}

local event1 = '[{"eventName":"' ..
               title
               .. '","eventStart":"' ..
               startDate
               ..'","eventEnd":"' ..
               endDate
               .. '","eventDescription":"' ..
               description
               .. '"}]'

Event.CalendarEvent = event1

local resultcode,_,_,_ = luup.call_action(GCAL_SID, "AddEvent",Event, GCAL_DEV)
Title: Re: GCAL3 - V 1.1 Released
Post by: CudaNet on March 09, 2015, 06:18:02 pm
Haven't had a chance to load this yet, too many projects on going at work. Will hopefully have some free time mid to end of week so I'll be able to provide input then. Quick question though, I see there are mandatory input fields, are there any optional ones (e.g. "Where") ?

Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on March 09, 2015, 07:18:03 pm
Haven't had a chance to load this yet, too many projects on going at work. Will hopefully have some free time mid to end of week so I'll be able to provide input then. Quick question though, I see there are mandatory input fields, are there any optional ones (e.g. "Where") ?

For now - I just just used the same fields that GCal3 knows about / uses / exports  -- start, end, title and (optionally) description.
Partly it was my thinking that the events added to the calendar might be future events that GCal would react to.
There is nothing to limit that -- so if other fields had appeal - then I could add them (assuming we did not get carried away :-))
I think keeping it in the context of home automation probably keeps the number of fields fairly small.
Title: Re: GCAL3 - V 1.1 Released
Post by: CudaNet on March 10, 2015, 01:18:43 pm
Sounds good Stuart, I have no doubt that the provisions you made will suffice (agree totally with what comes up goes down, nice an simple...). I just need to think about how I'm going to re-tool for upstream...

Haven't had a chance to load this yet, too many projects on going at work. Will hopefully have some free time mid to end of week so I'll be able to provide input then. Quick question though, I see there are mandatory input fields, are there any optional ones (e.g. "Where") ?

For now - I just just used the same fields that GCal3 knows about / uses / exports  -- start, end, title and (optionally) description.
Partly it was my thinking that the events added to the calendar might be future events that GCal would react to.
There is nothing to limit that -- so if other fields had appeal - then I could add them (assuming we did not get carried away :-))
I think keeping it in the context of home automation probably keeps the number of fields fairly small.
Title: Re: GCAL3 - V 1.1 Released
Post by: TwannieM on March 12, 2015, 03:39:27 am
Good morning Steward

I noticed the pluging always gives me a Cridentials error after rebooting the luup.
Is there a way around this?
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on March 12, 2015, 09:22:00 am
Good morning Steward

I noticed the pluging always gives me a Cridentials error after rebooting the luup.
Is there a way around this?
It depend on what you mean by a 'credentials error'.  If you reboot luup then the plugin has no authentication token (I only keep it in memory) and so it must get a new token.
With gc_debug = 3.  The following log message is normal. Ignore the "GCal3 V_TEST"

"GCal3 V_TEST:Function: get_access_token"
"GCal3 V_TEST:Token Info request status: HTTP/1.1 400 Bad Request"
"GCal3 V_TEST:Getting a new token"
"GCal3 V_TEST:Got new token"

Also tokens expire after 1 hr - so the above log entry would also appear.

If you are experiencing something else - let me know with fuller details.
 

Title: Re: GCAL3 - V 1.1 Released
Post by: becky on March 13, 2015, 02:17:14 pm
I just have to tell you that as a mom that relies on her Google calendar a LOT, this is my absolute favorite plug-in. I'm really impressed with the thought that went into it.
Title: Re: GCAL3 - V 1.1 Released
Post by: Stuart on March 13, 2015, 02:38:33 pm
I just have to tell you that as a mom that relies on her Google calendar a LOT, this is my absolute favorite plug-in. I'm really impressed with the thought that went into it.

Thank You !  You made my day !

It takes a village! -- I simply took the original work that others had started, updated it a bit and shamelessly added the ideas of many more.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: bigmonkey70 on March 26, 2015, 09:33:40 pm
I am about to implement the GCal3 in my Vera..  I installed the plug in and set up went OK.  Event displayed and triggered OK.
Now I would like to get these conditions working if possible.
I have birthday, doctor appointment, car service appoinment, kids' school event and closer all entered in Google Calendar.

How Do I trigger these events and TTS through imperihome?  Is it even possible that depend on event keyword and triiger imperihome to speak according to that event??

example: if a dr. appt come up tomorrow, then tonight the event trigger (with the delta set) and imperihome announce the reminder that I have a Dr. appt tomorrow.  Or If a Birthday come up then in the morning imperihome say happy birthday. etc

Also I am unable to set the gc_Value.  I have added {xxx} to the end of the Google Calendar event name and after reloads and fresh browser, that field remain empty.

Thx
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on March 27, 2015, 12:53:13 pm
I am about to implement the GCal3 in my Vera..  I installed the plug in and set up went OK.  Event displayed and triggered OK.
Now I would like to get these conditions working if possible.
I have birthday, doctor appointment, car service appoinment, kids' school event and closer all entered in Google Calendar.

How Do I trigger these events and TTS through imperihome?  Is it even possible that depend on event keyword and triiger imperihome to speak according to that event??

example: if a dr. appt come up tomorrow, then tonight the event trigger (with the delta set) and imperihome announce the reminder that I have a Dr. appt tomorrow.  Or If a Birthday come up then in the morning imperihome say happy birthday. etc

Also I am unable to set the gc_Value.  I have added {xxx} to the end of the Google Calendar event name and after reloads and fresh browser, that field remain empty.

Thx

gc_Value does not get set unless the event is active / triggered.  It is not displayed on the front panel (mainly for space reasons).  Take a look at gc_jsonEvents (in the Advanced tab).  That will tell you which events the plugin sees and if the event is active / triggered then the parameter should be in gc_Value.

I am not familiar with imperihome - but so far, I am not aware of anyone having probems passing the available data to other devices.  Take a look at the discussion here:
http://forum.micasaverde.com/index.php/topic,28398.0.html

As to managing other plugins to react to different events and send those events different parameters:  I'l look closely at PLEG since it's very powerful and flexible - but you could start of just using scenes.   From a GCal3 perspective, you would likely set gc_triggerNoKeyword to true, leave gc_Keyword blank.   In  PLEG (or scenes - this will cause every event to be triggered (no nesting of events) PLEG or the scene can then (1) look a the value of gc_TrippedEvent react to the name of the event and (2) get the gc_Value parameter and do something with it.  There are, of course other ways.   

If this does not make sense - we can work through an example of your choosing.

You can try something like this in a scene

Code: [Select]
local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
local GCAL_DEV = 3    -- The GCAL device number
local eventValue= luup.variable_get (GCAL_SID, "gc_Value", GCAL_DEV ) or ""
local eventTitle = luup.variable_get (GCAL_SID, "gc_TrippedEvent", GCAL_DEV ) or "No event"
-- NOTE That event titles are all forced to upper case in the plugin
if (eventTitle == "DOCTOR") then
  -- do something
  luup.log("Event was " .. eventTitle .. " with parameter " .. eventValue)
elseif (eventTitle == "BIRTHDAY") then
  -- call plugin to announce birthday and pass it eventValue
  luup.log("Event was " .. eventTitle .. " with parameter " .. eventValue)
else
  luup.log("Just a test")
end

Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Octoplayer on March 27, 2015, 07:02:28 pm
HI,
Quote
This release (V1.2B) rolls up some minor corrections and better handling of iCal date format.

Where do I find 1.2 please? I have set 1.1 to auto update, but the MIOS app page does not show anything, and the 1.2B files in the forum have been deleted.

(I an getting an occasional reboot (1-2 every other day) due to a Vera Deadlock, so among other things I have upped the GCal debug to 3, and just noticed in the logs that I am still on V1.1)

Thanks
Octo
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on March 27, 2015, 07:23:13 pm
HI,
Quote
This release (V1.2B) rolls up some minor corrections and better handling of iCal date format.

Where do I find 1.2 please? I have set 1.1 to auto update, but the MIOS app page does not show anything, and the 1.2B files in the forum have been deleted.

(I an getting an occasional reboot (1-2 every other day) due to a Vera Deadlock, so among other things I have upped the GCal debug to 3, and just noticed in the logs that I am still on V1.1)

Thanks
Octo

This is a common vera problem.

To force an update (since vera is inconsistent in this regard) you can use
http://<your vera ip>:3480/data_request?id=update_plugin&Plugin=7016

7016 is the GCal3 plugin id

I clean up old files from the forum -- especially when there is a new release.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: bigmonkey70 on March 28, 2015, 01:59:41 pm
Hi Stuart,

Thank you for your guidance... I got mine working great now.
I just set a keyword REMINDER in all the Google Calendar event that I want Vera/Imperihome to Say the phrase.

And Luup code include an if statement that match the gc_TrippedEvent and pass the gc_value to Imperihome to Say it out to my bluetooth speaker.

Thanks


Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Octoplayer on March 29, 2015, 06:40:33 pm
Quote
To force an update (since vera is inconsistent in this regard) you can use
http://<your vera ip>:3480/data_request?id=update_plugin&Plugin=7016

Thanks for your help - that did the trick - and at least confirmed it was not the previous version of GCal causing the deadlock.
Octo
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: bigmonkey70 on April 07, 2015, 02:02:01 pm
Hi Stuart,

Just a quick question,  How does GCal3 handle multiple events in a particular day that mix with an all day event and a 1 hour event say happen at 8pm? 

Thanks
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on April 07, 2015, 04:16:37 pm
Hi Stuart,

Just a quick question,  How does GCal3 handle multiple events in a particular day that mix with an all day event and a 1 hour event say happen at 8pm? 

Thanks

There are multiple options in GCal3 for filtering events events based on keyword (or not), all day (or not) ignoring events based on keyword and etc.  I'll let you look at the documentation for the details.   Given several events that are 'illegible' - GCal3 will trigger on the first eligible event at it's start time.  Any event that is fully 'enclosed' by another event is ignored.  If an eligible event starts inside another event but finishes after - it is treated as if it started at the end of the first event.

In the case of all day events - no other event will be triggered unless you set the parameter gc_ignoreAllDayEvent - in which case it's as if the all day event was not there.   If you have a need to do something on all day events and also do something on other events during the day - you can install additional instances of the plugin.  They can point to the same (or different calendars) and be set with different filter parameters.

Hope this is helps.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: clabos on April 08, 2015, 01:13:51 pm
Hi. I have just started using gcal3. It is a great plugin! Very easy to get it working and let Sonos announce the events for the day. When browsing the forum though I find quite a few questions about nested/overlapping events (for instance the posts just above), and I do understand how gcal3 relates to that.

The plugin is great as it is but it would become Fantastic it it was able to fire off an event each time a calendar event either starts or finishes, regardless if they are nested or not! The scenario that seems to be most common amongst fellow posters are similar to mine - having a "family calendar" where all family members could add whatever they want to be reminded about. With the current solution someone will need to edit the calendar events to make sure there is no overlap. It is a completely different scenario compared to switching a heater on/off for example.

So the question is if this is functionality that one day may appear in the plugin? Otherwise I will try to figure out something on my own but it isn't trivial. And again - thank you for a great plugin!!!
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on April 09, 2015, 01:30:05 pm
Hi. I have just started using gcal3. It is a great plugin! Very easy to get it working and let Sonos announce the events for the day. When browsing the forum though I find quite a few questions about nested/overlapping events (for instance the posts just above), and I do understand how gcal3 relates to that.

The plugin is great as it is but it would become Fantastic it it was able to fire off an event each time a calendar event either starts or finishes, regardless if they are nested or not! The scenario that seems to be most common amongst fellow posters are similar to mine - having a "family calendar" where all family members could add whatever they want to be reminded about. With the current solution someone will need to edit the calendar events to make sure there is no overlap. It is a completely different scenario compared to switching a heater on/off for example.

So the question is if this is functionality that one day may appear in the plugin? Otherwise I will try to figure out something on my own but it isn't trivial. And again - thank you for a great plugin!!!

I have an idea for a companion plugin that can be used in the way you describe.   Basically a plugin that trips on every event start and finish and allows your scene(s) to respond depending on how you define them.   I've roughed out the design - it will take a couple of days, so some-time next week I'll post the beta version.

I'm planing on leveraging the gc_jasonEvents field already supported in the plugin, reading that data from one or more calendar plugins (you configure), merging and sorting all events by time order and then triggering the plugin on each event transition.   You can then set up a scene (or scenes) to be triggered by this new plugin, get the event name and whether it was the start or finish (using a couple of lines of LUA) and use that information in any way you want.

Does that sound interesting / usable ?
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: clabos on April 09, 2015, 04:41:45 pm
The companion plugin idea sounds perfect! I would be happy to test.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: vosmont on April 09, 2015, 04:50:47 pm
Hello Stuart !

Great plugin  :)

It seems that the json values in 'gc_jsonEvents' and 'gc_jsonActiveEvents' are not valids.
Code: [Select]
[{'eventParameter':'1','eventName':'EVENT'}]
should be
Code: [Select]
[{"eventParameter":"1","eventName":"EVENT"}]
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: CudaNet on April 09, 2015, 05:21:24 pm
@Vosmont
Yes, generates an unexpected token (when placed within a validation tool) - however, lua doesn't seem to have a problem decoding it...

@Stuart
love the idea of a companion plugin... I had workarounds in place to avoid generating overlapping events (pushed to Calendar) so this would be greatness..

Hello Stuart !

Great plugin  :)

It seems that the json values in 'gc_jsonEvents' and 'gc_jsonActiveEvents' are not valids.
Code: [Select]
[{'eventParameter':'1','eventName':'EVENT'}]
should be
Code: [Select]
[{"eventParameter":"1","eventName":"EVENT"}]
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on April 09, 2015, 06:26:25 pm
Hello Stuart !

Great plugin  :)

It seems that the json values in 'gc_jsonEvents' and 'gc_jsonActiveEvents' are not valids.
Code: [Select]
[{'eventParameter':'1','eventName':'EVENT'}]
should be
Code: [Select]
[{"eventParameter":"1","eventName":"EVENT"}]

I agree it is technically wrong.   I'll take a look - I explicitly reformat the double quotes to single quotes before saving - from memory it was to do with some nuance in Lua (or some lack of knowledge on my part).

I'll be playing around with the encode / decode etc over the next few days ans see what I discover.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: vosmont on April 10, 2015, 05:07:01 am
Thanks

FYI, library "dkjson" (provided by default) is not able to decode this value.

Have to do before :
Code: [Select]
value = value:gsub("'",'"')
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on April 10, 2015, 09:29:23 am
Thanks

FYI, library "dkjson" (provided by default) is not able to decode this value.

Have to do before :
Code: [Select]
value = value:gsub("'",'"')

Yes -- that's exactly the reverse of how I was creating the json string before saving.  I took a look and I suspect that there was some debug / logging formatting that was being screwed up and I 'fixed' the problem with single quotes (not even thinking single quotes were invalid json).

Also - there is / was no default library in vera at the time / across all versions so I install one that is apparently insensitive to the quotes. "json"

You can try this version - it's just got the offending reformat commented out (2 places) and seemed to work fine in some limited tests I have done.




Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: vosmont on April 10, 2015, 01:52:39 pm
Also - there is / was no default library in vera at the time / across all versions so I install one that is apparently insensitive to the quotes. "json"

Since UI7, there's the library "dkjson.lua" in "/usr/lib/lua".

GetVera has not communicated on that (I don't know why)
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: CudaNet on April 10, 2015, 02:48:52 pm
Exactly what Stuart said, I too was utilizing libraries that were insensitive towards single quotations. I typically use either just json or akb-json but then again I'm still on UI5. Good to know nonetheless.

Also - there is / was no default library in vera at the time / across all versions so I install one that is apparently insensitive to the quotes. "json"

Since UI7, there's the library "dkjson.lua" in "/usr/lib/lua".

GetVera has not communicated on that (I don't know why)
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on April 11, 2015, 01:43:43 pm

I have an idea for a companion plugin that can be used in the way you describe.   Basically a plugin that trips on every event start and finish and allows your scene(s) to respond depending on how you define them.   I've roughed out the design - it will take a couple of days, so some-time next week I'll post the beta version.

I'm planing on leveraging the gc_jasonEvents field already supported in the plugin, reading that data from one or more calendar plugins (you configure), merging and sorting all events by time order and then triggering the plugin on each event transition.   You can then set up a scene (or scenes) to be triggered by this new plugin, get the event name and whether it was the start or finish (using a couple of lines of LUA) and use that information in any way you want.

Does that sound interesting / usable ?

Having thought about this a little - and noting that some people are going to be pushed for RAM.  I'm now thinking a enhancement to the existing plugin - along these lines:
The rules for the plugin instance would still apply in that only  'eligible events' would be considered.  Whenever an eligible event starts or ends a variable
gc_notify (normally 0) would be set to 1 for one minute and an Luup event raised so you can trigger a scene.

During that one minute 3 new variables would be populated (otherwise they would be blank)
gc_notifyName, gc_notifyValue and gc_notifyType (either "Start" or "End").
You could gather these three variables into your scene and do whatever.

Thoughts / Comments ?




 

Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: clabos on April 13, 2015, 03:12:57 am
Hi
Personally I think your original design sounded better.
- How does the new design copes with events that happen in the same minute?
- Regarding memory - I suppose one will need another plugin (PLEG?) that checks for changes of the gc_notify variable? Unless such a plugin is already installed that will require some overhead too.
/Claes
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on April 27, 2015, 02:25:46 pm
Hi
Personally I think your original design sounded better.
- How does the new design copes with events that happen in the same minute?
- Regarding memory - I suppose one will need another plugin (PLEG?) that checks for changes of the gc_notify variable? Unless such a plugin is already installed that will require some overhead too.
/Claes

I have the changes working as a modification to the existing plugin and events in the same minute (start or end) do not seem to be an issue.  This has been working well for a couple of weeks .....

However - I have uncovered some problems within Mios (notifications not working) and am working with their developers to track down the issue (causes Luup to crash when trying to send email.......  I have an idea where the issue lies but it may be a few days yet before we understand the 'why'.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: JackTheMan18 on May 04, 2015, 10:33:37 am
Hello.
I'm a new user, so please forgive my ignorance.
Does this plugin work with UI7?

Also, let me explain what I'm trying to do.
Based on an entry in my google calendar, I'd like to trigger a scene (just simply turning on lights, etc.)

Is this the app to do that?

Thanks for the help.

Also, can someone point to the documentation for this app?
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Stuart on May 04, 2015, 11:02:26 am
YES and YES !! .....   along with a few other things !

The documentation is on page 1 of this thread and is pretty much up to date as of release 1.1.  There are a couple of new capabilities in release 1.2 (in the release notes).

Just follow the instructions closely - especially getting your google credentials and you should be fine.  Enjoy.
Title: Re: GCAL3 - V 1.3 beta - with Overlapping Event Start End Notification
Post by: Stuart on May 04, 2015, 09:34:17 pm
This 1.3b version has an additional trigger that can be used for a variety of purposes.  It triggers on event start and end including overlapping events.  The events must still be 'eligible':
e.g. 1 If you set a keyword - then only events (including overlapping events) with that keyword are 'eligible'.
e.g. 2 To notify on all events - do not set a keyword and all events are 'eligible'.
The trigger is called "Event Start or End" and there are four new variables that can be accessed by Luup Code.  These are:
gc_notify --> either "0" or "1"
gc_notifyName --> the event name
gc_notifyValue --> any event parameter (i.e. the bit in {}) if used
gc_notifyType --> either "Start" or "End"

gc_notify is set to "1" at the Start and End of an event and is reset to "0" 15 sec later.  The other variables are reset to ""

If events have the same start or end time - the notifications are spaced approximately 5 seconds apart.

The beta version can be installed with:

http://<your vera IP>:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=7016&Version=27332
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on May 13, 2015, 10:21:27 am
I found a rare condition when the new notifications would repeat.  I have fixed this and re-released V1.3.

You can get to it through the marketplace (likely tomorrow) or directly with this url

<your vera IP>:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=7016&Version=3597
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: clabos on May 14, 2015, 06:31:30 pm
Hi
Thank you for v1.3 and the start/end notifications - it works great!!! I did also get some of those repeated messages, glad you fixed that. I have tested it about two weeks in total and it has been very helpful.

I do however have two very strange issue. I am not sure if it is related to GCal3, it seems far fetched...
1) The main issue is that my door sensors stop working properly when I have GCal3 installed. Once I remove it they start to work again. When I open a door the event seems to get stuck in Vera until I close the door again. The open/close events are then triggered more or less at the same time (first "close", then "open"). When I remove GCal3 and manually change the "tripped" and "armed tripped" statuses = 0 when the door is closed it starts to work normally again.
2) The other odd thing is that my BinarySwitch-devices now have got "tripped" variables under "urn:micasaverde-com:serviceId:SecuritySensor1", I don't think they are there by default. That is not a big problem though, it makes some scripts do a few more iterations, but I have a feeling this is connected with the other issue.

Do any of the two issues above have any potential relation with GCal3? I have a love/hate relationship with Vera as she seems to have a mind of her own so I would not be surprised if this is just another of her mood swings.

Again, thanks for the great update.

Edit: After 24 since my last uninstall of GCal3 the issues I talked about above came back! It seems as Gcal3 has nothing to do with this. I am sorry I jumped to that conclusion but it seemed logical earlier.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on May 15, 2015, 11:48:41 am
BinarySwitch-devices now have got "tripped" variables under "urn:micasaverde-com:serviceId:SecuritySensor1"

Edit: After 24 since my last uninstall of GCal3 the issues I talked about above came back! It seems as Gcal3 has nothing to do with this. I am sorry I jumped to that conclusion but it seemed logical earlier.
GCal3 does use the "urn:micasaverde-com:serviceId:SecuritySensor1" schema but it is normal for devices to reuse other related schemas.  Luup is supposed to take care of keeping everything nicely separated.  I'd guess that the first level of separation is through the device_type (e.g. for GCal3 it is urn:schemas-srs-com:device:GCal:3) and device number and etc.

It's a long shot but have you manually installed any of these devices and perhaps used the same/wrong device_type setting ?

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: clabos on May 15, 2015, 12:12:19 pm
Thanks for the tips. No, I have not installed them manually. I think this behaviour started with the firmware update about 4 weeks ago. I have learned that the updates sometimes fix and sometimes break things. The sensors I am having most problems with are inexpensive Vision ZD2102 in case anyone makes a search on the name, but also my less inexpensive Fibaro sensors seem to be affected. I will contact the support and ask them.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on June 02, 2015, 08:56:37 am
Thanks for the tips. No, I have not installed them manually. I think this behaviour started with the firmware update about 4 weeks ago. I have learned that the updates sometimes fix and sometimes break things. The sensors I am having most problems with are inexpensive Vision ZD2102 in case anyone makes a search on the name, but also my less inexpensive Fibaro sensors seem to be affected. I will contact the support and ask them.

Have you got this working ?
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: ajbaab on June 08, 2015, 11:50:06 pm
I'm fairly new to Vera and I had (for a while) set up a wakeup mechanism based on gcal with one of the previous gCal apps(no longer works due to Google updates)  I believe I did everything to the T through the files. When I click the calendar it shows my gCalendar. However when I click check it simply states, "Next event", "In bypass mode", "."
I even tried from my iCal using the ical link. Same thing simply states, "Next event", "In bypass mode", "." .  I have not figured out where the logs show when I put it in debug mode.

From that is it possible to discern what I'm doing wrong?

Thank you!
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on June 09, 2015, 12:04:56 pm
I'm fairly new to Vera and I had (for a while) set up a wakeup mechanism based on gcal with one of the previous gCal apps(no longer works due to Google updates)  I believe I did everything to the T through the files. When I click the calendar it shows my gCalendar. However when I click check it simply states, "Next event", "In bypass mode", "."
I even tried from my iCal using the ical link. Same thing simply states, "Next event", "In bypass mode", "." .  I have not figured out where the logs show when I put it in debug mode.

From that is it possible to discern what I'm doing wrong?

Thank you!

Seems like the plugin is in bypass mode (i.e. not armed) ??.   You need to Arm it. Try that and then try "check" in the control tab.
If that does not work - get back to me (hopefully with a log file :-) )

The logs are the standard vera logs at /var/log/cmh/LuaUPnP.log

http://wiki.micasaverde.com/index.php/Logs

I usually use WinSCP to access he logs.  You still can (I think) access them from a browser using:

http://[your local ip]/cgi-bin/cmh/log.sh?Device=LuaUPnP




Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Georgethesixth on June 24, 2015, 11:04:18 am
Dear Sir,

I'm struggling learning LUA and I try to integrate with Google Calender.  Could I be allowed to look at your code ?  Can I see the code if I bought a Vera ? 

You don't have to do this for free : I can send a payment via PayPal   Please keep in mind that I am a student .

I don't want to offend you in any way so if my question is inappropriate please excuse me.

Kind regards,

George
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on June 29, 2015, 02:33:51 pm
Dear Sir,

I'm struggling learning LUA and I try to integrate with Google Calender.  Could I be allowed to look at your code ?  Can I see the code if I bought a Vera ? 

You don't have to do this for free : I can send a payment via PayPal   Please keep in mind that I am a student .

I don't want to offend you in any way so if my question is inappropriate please excuse me.

Kind regards,

George

George --
The code is free and you are more than welcome to look at the source code - BUT, understand that I was completely new to LUA when I started and while my technique evolved, I am not a professional programmer.  Also there are not a lot of comments - but you should be able to figure it out as it follows the LuuP approach.

If you have a VERA and install the plugin, the code is available (unless the author prevents it.  I allow it, mostly because of the comments above :-)

I'll attach a copy of the current version so you can download it  but will remove it in a few days as I don't like old versions lying around the forum .....

EDIT: Code removed
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: mtncomm1 on June 30, 2015, 12:24:33 pm
Stuart,

I have a client that uses GCal on his Vera Lite to control various functions at his rental cabin, and it is acting goofy all of a sudden. GCal keywords "occupied" & "unoccupied" simply turns a Virtual Switch On or Off. Depending on whether the VSwitch is On or Off, runs a series of timers in PLEG plugins. Lately the GCal seems to be seeing the Occupied & Unoccupied calender events ok, BUT it is not turning the VSwitch On when the cabin is Occupied as it should. IF memory serves me correctly, the plugin was case sensitive as far as how you entered events into your Google Calender. Could that be our problem?

Thanks in advance!
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on June 30, 2015, 03:26:42 pm
Stuart,

I have a client that uses GCal on his Vera Lite to control various functions at his rental cabin, and it is acting goofy all of a sudden. GCal keywords "occupied" & "unoccupied" simply turns a Virtual Switch On or Off. Depending on whether the VSwitch is On or Off, runs a series of timers in PLEG plugins. Lately the GCal seems to be seeing the Occupied & Unoccupied calender events ok, BUT it is not turning the VSwitch On when the cabin is Occupied as it should. IF memory serves me correctly, the plugin was case sensitive as far as how you entered events into your Google Calender. Could that be our problem?

Thanks in advance!

No matter how the event is named in the calendar - it is forced to all upper case.  Therefore any tests for trigger events need to be specified in upper case.  This was done to avoid ambiguity.   For example: calendar events "occupied", OccuPied" oCCupied" are all converted to OCCUPIED and so the test must also be for OCCUPIED.

Try it and let me know if it fixed your problem.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: slajgaj on July 02, 2015, 02:56:27 pm
Hi!
I installed and setting the Gcal3 plugin.
I see the next appointment, but the time zone is wrong.
In my home is gmt+2 and under the plugin the next event time is GMT!
What can i do wrong?
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on July 02, 2015, 09:54:03 pm
Hi!
I installed and setting the Gcal3 plugin.
I see the next appointment, but the time zone is wrong.
In my home is gmt+2 and under the plugin the next event time is GMT!
What can i do wrong?
Both Vera and google calendar have to be set to the same timezone.  Please check.
If this does not fix the problem what is the value of the variable gc_jsonEvents  (when you have an event in the calendar) and how does that compare to the time for the event in google calendar.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: slajgaj on July 03, 2015, 09:52:57 am
Stuart!

Yes, i cheked in Vera and in the Google calendar the time zone
All time is ok
In the json_event value is some character ??

In the GCAL3 Sensor you can see the start time is 16:30 not 18:30 !! 2 hours different?!

Ps: i'm using to GCAL3 the ical calendar link

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on July 03, 2015, 10:38:21 am
iCal does not have a consistent way to present date/time.  It has many options and it's up to the developer of the iCal which ones(s) they use - I have even seen multiple variations in the same calendar !.  GCAL3 handles some but not all variations.

If you are using google calendar to create your events then please use the regular google url - for a number of reasons, it is more efficient.

Please switch to the regular google link and see what happens.

Nothing in gc_jsonevents "[]" tells me there were no events in the calendar at the time of the screen shot - correct ?
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: slajgaj on July 06, 2015, 04:07:00 am
Stuart!

Thank you, i trying the regular google calendat.
Yes, the all screenshot is correct.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: dionmes on July 20, 2015, 04:09:17 pm
This plugin sounds great. I got it installed and added the Calender ID, now my calendar shows up under the Calendar tab. So I created an event and tried to trigger it, but there I get stuck. I have this message; "Next Event : The CalendarID is set" . And whatever event I create or keyword add (or keyword setting I change). Cant get rid of this message and it does not recognize any events ... Suggestions would be appreciated.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on July 20, 2015, 06:45:35 pm
This plugin sounds great. I got it installed and added the Calender ID, now my calendar shows up under the Calendar tab. So I created an event and tried to trigger it, but there I get stuck. I have this message; "Next Event : The CalendarID is set" . And whatever event I create or keyword add (or keyword setting I change). Cant get rid of this message and it does not recognize any events ... Suggestions would be appreciated.
Try pressing the 'check' button.  The plugin checks periodically for new events but when you are testing its usual to force a check manually.
For initial testing its easiest to leave gc_keyword blank so that the plugin responds to any event.
Title: Re: GCAL3 - V 1.2 Released - Now with Add Event to Calendar
Post by: Sig on July 20, 2015, 08:27:51 pm
This is a common vera problem.

To force an update (since vera is inconsistent in this regard) you can use
http://<your vera ip>:3480/data_request?id=update_plugin&Plugin=7016

7016 is the GCal3 plugin id

I clean up old files from the forum -- especially when there is a new release.

I've used this tip a number of times - thank you.  Is there a way for me to force a plugin update when I'm accessing one of my Veras remotely (i.e. not on the same network)?  I have a Vera in my vacation home, for which I need to force a plugin update, and was wondering if there's a way for me to do that before I am next physically in that home.  I'm going to guess there's some way for me to tunnel into my network in that house, assuming I set it up that way, but that's beyond my capabilities, so thought I'd ask here if there was another way.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on July 20, 2015, 09:48:02 pm
As far as I know there is no easy way to force a remote update - searching to forum may give you a better answer.
One thought .....  Is to run the http command with luup code on the Vera device again may be something in the forum.
Let me know if you find anything - might be the basis for a simple plugin ....
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: dionmes on July 21, 2015, 08:18:16 am
This plugin sounds great. I got it installed and added the Calender ID, now my calendar shows up under the Calendar tab. So I created an event and tried to trigger it, but there I get stuck. I have this message; "Next Event : The CalendarID is set" . And whatever event I create or keyword add (or keyword setting I change). Cant get rid of this message and it does not recognize any events ... Suggestions would be appreciated.
Try pressing the 'check' button.  The plugin checks periodically for new events but when you are testing its usual to force a check manually.
For initial testing its easiest to leave gc_keyword blank so that the plugin responds to any event.
Thanks for the quick reply, awesome support.

And forgive me for being an idiot, I somehow totally overlooked the service account setup procedure. And what happens is that since I am logged in at Google, the account looks like its working. While in fact, from the vera device it doesn't see anything. It's working great now, thanks.

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: tmuscedere on August 06, 2015, 10:46:30 am
Can anyone give me some help with the problem i am having?

I am running UI7. On the main control screen it shows the next event and the time the event will happen. But when I click on the calendar tab it is blank and does not show the calendar. obviously it is communicating with the calender from the main control tab. Any ideas what could be causing this? thanks.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on August 07, 2015, 12:31:32 am
Can anyone give me some help with the problem i am having?

I am running UI7. On the main control screen it shows the next event and the time the event will happen. But when I click on the calendar tab it is blank and does not show the calendar. obviously it is communicating with the calender from the main control tab. Any ideas what could be causing this? thanks.

I think this is a question of the permissions on your calendar.

The calendar display does not try to pass any credentials, its just invoking a url.  So if your browser session is not logged in to google, that can prevent the calendar tab from displaying.  I'm guessing this the issue you described.   Try logging onto you google account (in another browser tab) and then take a look a the calendar display again.

Other things can get in the way too - like:
Are you accessing a regular google calendar as opposed to an iCal calendar ?
What browser are you using?
Sometimes the vera interface does not refresh fully and needs an F5 to help it along.


Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: vio on August 17, 2015, 05:30:20 pm
Hi,

I have an issue with GCal3. After doing all steps, still not working. Error is Access or Calendar Error
Logs are:
50   08/18/15 0:24:47.110   luup_log:205: GCal3 V 1.3:local function:  checkGCal <0x73904520>
50   08/18/15 0:24:47.110   luup_log:205: GCal3 V 1.3:Checking semaphore <0x73904520>
50   08/18/15 0:24:47.131   luup_log:205: GCal3 V 1.3:Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x73904520>
50   08/18/15 0:24:47.132   luup_log:205: GCal3 V 1.3:Semaphore file returned 0 <0x73904520>
50   08/18/15 0:24:47.136   luup_log:205: GCal3 V 1.3:Device xxx requested semaphore <0x73904520>
50   08/18/15 0:24:47.156   luup_log:205: GCal3 V 1.3:Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0 <0x73904520>
50   08/18/15 0:24:47.157   luup_log:205: GCal3 V 1.3:Device xxx claimed semaphore <0x73904520>
50   08/18/15 0:24:47.159   luup_log:205: GCal3 V 1.3:StartMin is 2015-08-17T21:00:00Z StartMax is 2015-08-18T21:24:00Z <0x73904520>
50   08/18/15 0:24:47.160   luup_log:205: GCal3 V 1.3:End of day is 2015-08-18T23:59:59 <0x73904520>
50   08/18/15 0:24:47.160   luup_log:205: GCal3 V 1.3:local function: requestCalendar <0x73904520>
50   08/18/15 0:24:47.161   luup_log:205: GCal3 V 1.3:local function: get_access_token <0x73904520>
50   08/18/15 0:24:47.544   luup_log:205: GCal3 V 1.3:Token Info request status: HTTP/1.1 400 Bad Request <0x73904520>
50   08/18/15 0:24:47.544   luup_log:205: GCal3 V 1.3:Getting a new token <0x73904520>
50   08/18/15 0:24:47.965   luup_log:205: GCal3 V 1.3:The token request did not provide an access token <0x73904520>
06   08/18/15 0:24:47.966   Device_Variable::m_szValue_set device: xxx service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: The CalendarID is set now: Fatal error - access token #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x73904520>
06   08/18/15 0:24:47.966   Device_Variable::m_szValue_set device: 205 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: . now: . #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x73904520>
50   08/18/15 0:24:47.967   luup_log:205: GCal3 V 1.3:Fatal error trying to get access token <0x73904520>
50   08/18/15 0:24:47.971   luup_log:205: GCal3 V 1.3:Device xxx released the semaphore - reason: calendar check complete <0x73904520>
06   08/18/15 0:24:47.972   Device_Variable::m_szValue_set device: 205 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Fatal error - access token now: Access or Calendar Error #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x73904520>
06   08/18/15 0:24:47.972   Device_Variable::m_szValue_set device: 205 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: . now: 8 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x73904520>
06   08/18/15 0:24:47.974   Device_Variable::m_szValue_set device: 205 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck was: 2015-08-18 at 00:23:54 now: 2015-08-18 at 00:24:47 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x73904520>
06   08/18/15 0:24:47.976   Device_Variable::m_szValue_set device: 205 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck was: 2015-08-18 at 00:24:54 now: 2015-08-18 at 00:25:47 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x73904520>
50   08/18/15 0:24:47.977   luup_log:205: GCal3 V 1.3:Next check will be in 60 sec on 2015-08-18 at 00:25:47 <0x73904520>

Can anybody help?
Regards
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: vio on August 17, 2015, 05:42:06 pm
Please ignore my last comment. I did a mistake uploading the GCal3.json using scp, not with lump upload.
My bad,
Regards
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: davidw on August 27, 2015, 09:19:15 pm
Please switch to the regular google link and see what happens.

Stuart, I am stuck. My google calendar is set to US/Pacific. My Vera is set to US/Pacific. It shows the right time in UI5. But an event in my calendar on Aug 27 at 5:37pm shows up in Gcal3 as 01:37 Aug 28 to 02:37 Aug 28 (UTC). How can I get the time to be Pacific?

I am not sure what you mean by switch to the regular google link. I have tried all the ICS and HTML URLs I find in Google Calendar Settings. The events show up when I use the Private ICS, but the timezone is UTC and the events don't fire.

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on August 29, 2015, 10:32:51 am
Please switch to the regular google link and see what happens.

Stuart, I am stuck. My google calendar is set to US/Pacific. My Vera is set to US/Pacific. It shows the right time in UI5. But an event in my calendar on Aug 27 at 5:37pm shows up in Gcal3 as 01:37 Aug 28 to 02:37 Aug 28 (UTC). How can I get the time to be Pacific?

I am not sure what you mean by switch to the regular google link. I have tried all the ICS and HTML URLs I find in Google Calendar Settings. The events show up when I use the Private ICS, but the timezone is UTC and the events don't fire.

My guess is you may be using some form of iCal link and the specification of iCal allows all manner of date time representations -- Depending on who created the iCal then it can be inconsistent  -- I do not attempt to figure them all out.

If you are using a google calendar you should not have that issue provided you use the link.  When you copy it from the google calendar setup it's in the section called Embed this calendar and will look something like this:

<iframe src="https://www.google.com/calendar/embed?src=jiofwhpohg887fh08h0qhqrnd;%40group.calendar.google.com&ctz=America/Denver" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>




Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: davidw on September 09, 2015, 10:21:18 am
This worked for a few days and now stopped working.

I used that link, something like this: (changed slightly):
https://www.google.com/calendar/embed?src=[deleted]%40group.calendar.google.com%26ctz=America/Los_Angeles
[replaced the & with %26]

In the 2nd tab, it shows the calendar, so that link seems to work fine:
http://o7.no/1g9qjjb

But the front of the device shows access or calendar error and it doesn't load the events:
http://o7.no/1L1sFh1
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 09, 2015, 04:11:30 pm
This worked for a few days and now stopped working.

I used that link, something like this: (changed slightly):
https://www.google.com/calendar/embed?src=[deleted]%40group.calendar.google.com%26ctz=America/Los_Angeles
[replaced the & with %26]

In the 2nd tab, it shows the calendar, so that link seems to work fine:
http://o7.no/1g9qjjb

But the front of the device shows access or calendar error and it doesn't load the events:
http://o7.no/1L1sFh1

Did you copy the entire link
<iframe ........</iframe>  including the "<" at the start and the ">" at the end without changing anything ?  The plugin code extracts the relevant bits and makes changes necessary for the google api (which is different to the calendar display).

Since it was once working -- I'd go back and make sure the input (Calendar ID) is correctly entered (cut and paste <iframe ..... /iframe>) through the control tab.  Make sure you do not enter it directly into the advanced tab.

The error is telling us that there was no return of events from the query to google.

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: davidw on September 09, 2015, 10:15:54 pm
Thanks, Stuart. Just did that again, but still not working. Here are the two sides of the string:
http://o7.no/1EWHFeJ
http://o7.no/1OAPlU8

2nd tab still works fine:
http://o7.no/1OAPuHk

What do you recommend?

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 09, 2015, 11:41:14 pm
At this point we need a log file.  I suspect a credential or connection issue.  Can you set gc_debug to 3,  reboot and then set the calendar is again, when you get the error can you PM me the log and I'll take a look.

Before you do that, the other quick thing to check is that you have set the permissions on the calendar correctly.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: CudaNet on September 10, 2015, 12:00:03 pm
Stuart,

Quick question regarding GCAL events being pushed to a calendar (which has worked flawlessly for me so far !). IF my internet connection is down and an event is queued to push, will the plugin re-attempt until it can successfully write the event ?

Much appreciated...
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 10, 2015, 12:42:26 pm
Stuart,

Quick question regarding GCAL events being pushed to a calendar (which has worked flawlessly for me so far !). IF my internet connection is down and an event is queued to push, will the plugin re-attempt until it can successfully write the event ?

Much appreciated...

Glad to hear all is well.  From what I can tell the current version is very stable and it's only been setup nuances that cause concern.

Unfortunately - the answer to your question is "no". As it currently is, it's a 'one-shot' call and if it fails ... it fails .... there is no queue as such.  I'll take a look to see what might be done (to implement it properly) - it's not that hard but once you start down that path there's an extra level of detail ...

Unfortunately I'm very busy at work so no promises as to when.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: CudaNet on September 10, 2015, 01:05:13 pm
Yeah, setups can be difficult and anyone having issues must turn to the Info Viewer plugin and carefully observe what's happening.  I think at first I had some issues setting up the push but it was just me being stupid about using the proper calendar id. So now I have a 'scheduler' and an 'event' calendar which overlay each other (color coded). Doorbell, lock pin entries/exits (lock button pushed), garage door (opened,closed), motion sensors etc. have all been pushing data perfectly.

Appreciate (as always) the fast response AND you looking into making faulty internet connections a not so bad kind of thing...

Stuart,

Quick question regarding GCAL events being pushed to a calendar (which has worked flawlessly for me so far !). IF my internet connection is down and an event is queued to push, will the plugin re-attempt until it can successfully write the event ?

Much appreciated...

Glad to hear all is well.  From what I can tell the current version is very stable and it's only been setup nuances that cause concern.

Unfortunately - the answer to your question is "no". As it currently is, it's a 'one-shot' call and if it fails ... it fails .... there is no queue as such.  I'll take a look to see what might be done (to implement it properly) - it's not that hard but once you start down that path there's an extra level of detail ...

Unfortunately I'm very busy at work so no promises as to when.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 18, 2015, 02:53:40 pm
@ CudaNet

You might want to try this version (2 files updated).  I've tested it to the extent that I don't seem to have broken anything :-)  i.e.  it works with my test scenes (that create events).  I have not tested it with simulated internet failure - but it should (when the internet is returned) post any pending "adds" that were requested up to the time the network failed.   It will also attempt (not guaranteed - since I've not tested) to accept additional "adds" while the internet is down.

Let me know how it goes.

One thing - I've noticed a tendency for vera to "double post" events sometimes - scene triggers twice.....  It's not clear to me exactly why, other than it seems to happen when I've been testing and maybe added / deleted calendar events by hand .....

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: CudaNet on September 18, 2015, 04:33:02 pm
Sweet,

I'll load this up tonight when I get home. I was just thinking about this too, this weekend I was going to dual WAN my network just so I wouldn't lose my internet connection.

Can't say I've ever noticed double posts (assuming I'm following you this late in the day) either upstream or down (triggers).. I'll give this a round of tests whereby I down my link, invoke some issues (fridge power loss, doorbell etc..) and let it queue before re-establishing the link... Can't bring my internet down too long though so can't speak to real world events that may leave some without a network for hours...

Much appreciated !

@ CudaNet

You might want to try this version (2 files updated).  I've tested it to the extent that I don't seem to have broken anything :-)  i.e.  it works with my test scenes (that create events).  I have not tested it with simulated internet failure - but it should (when the internet is returned) post any pending "adds" that were requested up to the time the network failed.   It will also attempt (not guaranteed - since I've not tested) to accept additional "adds" while the internet is down.

Let me know how it goes.

One thing - I've noticed a tendency for vera to "double post" events sometimes - scene triggers twice.....  It's not clear to me exactly why, other than it seems to happen when I've been testing and maybe added / deleted calendar events by hand .....
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: CudaNet on September 21, 2015, 11:19:18 am
Alright, spoke too soon. Looks like I got a double event this morning when I locked my front door...

Will have to try and debug that later assuming I can recreate while I'm home. Also I'm having issues bringing my internet down (primary link) and not having Vera3 freak on me. Once the link went down, it appeared that Vera3 went into a blink fest (UI7; .619) and wouldn't respond to anything or any type of event (doorbell etc.). I couldn't connect to it.. It was very strange and I didn't have a lot of time to troubleshoot. Also spent most of my weekend working with a managed switch which I later determined had a bug in it's firmware. I worked for over a day before finding that out .... Ugh !
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 21, 2015, 12:04:25 pm
It seems to me that I've only seen double events at about the time I made a change (e.g. uploaded new version of plugin) when there was a calendar event at or near that same time.  What I've seen in the logs is that vera runs a scene twice.  I suspect (but have never tracked down) that it's Vera having more than one "trigger" pending (like one from just before the upload and one just after) and so it fires twice.

It seems (again have not truly dug in) that it does not happen when I put a test event out (say 1 hr) from the upload of a new plugin test patch.

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: CudaNet on September 22, 2015, 09:41:40 am
Stuart,

Did gc_interval get changed by chance ? Just curious as I was using 180 as my value and I'm observing the next check 3 hours (not 3 minutes as I thought it was previously doing).

Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 22, 2015, 11:56:11 am
Stuart,

Did gc_interval get changed by chance ? Just curious as I was using 180 as my value and I'm observing the next check 3 hours (not 3 minutes as I thought it was previously doing).

I cannot remember if gc_Interval has ever been anything except minutes.   The plugin sets a default of 180 (minutes) and internally changes that to seconds.  Note that gc_Interval sets the maximum time between checks (meaning updates of its internal copy) of the calendar.  The plugin checks at the start time and end time of every event (just in case something has changed) and looks forward for at least 24 hrs (depending on the value of gc_ExtraDays default 0).

So in principle there's usually no need to change gc_Interval unless you are frequently adding new calendar events (that you want the plugin to react to) sooner than 3 hrs from the end of the last event.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: CudaNet on September 22, 2015, 12:01:12 pm
I must be losing it then - rather I must have always mis-interpreted that param... Thanks for the clarity, I'll adjust and keep testing..

Stuart,

Did gc_interval get changed by chance ? Just curious as I was using 180 as my value and I'm observing the next check 3 hours (not 3 minutes as I thought it was previously doing).

I cannot remember if gc_Interval has ever been anything except minutes.   The plugin sets a default of 180 (minutes) and internally changes that to seconds.  Note that gc_Interval sets the maximum time between checks (meaning updates of its internal copy) of the calendar.  The plugin checks at the start time and end time of every event (just in case something has changed) and looks forward for at least 24 hrs (depending on the value of gc_ExtraDays default 0).

So in principle there's usually no need to change gc_Interval unless you are frequently adding new calendar events (that you want the plugin to react to) sooner than 3 hrs from the end of the last event.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on September 22, 2015, 12:32:30 pm
I must be losing it then - rather I must have always mis-interpreted that param... Thanks for the clarity, I'll adjust and keep testing..



If ever I think I'm 'loosing it' - I just re-read the forums that have dialog with Vera Management   8)
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: fabstar81 on October 08, 2015, 03:03:01 am
Maybe this has been attended before but I can't find any topics on my probably basic mistake in the configuration of the plug-in.

I installed the v3 plugin months ago and it has been this way since installation. The plugin sees all my appointments in my calendar but never gets the appropriate names for it. Whatever appointment the plug-in trips on, it always says "NO NAME". Very annoying as you can imagine.

It's probably a setting in the calendar itself I recon, but cannot find some option that might solve it.

Someone here maybe has a good idea?
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on October 08, 2015, 11:14:35 am
Maybe this has been attended before but I can't find any topics on my probably basic mistake in the configuration of the plug-in.

I installed the v3 plugin months ago and it has been this way since installation. The plugin sees all my appointments in my calendar but never gets the appropriate names for it. Whatever appointment the plug-in trips on, it always says "NO NAME". Very annoying as you can imagine.

It's probably a setting in the calendar itself I recon, but cannot find some option that might solve it.

Someone here maybe has a good idea?

I don't keep all this in my head so I searched for "NO NAME"  and found the post with an answer ..........
"If your calendar is set to be public and only show free/busy time then the events will show up but with 'NO NAME' "

The instructions in the attachment to the very first post (setting up the service account) include the correct calendar settings.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: fabstar81 on October 09, 2015, 02:06:19 am
searched again in the forum and still didn't find the post. anyways...just rechecked the settings in the calender and i see what's wrong here. unfortunately, all options are greyed out, except the one that says "only status information occupied/unoccupied". I wonder if that has something to do with my account being a apps.google.com account?

i have deleted and re-added the service account to no  prevail.

luckily i am the apps.-admin. changed the overall setting to higher information. now it's working. thanks!
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: veramoyo on October 13, 2015, 05:39:39 am
Hi guys, still very new to vera so I am hoping you can help me with this. I have  installed the google calendar plugin and set it up successfully with everything working well on one GCal3 sensor device checking my calendar and PLEG running some actions fine. I have now created a second GCal3 sensor device which will check my wife's calendar so I can have PLEG do other stuff for her. My question is where do I put the credentials for this second one and how do I point this pointer to it. I have tried to search and can't seem to find any instructions on how to do this. Can someone please help with where I can find this or point me in the right direction.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on October 15, 2015, 04:44:57 pm
Hi guys, still very new to vera so I am hoping you can help me with this. I have  installed the google calendar plugin and set it up successfully with everything working well on one GCal3 sensor device checking my calendar and PLEG running some actions fine. I have now created a second GCal3 sensor device which will check my wife's calendar so I can have PLEG do other stuff for her. My question is where do I put the credentials for this second one and how do I point this pointer to it. I have tried to search and can't seem to find any instructions on how to do this. Can someone please help with where I can find this or point me in the right direction.

Your search was successful - there is no capability for a second set of credentials :-(

You could create a second calendar under your credentials ( I do this for testing) and point a second plugin at that -- not the best I know ....

Part of this is historic and ties into the way some of the original authentication code was implemented.  I did a major restructure of that code a while back but have not revisited the idea of different credentials tied to different plugin instances.  I'll take a look - I suspect it might be trivial to implement - and let you know.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on October 16, 2015, 06:38:49 pm
Hi guys, still very new to vera so I am hoping you can help me with this. I have  installed the google calendar plugin and set it up successfully with everything working well on one GCal3 sensor device checking my calendar and PLEG running some actions fine. I have now created a second GCal3 sensor device which will check my wife's calendar so I can have PLEG do other stuff for her. My question is where do I put the credentials for this second one and how do I point this pointer to it. I have tried to search and can't seem to find any instructions on how to do this. Can someone please help with where I can find this or point me in the right direction.

Your search was successful - there is no capability for a second set of credentials :-(

You could create a second calendar under your credentials ( I do this for testing) and point a second plugin at that -- not the best I know ....

Part of this is historic and ties into the way some of the original authentication code was implemented.  I did a major restructure of that code a while back but have not revisited the idea of different credentials tied to different plugin instances.  I'll take a look - I suspect it might be trivial to implement - and let you know.

@ veramoyo --

The changes were pretty simple. I did some testing but would like you to do some too (if you are willing).


I'm assuming you have already setup a calendar - got a credentials file and set calendar permission for your wife's calendar (in the same way as you would have for your own).  Se note below about using a different name than GCal3.json for this second calendar and it's credentials.

Attached are two files to upload to vera.  Once that's done -  you should not see any difference.

Create a new plugin.  There is a new new variable called gc_credentialFile . The default is GCal3.json.   Change this value to a different file with an extension of ".json" (e.g. "somename.json"). Then reboot.  You should now have a message of "Fatal error: credentials" on the plugin you changed.  The other plugins should work fine.

Next upload the credentials file ( "somename.json") to vera and reboot again.  The plugin you changed should now have a message "The CalendarID is not set".   Go to the control tab - enter the ID, click "set"  and all should be well .....
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: veramoyo on October 16, 2015, 08:55:21 pm
Brilliant stuff!! Uploaded the two files and did all the changes and presto!! Works like magic. Awesome work. Now I have two plugins checking two different calendars. The calendar events(On the calendar) however are  displayed for the account I am currently logged in on the browser, but the plugin can still retrieve them for PLEG/scenes. I guess that's to be expected and for me it is not important to view both at the same time, as long as I can retrieve them. Thanks hips
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: MSW on October 18, 2015, 03:26:46 am
Thanks, Stuart. Just did that again, but still not working. Here are the two sides of the string:
http://o7.no/1EWHFeJ
http://o7.no/1OAPlU8

2nd tab still works fine:
http://o7.no/1OAPuHk

What do you recommend?

Did you ever get this sorted?  I have the same issue with UI7.  (new install).  The only way I can get the second tab to show correctly is pasting the URL link directly in the advanced tab, but I still get the "Access or Calendar error" in the main tab and no events.
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: Stuart on October 18, 2015, 01:08:34 pm
Thanks, Stuart. Just did that again, but still not working. Here are the two sides of the string:
http://o7.no/1EWHFeJ
http://o7.no/1OAPlU8

2nd tab still works fine:
http://o7.no/1OAPuHk

What do you recommend?

Did you ever get this sorted?  I have the same issue with UI7.  (new install).  The only way I can get the second tab to show correctly is pasting the URL link directly in the advanced tab, but I still get the "Access or Calendar error" in the main tab and no events.

When we last exchanged on this, I asked for a log file so that I could see exactly what was going on - you did not send a log file so I assumed you were "ok".

Before we take this further - just to make sure we are not chasing ghosts ----   the calendar tab can only display the calendar for the 'currently logged on to google user of the browser'.  If you can see a calendar in the tab of one plugin but not another then there is something different in the permissions on the calendar side.

The calendar tab is a hangover from the very first version of gcal from another author.  Since then I've completely restructured, enhanced and added many debug and notification messages.  As well, security changes on the google side have made the simple functionality in the tap more complex.  In any case, it does not show enough detail to be truly interesting and it does not provide an indication that 'all is well'.

Frankly - I'm seriously considering removing the tab as it's confusing to people as to why it may or may not seem to work.  How do you use it ?  Would it matter if it were removed ?

What opinion do others have ?
Title: Re: GCAL3 - V 1.3 Released - Now with Overlapping Event Notification
Post by: MSW on October 18, 2015, 02:23:15 pm
We've never spoken about this before - I'm a different user than the person you were corresponding with above. In any event, I think I found the bug. Google calendar provides a link of calendar.google.com and your code is expecting www.google.com. When I manually changed the html to be www instead of calendar it worked.

As far as not including the widget in the device, I think there needs to be some way to test/check the calendar events in the device - if we need to spell the event name exactly as it is in the calendar, there isn't currently any way to check to see if it is correct or not.  With the calendar widget there, at least we can check with our eyes.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on October 31, 2015, 12:42:57 pm
Hi - I was re-reading this post and trying to understand what the bug might be, to see if I need to change the code or the instructions.  Please don't take this the wrong way but think the instructions are correct (but they may not be clear).  Could you take a look at the PDF and the notes in the very first post and let me know if I need to change anything?
Title: Re: GCAL3 - V 1.4 Released
Post by: clippermiami on October 31, 2015, 12:46:08 pm
Stuart

Is there a current Installation and User Guide? The one I found online is ver 0.9
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 01, 2015, 01:17:17 am
Other than cosmetics associated with UI 7 the 0.9 documentation is still valid.  The notes on later releases that are in the first post will bring you up to date.
Title: Re: GCAL3 - V 1.4 Released
Post by: veramoyo on November 01, 2015, 01:35:17 am
I have personally set mine up using the current instruction manual and everything works beautifully. I have something for the wish list though. I think a variable field for the truly "next event" would be nice. The current one is not strictly next as it could mean the currently tripped event. Otherwise I think it's a wonderful plugin.
Title: Re: GCAL3 - V 1.4 Released
Post by: clippermiami on November 01, 2015, 07:18:42 am
Other than cosmetics associated with UI 7 the 0.9 documentation is still valid.  The notes on later releases that are in the first post will bring you up to date.

Thanks. I'm reading through it now.

I got the Travel Calendar portion to two work, it now triggers on two keywords "Travel" and "Cruise" and seems to work. My intent is to have Vera change the Vera Alerts notification setup for traveling to avoid a lot of routine messages at international SMS rates.

The Automation calendar is intended to a) alert Vera to special events/items that need alternative handling and b) have GCAL post items to the calendar for history.

Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 01, 2015, 07:36:39 pm
I have personally set mine up using the current instruction manual and everything works beautifully. I have something for the wish list though. I think a variable field for the truly "next event" would be nice. The current one is not strictly next as it could mean the currently tripped event. Otherwise I think it's a wonderful plugin.

How would you like to use this "next event" ?   If you set gc_keyword to blank then gc_NextEvent will be the next event and gc_NextEventTime will tell you when.
Title: Re: GCAL3 - V 1.4 Released
Post by: garycooper on November 02, 2015, 06:43:39 am
Can someone know if multiple event in the same time are manage by GCAL3 ?

Here is my settings (view attach) and only the event TEST is visible, but i have 2 events in the same time.

I separate them with a ";".

Why i don't see VMC AND TEST on the plugin ?
I also try to get the value with this command but i retrieve only TEST
Quote
local gc_Value = luup.variable_get("urn:srs-com:serviceId:GCalIII", "gc_TrippedEvent", gcalId)

Thanks for your help

Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 02, 2015, 12:23:49 pm
The 'next' event is VMC (because it starts first).   VMC will cause a trigger of the plugin.  When VMC end, TEST will trigger (but only at the time when VMC ends).  When that happens - you will see TEST on the plugin panel.  This behavior is necessary as the plugin is essentially a switch (i.e. it's either on off).

Depending what you want to do - you may want to look at gc_notify.  See the release notes for V1.3.
Title: Re: GCAL3 - V 1.4 Released
Post by: garycooper on November 03, 2015, 09:35:17 am
yep looks gc_notify seems to be the solution.
But i don't understand how it works

How could i be notified when (these events are overlapping)
: VMC start
: VMC stop
: TEST start
: TEST stop

Could you validate these param :



Quote
gc_notify -->1
gc_notifyName --> VMC;TEST
gc_notifyValue --> ????
gc_notifyType --> Start;End


Thanks,
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 03, 2015, 02:23:10 pm
Take a look at the Release 1.3 notes in the first post of this section.  Should tell you what you need to know.

One approach is to create a scene that triggers on the "Event Start or End" trigger and then use some Lua code to do what you want depending on the event (gc_notifyName) and whether its a start or end of the event (gc_notifyType).
Title: Re: GCAL3 - V 1.4 Released
Post by: garycooper on November 03, 2015, 02:30:18 pm
Take a look at the Release 1.3 notes in the first post of this section.  Should tell you what you need to know.

One approach is to create a scene that triggers on the "Event Start or End" trigger and then use some Lua code to do what you want depending on the event (gc_notifyName) and whether its a start or end of the event (gc_notifyType).

ok, get it

it works now, thanks for your support
Title: Re: GCAL3 - V 1.4 Released
Post by: garycooper on November 04, 2015, 09:34:17 am
i set a trigger on "Event Start or End", it works fine but all the event are repeated 2 times.

Every time i get a start i could see the trigger is called 2 times, same things for End... (i log the execution of the scene).

Is it a bug or could i set a param to avoid this ?

Thanks
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 04, 2015, 11:58:28 am
I have seen this once or twice in testing but could not find the reason.   It is possible there is a bug (always) - so I will have another look.

One possibility though is that I use a technique in vera where certain actions within the plugin are scheduled by vera - it is possible, during testing that actions get scheduled more than once.  Lots of 'possibles' here .....

So try this -- clear out any near future events in the calendar except one that is an hour further than any other event you have been testing with.  Then REBOOT vera.   Let the plugin run and see what happens.   I''ll be doing the same thing .....
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 04, 2015, 01:07:37 pm
OK - I just did some tests ---   you are lucky !   I get 3 and 4 notifications !!!

What version of the plugin are you using, what model vera and what UI release level ?

In Rel 1.4 I'm thinking (pretty sure)  I introduced a bug that accounts for some of the excess notifications I am seeing and can probably fix that soon.
Title: Re: GCAL3 - V 1.4 Released
Post by: garycooper on November 04, 2015, 09:15:36 pm
OK - I just did some tests ---   you are lucky !   I get 3 and 4 notifications !!!

What version of the plugin are you using, what model vera and what UI release level ?

In Rel 1.4 I'm thinking (pretty sure)  I introduced a bug that accounts for some of the excess notifications I am seeing and can probably fix that soon.

I'm on UI5 veraLite. I installed it from Mios Marketplace 4 days ago so this is the last version.

Thanks !!
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 04:36:31 pm
Hi,  I have set this up tonight on UI7 and pretty sure I followed everything on the instructions.  It all went smoothly and I entered the calendar ID and set it and then went to the calendar tab and can see the calendar, and still can.  However it now says Start up ...Waiting for another process claiming: GCalMain   when I press check and the variables show no data, whereas I have a upcoming event today. 

Any ideas?  I have google apps account on my own domain if that makes any difference?

Thanks
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 05:12:39 pm
This is in the debug file.  I have tried the trick of deleting the folder and reuploading from the interface and restarting, but I only get the sem file created, even when I then reenter the calendar ID.  I saw that its basically the private key from another thread and so created my own but that doesnt work either. 

Code: [Select]
06 11/05/15 22:08:31.796 Device_Variable::m_szValue_set device: 318 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Start up ... now: Checking ... #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x71272520>
06 11/05/15 22:08:31.797 Device_Variable::m_szValue_set device: 318 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: Waiting for another process claiming: GCalMain now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x71272520>
06 11/05/15 22:08:31.798 Device_Variable::m_szValue_set device: 318 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Armed was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0xa3be90/NONE duplicate:1 <0x71272520>
06 11/05/15 22:08:32.101 Device_Variable::m_szValue_set device: 318 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Checking ... now: Start up ... #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x72f8a520>
06 11/05/15 22:08:32.102 Device_Variable::m_szValue_set device: 318 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now: . #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x72f8a520>
06 11/05/15 22:08:32.102 Device_Variable::m_szValue_set device: 318 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: . now: Waiting for another process claiming: GCalMain #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x72f8a520>
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 05, 2015, 05:20:32 pm
Try a reboot - that should clear the problem.  I have some code that's supposed to stop some internal plugin functions from stepping on each other -- seems it's doing too good a job  8)

Let me know how the reboot goes.

I'll take a closer look at the code tonight as I wasn't completely happy with it because this sort of lock was a possibility but difficult to reproduce in testing  ....
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 05:24:58 pm
I have restarted luup and rebooted several times.  I had just created a new security json file from google and set it all up again but sounds like thats not the problem. 

Does it sound like it could work if the reboot happens to run things so the functions dont get in each others way? 

And anything to do after the reboot or just press check?
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 05, 2015, 05:35:02 pm
After a reboot - you do not have to press check as it will check the calendar for events at the end of the startup.

Without pressing "check" and after a reboot - what does it say on the plugin panel ?  We may be chasing a couple of things here -  ....   so lets take this a step at a time.
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 05:50:27 pm
On the dashboard it says Fatal Error: credentials.  I still only have the sem file.  No pem file. 
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 05, 2015, 06:01:53 pm
ok - we are getting somewhere  :)

upload the json credentials file and reboot.   BTW what have you named the credentials file ?  The default is GCal3.json
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 06:12:07 pm
No idea what was different that time but yes I uploaded the json file again and let it restart.  I was also playing in google calendar at the same time and deleted the sharing and recreated it.  And now it works. 

I still dont have a pem file created though...
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 05, 2015, 06:19:22 pm
Where are you looking to see if there is a pem file ?   What tool ?  It will not work unless there is a pem file (I promise).
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 06:30:18 pm
I am using winscp and looking in etc/cmh-ludl/GCal3.   I have refreshed and reconnected a few times and still dont see it.  Unless its hidden?
Title: Re: GCAL3 - V 1.4 Released
Post by: simonclark on November 05, 2015, 06:31:11 pm
and as if winscp read that post... on that refresh I now see all 3 files.  So yes, they are there for it to be working, but no idea why they werent on any of the other previous attempts. 

After 3 hours of trying I finally have it setup so that my morning Sonos TTS scene can tell me the day's events, except I will be wishing it will say I have a lie in after this late night!  But glad its now working.  Thanks for your help .
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 05, 2015, 06:44:03 pm
I just looked at the documentation (which was written for UI5)... UI7 behaves slightly differently and so a reboot after uploading the json credentials file is the safest way to go.  I'm hoping to find time to update the documents for UI7 but .....

Glad it is working now. 
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 06, 2015, 05:16:55 pm
OK - I just did some tests ---   you are lucky !   I get 3 and 4 notifications !!!

What version of the plugin are you using, what model vera and what UI release level ?

In Rel 1.4 I'm thinking (pretty sure)  I introduced a bug that accounts for some of the excess notifications I am seeing and can probably fix that soon.

I'm on UI5 veraLite. I installed it from Mios Marketplace 4 days ago so this is the last version.

Thanks !!

Ok - I was wrong, I had not introduced a bug ... it was there all along ....   a nuance of the logic I was using to try and accommodation restarts (of vera), rechecks of the calendar, luup timer calls into the future and the like .....  it can get a little tricky .....

I've created a notification request tracking approach that should solve the issue.  I've run it through a few test cycles and so far so good.   I'd appreciate it if you would give it a try ...   just upload the attached file to your vera and let me know how it goes.

Title: Re: GCAL3 - V 1.4 Released
Post by: garycooper on November 08, 2015, 05:23:10 am
OK - I just did some tests ---   you are lucky !   I get 3 and 4 notifications !!!

What version of the plugin are you using, what model vera and what UI release level ?

In Rel 1.4 I'm thinking (pretty sure)  I introduced a bug that accounts for some of the excess notifications I am seeing and can probably fix that soon.

I'm on UI5 veraLite. I installed it from Mios Marketplace 4 days ago so this is the last version.

Thanks !!

Ok - I was wrong, I had not introduced a bug ... it was there all along ....   a nuance of the logic I was using to try and accommodation restarts (of vera), rechecks of the calendar, luup timer calls into the future and the like .....  it can get a little tricky .....

I've created a notification request tracking approach that should solve the issue.  I've run it through a few test cycles and so far so good.   I'd appreciate it if you would give it a try ...   just upload the attached file to your vera and let me know how it goes.

i just tested it looks to be good.

Thank you very much
Title: Re: GCAL3 - V 1.4 Released
Post by: CudaNet on November 13, 2015, 04:33:09 pm
Stuart,

I've been heavily in test with openLuup and today I was working with the GCal3 plugin. I've been using 1.3 without any issues whatsoever on both Vera3 and now openLuup. I noticed this attachment so I moved it over to see if any issues were present. Seems I couldn't write an event to my calendar, I wasn't sure if anyone was testing that but when I moved back to the 1.3 - it worked perfectly. Only difference was this file.

Hope this helps..

v1.5a
Code: [Select]
2015-11-13 20:54:37.965   luup.call_action:0: 5.urn:srs-com:serviceId:GCalIII.AddEvent
2015-11-13 20:54:37.965   luup.call_timer:5: unknown global function name: createNewCalendarEvent
2015-11-13 20:54:37.966   luup_log:0: ALTUI: Evaluation of lua code returned: [{removed by Cuda}]
2015-11-13 20:54:37.968   openLuup.server:: request completed (182 bytes, 1 chunks, 8 ms) tcp{client}: 0x147fd78
2015-11-13 20:54:47.484   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: No more events today now: Start up ... #hooks:0
2015-11-13 20:54:47.485   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: . #hooks:0
2015-11-13 20:54:47.487   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: Start up ... now: The CalendarID is set #hooks:0
2015-11-13 20:54:47.488   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: . #hooks:0
2015-11-13 20:54:47.494   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: Set up variables #hooks:0
2015-11-13 20:54:47.495   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: The CalendarID is set now:  #hooks:0
2015-11-13 20:54:47.497   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: Set up variables now: . #hooks:0
2015-11-13 20:54:47.498   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_exactKeyword was: false now: false #hooks:0
2015-11-13 20:54:47.500   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_ignoreKeyword was: true now: true #hooks:0
2015-11-13 20:54:47.501   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_triggerNoKeyword was: true now: true #hooks:0
2015-11-13 20:54:47.503   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_ignoreAllDayEvent was: true now: true #hooks:0
2015-11-13 20:54:47.504   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_retrip was: false now: false #hooks:0
2015-11-13 20:54:47.505   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_CalendarID was: {removed by Cuda}.calendar.google.com now:  #hooks:0
2015-11-13 20:54:47.509   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_CalendarID was:  now: {removed by Cuda}%40group.calendar.google.com #hooks:0
2015-11-13 20:54:47.510   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_jsonEvents was: [{removed by Cuda}] #hooks:0
2015-11-13 20:54:47.511   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_jsonActiveEvents was: [] now: [] #hooks:0
2015-11-13 20:54:47.513   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_ActiveEvents was:  now:  #hooks:0
2015-11-13 20:54:47.514   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: Variable setup complete #hooks:0
2015-11-13 20:54:47.515   luup_log:5: GCal3 V 1.5a:local function: getStartMinMax
2015-11-13 20:54:47.517   luup_log:5: GCal3 V 1.5a:StartMin is 2015-11-13T00:00:00Z StartMax is 2015-11-14T20:55:00Z
2015-11-13 20:54:47.518   luup_log:5: GCal3 V 1.5a:End of day is 2015-11-13T23:59:59
2015-11-13 20:54:47.519   luup_log:5: GCal3 V 1.5a:local function: requestCalendar
2015-11-13 20:54:47.519   luup_log:5: GCal3 V 1.5a:local function: get_access_token
2015-11-13 20:54:47.651   luup_log:5: GCal3 V 1.5a:Token will expire in 2339 sec
2015-11-13 20:54:47.652   luup_log:5: GCal3 V 1.5a:Checking google calendar
2015-11-13 20:54:47.652   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was:  now: Accessing Calendar #hooks:0
2015-11-13 20:54:47.654   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: Variable setup complete now: . #hooks:0
2015-11-13 20:54:47.655   luup_log:5: GCal3 V 1.5a:Requested url: https://www.googleapis.com/calendar/v3/calendars/{removed by Cuda}.calendar.google.com/events?access_token={removed by Cuda}&timeZone=utc&singleEvents=true&orderBy=startTime&timeMax=2015-11-14T20:55:00Z&timeMin=2015-11-13T00:00:00Z&fields=items(description%2Cend%2Cstart%2Csummary)
2015-11-13 20:54:47.856   luup_log:5: GCal3 V 1.5a:Calendar request status: HTTP/1.1 200 OK
2015-11-13 20:54:47.857   luup_log:5: GCal3 V 1.5a:Calendar request code: 200
2015-11-13 20:54:47.873   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: Accessing Calendar now: Calendar Access Success #hooks:0
2015-11-13 20:54:47.874   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: . #hooks:0
2015-11-13 20:54:47.875   luup_log:5: GCal3 V 1.5a:local function: getEvents
2015-11-13 20:54:47.876   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: Calendar Access Success now: Checking Events #hooks:0
2015-11-13 20:54:47.877   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: . #hooks:0
2015-11-13 20:54:47.879   luup_log:5: GCal3 V 1.5a:There were 4 events retrieved
2015-11-13 20:54:47.879   luup_log:5: GCal3 V 1.5a:local function: allDay
2015-11-13 20:54:47.882   luup_log:5: GCal3 V 1.5a:Effective Event Name {removed by Cuda}[0,1]{}
2015-11-13 20:54:47.883   luup_log:5: GCal3 V 1.5a:local function: allDay
2015-11-13 20:54:47.885   luup_log:5: GCal3 V 1.5a:Effective Event Name {removed by Cuda}[0,1]{}
2015-11-13 20:54:47.886   luup_log:5: GCal3 V 1.5a:local function: allDay
2015-11-13 20:54:47.888   luup_log:5: GCal3 V 1.5a:Effective Event Name {removed by Cuda}{}
2015-11-13 20:54:47.889   luup_log:5: GCal3 V 1.5a:local function: allDay
2015-11-13 20:54:47.891   luup_log:5: GCal3 V 1.5a:Effective Event Name {removed by Cuda}[0,1]{}
2015-11-13 20:54:47.892   luup_log:5: GCal3 V 1.5a:Events Today = 4
2015-11-13 20:54:47.893   luup_log:5: GCal3 V 1.5a:Events Left Today = 0

v1.3
Code: [Select]
2015-11-13 20:59:31.644   luup.call_action:0: 5.urn:srs-com:serviceId:GCalIII.AddEvent
2015-11-13 20:59:31.644   luup_log:5: GCal3 V 1.3:**********************************************
2015-11-13 20:59:31.645   luup_log:5: GCal3 V 1.3:Add Calendar Event Request
2015-11-13 20:59:31.646   luup.call_timer:5: interval: time=5, days={}
2015-11-13 20:59:31.646   luup_log:5: GCal3 V 1.3:ACCEPTED
2015-11-13 20:59:31.647   luup_log:0: ALTUI: Evaluation of lua code returned: [{removed by Cuda}]
2015-11-13 20:59:31.649   openLuup.server:: request completed (182 bytes, 1 chunks, 11 ms) tcp{client}: 0x20a2660
2015-11-13 20:59:36.159   luup_log:5: GCal3 V 1.3:Checking semaphore
2015-11-13 20:59:36.168   luup_log:5: GCal3 V 1.3:Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0
2015-11-13 20:59:36.170   luup_log:5: GCal3 V 1.3:Semaphore file returned 0
2015-11-13 20:59:36.171   luup_log:5: GCal3 V 1.3:Device 5 requested semaphore
2015-11-13 20:59:36.180   luup_log:5: GCal3 V 1.3:Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0
2015-11-13 20:59:36.181   luup_log:5: GCal3 V 1.3:Device 5 claimed semaphore
2015-11-13 20:59:36.192   luup_log:5: GCal3 V 1.3:local function: get_access_token
2015-11-13 20:59:36.329   luup_log:5: GCal3 V 1.3:Token will expire in 3548 sec
2015-11-13 20:59:36.330   luup_log:5: GCal3 V 1.3:Adding Event to Google Calendar
2015-11-13 20:59:36.331   luup_log:5: GCal3 V 1.3:url = https://www.googleapis.com/calendar/v3/calendars/{removed by Cuda}.calendar.google.com/events?access_token={removed by Cuda}
2015-11-13 20:59:36.332   luup_log:5: GCal3 V 1.3:Add Event payload: {"end": {"dateTime":"2015-11-13T20:59:00Z"},"start": {"dateTime":"2015-11-13T20:59:00Z"},"summary":"openLuup test #2.","description":"This is a test of the Google Calendar from openLuup."}
2015-11-13 20:59:36.669   luup_log:5: GCal3 V 1.3:Add Event Code: 200
2015-11-13 20:59:36.670   luup_log:5: GCal3 V 1.3:Add Event Status: HTTP/1.1 200 OK
2015-11-13 20:59:36.671   luup_log:5: GCal3 V 1.3:Added event to Calendar
2015-11-13 20:59:36.671   luup_log:5: GCal3 V 1.3:Newer Event - Check Calendar Sooner
2015-11-13 20:59:36.673   luup_log:5: GCal3 V 1.3:Device 5 released the semaphore - reason: Add event(s) to calendar
2015-11-13 20:59:36.674   luup_log:5: GCal3 V 1.3:Added event newer by 10740 sec
2015-11-13 20:59:36.675   luup.call_timer:5: interval: time=1, days={}
2015-11-13 20:59:36.677   openLuup.server:: /data_request?id=lr_ALTUI_Handler&command=oscommand&oscommand=tail%20-n%20500%20%2Fetc%2Fcmh-ludl%2FLuaUPnP.log&_=1447448341295 tcp{client}: 0x20a2660
2015-11-13 20:59:36.679   luup_log:3: ALTUI: ALTUI_Handler: request is: lr_ALTUI_Handler
2015-11-13 20:59:36.680   luup_log:3: ALTUI: ALTUI_Handler: parameters is: {"command":"oscommand","oscommand":"tail -n 500 /etc/cmh-ludl/LuaUPnP.log","_":"1447448341295"}
2015-11-13 20:59:36.680   luup_log:3: ALTUI: ALTUI_Handler: outputformat is: null
2015-11-13 20:59:36.700   openLuup.server:: request completed (40846 bytes, 3 chunks, 23 ms) tcp{client}: 0x20a2660
2015-11-13 20:59:37.203   luup_log:5: GCal3 V 1.3:Calendar updates reinstated
2015-11-13 20:59:37.203   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: No more events today now: The CalendarID is set #hooks:0
2015-11-13 20:59:37.205   luup.variable_set:5: 5.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: . now: . #hooks:0
2015-11-13 20:59:37.211   luup_log:5: GCal3 V 1.3:local function:  checkGCal
2015-11-13 20:59:37.212   luup_log:5: GCal3 V 1.3:Checking semaphore
2015-11-13 20:59:37.221   luup_log:5: GCal3 V 1.3:Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0
2015-11-13 20:59:37.222   luup_log:5: GCal3 V 1.3:Semaphore file returned 0
2015-11-13 20:59:37.224   luup_log:5: GCal3 V 1.3:Device 5 requested semaphore
2015-11-13 20:59:37.233   luup_log:5: GCal3 V 1.3:Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 0
2015-11-13 20:59:37.234   luup_log:5: GCal3 V 1.3:Device 5 claimed semaphore
2015-11-13 20:59:37.236   luup_log:5: GCal3 V 1.3:StartMin is 2015-11-13T00:00:00Z StartMax is 2015-11-14T21:00:00Z
2015-11-13 20:59:37.237   luup_log:5: GCal3 V 1.3:End of day is 2015-11-13T23:59:59
2015-11-13 20:59:37.238   luup_log:5: GCal3 V 1.3:local function: requestCalendar
2015-11-13 20:59:37.238   luup_log:5: GCal3 V 1.3:local function: get_access_token
2015-11-13 20:59:37.363   luup_log:5: GCal3 V 1.3:Token will expire in 3547 sec
2015-11-13 20:59:37.364   luup_log:5: GCal3 V 1.3:Checking google calendar

OK - I just did some tests ---   you are lucky !   I get 3 and 4 notifications !!!

What version of the plugin are you using, what model vera and what UI release level ?

In Rel 1.4 I'm thinking (pretty sure)  I introduced a bug that accounts for some of the excess notifications I am seeing and can probably fix that soon.

I'm on UI5 veraLite. I installed it from Mios Marketplace 4 days ago so this is the last version.

Thanks !!

Ok - I was wrong, I had not introduced a bug ... it was there all along ....   a nuance of the logic I was using to try and accommodation restarts (of vera), rechecks of the calendar, luup timer calls into the future and the like .....  it can get a little tricky .....

I've created a notification request tracking approach that should solve the issue.  I've run it through a few test cycles and so far so good.   I'd appreciate it if you would give it a try ...   just upload the attached file to your vera and let me know how it goes.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 13, 2015, 05:06:41 pm
I'm traveling over the next two weeks so will not be able to take a look till early Dec.  My main method of testing relies heavily on scenes that create calendar events and I have not seen any issues.
There were some changes in release 1.4 to files other than GCal3.lua.  The 1.5a (alpha) test patch would be relying on 1.4 as a base.  So that is likely the issue.

Try first upgrading to 1.4 then you can try the 1.5a patch.  I will be releasing V 1.5 in early Dec which has the notification fix as well as some minor internal changes that improve a little on efficiency.
Title: Re: GCAL3 - V 1.4 Released
Post by: CudaNet on November 13, 2015, 05:12:27 pm
Ah, ok - that makes sense. I saw the one file and figured that was all I needed. I need to force my Vera3 to update (even though it's check marked) that way I have the latest production version files. Thanks for the reply and have a safe one...


I'm traveling over the next two weeks so will not be able to take a look till early Dec.  My main method of testing relies heavily on scenes that create calendar events and I have not seen any issues.
There were some changes in release 1.4 to files other than GCal3.lua.  The 1.5a (alpha) test patch would be relying on 1.4 as a base.  So that is likely the issue.

Try first upgrading to 1.4 then you can try the 1.5a patch.  I will be releasing V 1.5 in early Dec which has the notification fix as well as some minor internal changes that improve a little on efficiency.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on November 13, 2015, 05:31:07 pm
Let me know if that fixes the issue - although I write perfect code the interpreter is sometimes imperfect and does not understand what I intended 😎. Also, for some reason I was not aware of openLuup.  When I get back I will look into setting up a test bed and doing some ongoing compatibility testing.  I'm thinking maybe a higher end router that runs *nix ??? ...
Title: Re: GCAL3 - V 1.4 Released
Post by: CudaNet on November 13, 2015, 06:23:23 pm
I definitely will and I'm sure it'll work perfectly....

Quote from: Stuart
Let me know if that fixes the issue - although I write perfect code the interpreter is sometimes imperfect and does not understand what I intended 😎.

Akbooer has done an awesome job with this as well as amg0 with the UI. I can run on my own hardware, have local and remote devices (Vera is required for z-wave) and run all the Lua I want without causing a meltdown. I've done testing with a few OS's and I'm extremely happy with OpenWRT. I've loaded it on a Jetway server (x86; QuadCore 1.83 w/60GB SSD and 8GB memory) and it screams. I've also loaded the same thing on a Raspberry Pi2 with great results.

This is openLuup running on the Pi2 using a 32GB SDHC card. I have two instances of Google Calendar 3 running and 1 scene with a fully functioning OpenWRT system (LuCi interface).

Code: [Select]
             total         used         free       shared      buffers
Mem:        953500        36372       917128          884          760
-/+ buffers:              35612       917888
Swap:            0            0            0

Quote
Also, for some reason I was not aware of openLuup.  When I get back I will look into setting up a test bed and doing some ongoing compatibility testing.  I'm thinking maybe a higher end router that runs *nix ??? ...
Title: Re: GCAL3 - V 1.4 Released
Post by: MSW on December 05, 2015, 01:38:39 pm
Hi - I was re-reading this post and trying to understand what the bug might be, to see if I need to change the code or the instructions.  Please don't take this the wrong way but think the instructions are correct (but they may not be clear).  Could you take a look at the PDF and the notes in the very first post and let me know if I need to change anything?

Sorry I didn't respond then - everything was working well (great plugin) so I had no need to recheck the forum here. Up to you if you want to change the instructions or not.  What I was pointing out is that from Google, the link sometimes given for the calendar starts with calendar.google.com instead of www.google.com and when pasting the given link, your plug in doesn't work.  I need to manually change the URL from calendar to www and then everything works fine. 

As an aside, the reason I did stumble back into this forum is because I noticed about a week ago something had completely wiped out my google calendar (deleted events) and the plugin stopped working so I had to replace everything.  I don't think it was the plugin (I had given it edit permissions) but jut in case, I gave it read only permissions now.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 05, 2015, 10:03:32 pm
When the url failed - did you copy everything from and including  <iframe .....   to <iframe> and use the control tab with the set button to input the calendar info ?  If so - can you IM me the whole lot - I was not aware of an alternate form but can account for it in the future.

With just read permission you will be fine unless you want to use the add event function (which obviously needs to be able to write).  There is no code at all that deletes events.


So the wiping of the calendar is a mystery ......
Title: Re: GCAL3 - V 1.4 Released
Post by: kariem112 on December 06, 2015, 08:33:16 am
Is there any way to trigger a scene when a event ends? So for example: I have an event that takes 2 days. When this even starts, scene X has to start. When the events end, scene Y has to start.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 06, 2015, 03:53:48 pm
This is the beta version for 5.1.

I fixed a few bugs and changed the calendar parsing code to be more reliable.  There was a long-standing bug on the calendar set (did not parse several calendar url formats).

Note that this needs to be applied onto V1.4.

Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 06, 2015, 04:04:00 pm
Is there any way to trigger a scene when a event ends? So for example: I have an event that takes 2 days. When this even starts, scene X has to start. When the events end, scene Y has to start.

The short answer is yes.  Set a scene to start when an event starts and another scene for when it finished. You will likely want to use the Notification capability.  You will also need the 1.5b version posted above.

See the discussion on this page:

http://forum.micasaverde.com/index.php/topic,26692.msg254871.html#msg254871
Title: Re: GCAL3 - V 1.4 Released
Post by: kariem112 on December 08, 2015, 02:58:22 am
Is there any way to trigger a scene when a event ends? So for example: I have an event that takes 2 days. When this even starts, scene X has to start. When the events end, scene Y has to start.

The short answer is yes.  Set a scene to start when an event starts and another scene for when it finished. You will likely want to use the Notification capability.  You will also need the 1.5b version posted above.

See the discussion on this page:

http://forum.micasaverde.com/index.php/topic,26692.msg254871.html#msg254871

Do I just have to upload the lua file to my vera lite?

I can see the Event start or End in the scene creation. But where do I state wether I want the "start" or the "end" part? Can you give a Lua example to add to the scene?


-----------------------
Code: [Select]
local startcheck = luup.variable_get("urn:schemas-srs-com:device:GCal:3","gc_notifyType",63)
   if (startcheck == "Start") then
     return true
   else
   return false
  end
-------------------------
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 09, 2015, 11:23:50 pm
Yes - just upload the file - but you need to be on V1.4 or later before uploading.

Also you need to use this urn "urn:srs-com:serviceId:GCalIII"
Title: Re: GCAL3 - V 1.4 Released
Post by: lparedesl on December 22, 2015, 10:26:32 am
Hello,

I  installed the plugin GCal3 v1.4, went into settings, changed the value for gc_credentialFile to "name.json". I didn't know where to get this new file so I just created a new file in notepad and saved it "name.json", uploaded to Vera in Luup Files but it doesn't appear in the list. I noticed that the file "Gcal3.json" isn't in the list either. How can I get this working?

Thank you in advance
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 22, 2015, 02:34:35 pm
Hello,

I  installed the plugin GCal3 v1.4, went into settings, changed the value for gc_credentialFile to "name.json". I didn't know where to get this new file so I just created a new file in notepad and saved it "name.json", uploaded to Vera in Luup Files but it doesn't appear in the list. I noticed that the file "Gcal3.json" isn't in the list either. How can I get this working?

Thank you in advance

You will need to go through the process described in the attachments to the first post of this topic.  The screen shots are dated but the process is the same.  This is all to do with google's security requirements.  It's a bit tedious first time - but follow closely and you should be fine.  It is during this process (with google) that you end up with a credentials file.

During startup - the plugin looks for the credentials file which is GCAL3.json by default (or the filename in gc_credentialFile).  If it finds that file it moves the file to a different directory and begins to process it (which is likely why you don't see it in the list).  That way the plugin knows if you create a new / different credential file.   I suggest you stick with the default unless you have a specific reason not to.

Once you have gone through the initial setup -- all should work.  If not then it's time to debug using the log file.  ANy problems are usually down to a setup issue i.e. not following the aforementioned tedious instructions  :D
Title: Re: GCAL3 - V 1.4 Released
Post by: lparedesl on December 22, 2015, 08:20:00 pm
Thank you for your answer. I followed the steps and uploaded the generated (and renamed) GCal3.json file. Rebooted Vera but I'm getting a message "Fatal error: credentials"
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 23, 2015, 12:23:14 am
Thank you for your answer. I followed the steps and uploaded the generated (and renamed) GCal3.json file. Rebooted Vera but I'm getting a message "Fatal error: credentials"

Ok.  There could be several reasons, like a malformed credentials file or the wrong form of credentials file or ....
To narrow it down, set gc_debug = 3 (that will give us max debug messages), reboot and get a copy of the log file (most folks use WinSCP).

The log file is /var/log/cmh/LuaUPnP.log
Title: Re: GCAL3 - V 1.4 Released
Post by: lparedesl on December 23, 2015, 10:42:24 am
I checked this morning and it is working now. Thank you very much for your help!
Title: Re: GCAL3 - V 1.4 Released
Post by: MSW on December 25, 2015, 08:52:49 am
Has anyone had an issue where the CalenderID gets unset?  I've had this plugin working fine for a few months, yesterday was fine and today I go in and see that the CalenderID is not set and so no events are scheduled.  I had to rest it and now back to normal, but very odd (and disconcerting...)  The only thing I did related to this plugin at all, was I had a scene that was triggered based on a calendar event and in the scene manager in UI7, I went in and disabled the scene and then re-enabled it.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 26, 2015, 12:49:04 pm
I will take a closer look in the next few days to see if it can be made more robust.   Basically, this cannot happen in the normal execution of the code.   There is one possibility that I can see where IF there was a reboot / reset of the Lua engine then it's possible that the gc_CalendarID variable was reinitialized and not repopulated.  But wow - this would only be a few milliseconds ....   still, possible, .....

For this to happen, it would also require the calendar set button to have been activated (either through the UI or through code).  You aren't doing anything to the calendar plugin with your scene are you ?  It is possible you could reset the CalendarID that way.
Title: Re: GCAL3 - V 1.4 Released
Post by: MSW on December 26, 2015, 01:08:10 pm
I will take a closer look in the next few days to see if it can be made more robust.   Basically, this cannot happen in the normal execution of the code.   There is one possibility that I can see where IF there was a reboot / reset of the Lua engine then it's possible that the gc_CalendarID variable was reinitialized and not repopulated.  But wow - this would only be a few milliseconds ....   still, possible, .....

For this to happen, it would also require the calendar set button to have been activated (either through the UI or through code).  You aren't doing anything to the calendar plugin with your scene are you ?  It is possible you could reset the CalendarID that way.

Not doing anything with the calendar through code. The LUa engine did restart when I deactivated and reactivated the scene.
Title: Re: GCAL3 - V 1.4 Released
Post by: Stuart on December 28, 2015, 01:24:03 am
Attached are two update files. I removed (in theory) the only possibility of the plugin 'forgetting' the Calendar ID during a restart / reboot.

I will release this as version 1.5 to the marketplace in a couple of days.

EDIT: Be sure to apply BOTH files.

EDIT:  Patches released as V1.6
Title: Re: GCAL3 - V 1.5 Released
Post by: CudaNet on January 04, 2016, 03:48:36 pm
Stuart,

What files do I need to install to bump from 1.3 to 1.5 and can these be accessed within this thread ? 1.3 has been solid on openLuup (receiving and sending events) and I'd like to update to 1.5 and run it on one of my test systems before promoting.

Thanks
Title: Re: GCAL3 - V 1.5 Released
Post by: Stuart on January 04, 2016, 05:47:16 pm
Uploading both the above files on top of 1.3 will get you to the same build as 1.5.
Title: Re: GCAL3 - V 1.5 Released
Post by: CudaNet on January 04, 2016, 05:57:49 pm
Perfect, thank you....

Uploading both the above files on top of 1.3 will get you to the same build as 1.5.
Title: Re: GCAL3 - V 1.5 Released
Post by: Stuart on January 05, 2016, 10:45:21 am
Thanks to @possum who spotted that the plugin status was resetting after a Lua restart resulting in scene repeating and (in @possums case - changes to the timestamp in PLEG).  This was a 'my bad' as I'd omitted a line of code during some clean-up a couple of releases back.

The attached file (V1.6a) has the patch and will be in a formal release in due course.  Since Vera have not release V1.5 yet -  I have withdrawn 1.5 and included this patch as V1.6 release.  For those that want to get ahead of the game - put this patch on top of the 1.5 patches here:

http://forum.micasaverde.com/index.php/topic,26692.msg261969.html#msg261969

Edit: following description was badly worded ... I needed to go back and review my own code and intent  :'(

A reminder that the default behavior for the plugin is to NOT reset its status (tripped if keyword is set) / active if keyword is blank) following a lua restart / reboot.

The behavior is set by gc_retrip (default true) only applies when there are overlapping events with the same name. I.e. if the plugin was tripped before the reset / reboot (because it is in an event) then after the reset/reboot it will trip again.  If gc_retrip is true then the plugin will trip on each event (assuming it would have tripped in the first place).  If gc_retrip is false then it will not trip on each event i.e. the overlapping / joined events with the same name will look like one big(er)  event.

If Lua resets / reboots during a calendar event and you do NOT want a scene etc to repeat, set gc_retrip to false and the plugin will not 'reset'.   I.e. if the plugin was tripped before the reset / reboot (because it is in an event) then after the reset/reboot it will not be tripped.

EDIT: Attachment Removed
Title: Re: GCAL3 - Updated Credential Creation Document
Post by: Stuart on January 27, 2016, 02:46:54 pm
I just added a test credentials file and test calendar with ID that can be used to prove that the plugin is working properly.  See the Debugging section on the first post.

http://forum.micasaverde.com/index.php?topic=26692.msg189513#msg189513
Title: Re: GCAL3 - Updated Credential Creation Document
Post by: CudaNet on January 27, 2016, 02:59:07 pm
I actually think this is a really great idea, should help alleviate issues.

I just added a test credentials file and test calendar with ID that can be used to prove that the plugin is working properly.  See the Debugging section on the first post.

http://forum.micasaverde.com/index.php?topic=26692.msg189513#msg189513
Title: Re: GCAL3 - Added a test credentials file and test Calendar
Post by: Stuart on January 27, 2016, 03:03:42 pm
I'm not entirely sure WHY I did not think of this earlier.  Adding in the ability of different plugin instances to use different credentials files paved the way as I am able to keep my personal GCal use separate from test use.
Title: Re: GCAL3 - Added a test credentials file and test Calendar
Post by: Stuart on January 28, 2016, 07:37:40 pm
For those that like to keep up to date .....

Attached is the latest patch file.  It should be installed on top of V1.6.

There is no functional change but I:
1.   tidied up some front panel error messages that were overwriting prior error messages - all to do with credentials and calendar UIs - but we won't have those problems anymore because of the test credentials and test calendar (see a couple of posts above)  ::) :o ::)
2.  added a variable (gc_Version) to allow a quick visual check of the version / patch number -  this patch is 1.7a5.  Remember to F5 to update the UI after applying the patch.
3.  added in another google calendar url variant that was discovered by accident ....  (I wish google would published their calendar url formats somewhere  :-[ )
Title: Re: GCAL3 - Added a test credentials file and test Calendar
Post by: Stuart on March 07, 2016, 11:43:27 pm
Folks --

In order to assist with getting log files remotely from vera, I put together a simple plugin.  It takes a copy of the logfile (and optionally applies a grep pattern) and places it in the /etc/cmh-ludl folder.  You can then directly download the logfile. Hopefully it will be useful.

i've added the instructions here:

http://forum.micasaverde.com/index.php/topic,36744.0.html

A Gcal specific version of this functionality will be included in a soon to be released version of GCal
Title: GCAL3 - V2.0
Post by: Stuart on March 24, 2016, 05:52:44 pm
V2.0 will be release in the marketplace shortly.

It's got a lot in it - mostly usability changes which will make life easier, especially with initial setup.  The core functionality is unchanged.  Unfortunately you will need to delete existing plugins and reinstall.  Sorry but it's just the nature of vera , given some of the changes that I made.

You can install it directly from the following link

http://<your vera IP>:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=7016&Version=30931


To upgrade to  V2 you will need to do the following:
1.  Take a note of the settings in your existing
  Advanced --> Variables tab.
2.  DELETE your existing plugins
3.  Install version 2.0 Note: If you get a "Lua Startup Failed" message, rebooting should clear the error.
4.  Set the Calendar ID using the Control Tab -  - wait a bit as vera will restart
5.  If you are using a credential file different to the default name (GCal3.json)
    set it using the Control Tab -  - wait a bit as vera will restart
4.  Set the appropriate variables in the Advanced --> Variables tab
6.  Change any scenes etc to use the new plugin number.
     (See especially the note below on JSON Parser)

UI Changes
Front Panel
Added the Check Button to the front panel
Fixed the non-operating front panel buttons in UI5

Control Tab
Added controls to set set the Calendar ID and Credentials file name.
It provides better control and error handling than prior versions
(which used the Advanced --> Variables tab)
Added a GetLog function.  This will create a log file for the plugin insstance.
When created - you can download the logfile from
Apps --> Develop Apps --> Luup files.  The log file listed near the top with a filename "<device #> - GCal3.log".
Download it and view it with a good text editor.  I use Notepad++.

Calendar Tab
Increased the size of the calendar display.
Changed the behavior:  The tab will display google calendars
in the normal way. If an iCalendar is used the tab will cause
the iCalendar file to download.

Advanced Tab
Control variables Removed from the Advanced Tab
A number of variables used to be displayed on the advanced tab.
They should never be manually changed by a user and they were
taking up unnecessary screen space.
They are now grouped into a single variable gc_Variables.

Functional Changes
iCalendar Improvements
There were problems with certain iCalendars due to some underlying lua modules.
Gcal now uses a better approach (curl is used instead of luasec for those interested).
Three forms of iCalendar url are recognized
See also the notes on using iCalendars.

Error Message Improvements
Some error messages to the GCal pannel were being 'lost'
because they were being over-written by messages higher up in the code.

Startup Improvements
Changed to startup logic.  Semaphore files are no longer used.
On first install a reboot is required (UI7).  After the reboot you
may have to press F5 for the UI to display (first time only).

JSON Parser
Some versions of vera came with a json parse (dkjson.lua module), some did not.
Prior versions of GCal forced the download of a parser (json.lua).
With this release: if the dkjson.lua module is present then json.lua
is not downloaded and if a json.lua exists - it is removed.
If you have scenes that rely on json.lua (and dkjson.lua exists on your vera)
then you will need to change any require("json.lua") to require("dkjson.lua)").
If dkjson is not on your vera then nothing changes.
This was done to save space on the vera unit.

Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 24, 2016, 05:56:50 pm
Going to give this a go with openLuup/AltUI and report back....
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 24, 2016, 06:02:48 pm
Going to give this a go with openLuup/AltUI and report back....

Hopefully it will be a pleasant experience.   The changes are mainly execution sequence, managing the calendar id and credential file setting, some fairly minor function tweaks, some UI re-arrangement and some new (simple) functionality.

What can go wrong ?????

 ::) ::) ::) ::) ::)
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 24, 2016, 06:08:58 pm
I have nothing but great things to say about GCal3 so I'm really looking forward to seeing what you've done here. SO, karma at you for your promptness to questions and attention to detail.

Going to give this a go with openLuup/AltUI and report back....

Hopefully it will be a pleasant experience.   The changes are mainly execution sequence, managing the calendar id and credential file setting, some fairly minor function tweaks, some UI re-arrangement and some new (simple) functionality.

What can go wrong ?????

 ::) ::) ::) ::) ::)
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 24, 2016, 09:38:25 pm
EXTREMELY low priority as this was just a litmus test for openLuup.. I loaded my /GCal3 (/etc/cmh-ludl/GCal3) folder which is 'ancient'. My distro is Debian Jessie 8 (Raspbian; Raspberry Pi3)  so it was absolutely expected for opkg anything to fail. openSSL is installed as is dkjson and pretty much everything else needed for plugin support.

Edit: Removed all files in /GCal3 with exception of the .json file (figured I, at a minimum needed that)...

Code: [Select]
2016-03-24 21:04:55.275   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: Restarting ... now: Initial Startup #hooks:0
2016-03-24 21:04:55.275   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: Changing Calendar ID now:  #hooks:0
2016-03-24 21:04:55.281   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0
2016-03-24 21:04:55.287   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 512
2016-03-24 21:04:55.294   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 512
2016-03-24 21:04:55.300   luup_log:4: GCal3 device: 4 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 512
2016-03-24 21:04:55.306   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 512
2016-03-24 21:04:55.311   luup_log:4: GCal3 device: 4 - Existing openssl version is: false
2016-03-24 21:04:55.312   luup_log:4: GCal3 device: 4 - Installing openssl
2016-03-24 21:04:55.315   luup_log:4: GCal3 device: 4 - Command /bin/opkg update && opkg install openssl-util returned 32512
2016-03-24 21:04:55.315   luup_log:4: GCal3 device: 4 - Fatal error could not install openssl
2016-03-24 21:04:55.315   luup_log:4: GCal3 device: 4 - Checking for DKJSON module at: /usr/lib/lua/dkjson.lua
2016-03-24 21:04:55.321   luup_log:4: GCal3 device: 4 - Command /bin/ls /usr/lib/lua/dkjson.lua returned 512
2016-03-24 21:04:55.322   luup_log:4: GCal3 device: 4 - Checking for JSON module at: /usr/lib/lua/json.lua
2016-03-24 21:04:55.328   luup_log:4: GCal3 device: 4 - Command /bin/ls /usr/lib/lua/json.lua returned 512
2016-03-24 21:04:55.328   luup_log:4: GCal3 device: 4 - Downloading /usr/lib/lua/json.lua
2016-03-24 21:04:55.328   luup_log:4: GCal3 device: 4 - Attempting to download http://code.mios.com/trac/mios_google_calendar_ii_plugin/raw-attachment/wiki/WikiStart/json.lua
2016-03-24 21:04:55.328   luup_log:4: GCal3 device: 4 - local function: os_command
2016-03-24 21:04:55.328   luup_log:4: GCal3 device: 4 - Command was: curl -ksL "http://code.mios.com/trac/mios_google_calendar_ii_plugin/raw-attachment/wiki/WikiStart/json.lua"
2016-03-24 21:04:56.527   luup_log:4: GCal3 device: 4 - local function: os_command
2016-03-24 21:04:56.527   luup_log:4: GCal3 device: 4 - Command was: curl -ksL -w "%{http_code} %{url_effective}\n" "http://code.mios.com/trac/mios_google_calendar_ii_plugin/raw-attachment/wiki/WikiStart/json.lua" -o /dev/null
2016-03-24 21:04:56.924   luup_log:4: GCal3 device: 4 - Writing file /usr/lib/lua/json.lua
2016-03-24 21:04:56.925   luup_log:4: GCal3 device: 4 - local function: writetoFile
2016-03-24 21:04:56.926   openLuup.context_switch::  ERROR: [string "[4] I_GCal3.xml"]:291: /usr/lib/lua/json.lua: No such file or directory
2016-03-24 21:04:56.926   openLuup.scheduler:: job aborted : [string "[4] I_GCal3.xml"]:291: /usr/lib/lua/json.lua: No such file or directory
2016-03-24 21:04:56.926   luup_log:3: ALTUI: startupDeferred, called on behalf of device:3

Code: [Select]
pi@raspberrypi:/etc/cmh-ludl/GCal3 $ ls -l
-rw-r--r-- 1 pi pi 1238 Nov 17  2014 GCal3.json
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 24, 2016, 10:39:43 pm
@Cudenet

I'll need more of a clue as to what the issue is.  I've never tested on other than a stock vera unit -- so the directories and commands are all tailored around that.

If what is needed is some logical "or" statements to look in different directories then I can do that (and am happy to) if you can provide the locations (although this could be a never ending list depending on distro etc)

Similarly - the command used for looking for open ssl is "opkg list-installed | awk '/openssl-util/ {print $3}'"

Does that not work on your distro ?

I suppose I could search with something like "find -name etc etc" but that can take quite a while - especially on low power cpu's
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 24, 2016, 11:35:47 pm
Stuart,

Yes, unless I were running OpenWRT, opkg will fail. In my case, I'm running Debian which is apt/dpkg. It appears that the failed attempts package check & install eventually lead to the process stopping all together (which is to be expected). There are probably 10x more reasons not to change anything simply because your intent was to run on a Vera, not openLuup. Today I'm still running the original 1.x version you developed and it's running flawlessly so I'll continue to use that.

One of these days I'm going to talk you into giving openLuup a try. I even have turn-key images ready to load for the Raspberry Pi 2, 3 and Odroid XU4's. Unfortunately I'm not the best at coding (ok I'm dangerous at best) so Akbooer would be the best resource for anything openLuup related. Anyways, thanks again for everything and have great weekend !

@Cudenet

I'll need more of a clue as to what the issue is.  I've never tested on other than a stock vera unit -- so the directories and commands are all tailored around that.

If what is needed is some logical "or" statements to look in different directories then I can do that (and am happy to) if you can provide the locations (although this could be a never ending list depending on distro etc)

Similarly - the command used for looking for open ssl is "opkg list-installed | awk '/openssl-util/ {print $3}'"

Does that not work on your distro ?

I suppose I could search with something like "find -name etc etc" but that can take quite a while - especially on low power cpu's
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 24, 2016, 11:48:18 pm
Let me take a look. I run Debian on my home server - so I'll see if a little additional logic can help out here ...  I'm thinking check to see if distribution is not OpenWRT then resort to time consuming searches ....  :-[
One of the things I did in 2.0 was indeed to STOP the startup if "things" were not as expected since this made basic setup easier and errors more obvious.....
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 25, 2016, 12:02:26 am
Yes, you could definitely check within the /etc/*release... I use this often and it's pretty safe across most all distros.

Code: [Select]
cat /etc/*release

DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='15.05'
DISTRIB_REVISION='r46767'
DISTRIB_CODENAME='chaos_calmer'
DISTRIB_TARGET='x86/64'
DISTRIB_DESCRIPTION='OpenWrt Chaos Calmer 15.05'
DISTRIB_TAINTS=''

Let me take a look. I run Debian on my home server - so I'll see if a little additional logic can help out here ...  I'm thinking check to see if distribution is not OpenWRT then resort to time consuming searches ....  :-[
One of the things I did in 2.0 was indeed to STOP the startup if "things" were not as expected since this made basic setup easier and errors more obvious.....
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 25, 2016, 10:22:29 am
Whoa, I was wiped out last night... I re-read this and figured I'd see if there was a method that could be used strictly within Lua.

Code: [Select]
function loadrequire(module)
    local function requiref(module)
        require(module)
    end
    res = pcall(requiref,module)
    if      not(res) then
            print("((Module))::Cannot locate the following module [" .. module .. "], halting.)")
    else    print("((Module))::Located [" .. module .. "] module, proceeding.)")
    end
end

loadrequire('dkjson')
loadrequire('ssl')

So checking to see what you're running on can steer how it checks or use this regardless. Basically if it's not OpenWrt then just write a log entry (keeping it simple) describing which modules aren't loaded on the system and halt.
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 25, 2016, 10:37:53 am
@ CudaNet

Try this.  All I have done is:  if the distro is not OpenWrt -- bypass the check for dkjson.lua / json.lua / openssl.
 Since we know these programs  are already on your system - this should allow your test to proceed.
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 25, 2016, 10:46:23 am
Whoa, I was wiped out last night... I re-read this and figured I'd see if there was a method that could be used strictly within Lua.

Code: [Select]
function loadrequire(module)
    local function requiref(module)
        require(module)
    end
    res = pcall(requiref,module)
    if      not(res) then
            print("((Module))::Cannot locate the following module [" .. module .. "], halting.)")
    else    print("((Module))::Located [" .. module .. "] module, proceeding.)")
    end
end

loadrequire('dkjson')
loadrequire('ssl')

So checking to see what you're running on can steer how it checks or use this regardless. Basically if it's not OpenWrt then just write a log entry (keeping it simple) describing which modules aren't loaded on the system and halt.

I'll take a closer look in a few days -- I like this approach for testing to see what's there (independent of path).
In the meantime - I took the opposite approach to stopping ... i.e. bypass and keep going.  That way you can see if there are any additional "gotcha's" with openLuup/AltUI
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 26, 2016, 01:23:05 pm
Just got back so I'll load this and let you know...

@ CudaNet

Try this.  All I have done is:  if the distro is not OpenWrt -- bypass the check for dkjson.lua / json.lua / openssl.
 Since we know these programs  are already on your system - this should allow your test to proceed.
Title: Re: GCAL3 - Version 2.0
Post by: CudaNet on March 26, 2016, 01:33:39 pm
Sweet... I'll run some additional tests and report back if I discover any issues.

Code: [Select]
2016-03-26 12:28:49.982   luup_log:4: GCal3 device: 4 - local function: GCalStartup
2016-03-26 12:28:49.982   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: Restarting ... now: Initial Startup #hooks:0
2016-03-26 12:28:49.982   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: Changing Calendar ID now:  #hooks:0
2016-03-26 12:28:49.989   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0
2016-03-26 12:28:49.995   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 512
2016-03-26 12:28:50.002   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 512
2016-03-26 12:28:50.009   luup_log:4: GCal3 device: 4 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 512
2016-03-26 12:28:50.015   luup_log:4: GCal3 device: 4 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 512
2016-03-26 12:28:50.022   luup_log:4: GCal3 device: 4 - Command cat /etc/*release | grep OpenWrt returned 256
2016-03-26 12:28:50.022   luup_log:4: GCal3 device: 4 - OpenWrt test returned: 256
2016-03-26 12:28:50.022   luup_log:4: GCal3 device: 4 - Not a standard Vera Distro
2016-03-26 12:28:50.022   luup_log:4: GCal3 device: 4 - local function: makejson
2016-03-26 12:28:50.024   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_Variables was: [{"NextCheck":"2016-03-26T12:28:04","TrippedID":"","CredentialFile":"GCal3.json","Version":" V2.0.1:","addCalendar":"true","LastCheck":"2016-03-26T12:28:04","gCal":"true","UI7Check":"true","CalendarID":"{removed}"}] now: [{"NextCheck":"2016-03-26T12:28:04","TrippedID":"","CredentialFile":"GCal3.json","Version":" V2.0.1:","addCalendar":"true","LastCheck":"2016-03-26T12:28:04","gCal":"true","UI7Check":"true","CalendarID":"{removed}"}] #hooks:0
2016-03-26 12:28:50.024   luup_log:4: GCal3 device: 4 - local function: setupVariables
2016-03-26 12:28:50.026   luup_log:4: GCal3 device: 4 - local function: makejson
2016-03-26 12:28:50.026   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_Variables was: [{"NextCheck":"2016-03-26T12:28:04","TrippedID":"","CredentialFile":"GCal3.json","Version":" V2.0.1:","addCalendar":"true","LastCheck":"2016-03-26T12:28:04","gCal":"true","UI7Check":"true","CalendarID":"{removed}"}] now: [{"NextCheck":"2016-03-26T12:28:04","TrippedID":"","CredentialFile":"GCal3.json","Version":" V2.0.1:","addCalendar":"true","LastCheck":"2016-03-26T12:28:04","gCal":"true","UI7Check":"true","CalendarID":"{removed}"}] #hooks:0
2016-03-26 12:28:50.026   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEvent was: Initial Startup now:  #hooks:0
2016-03-26 12:28:50.026   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was:  now:  #hooks:0
2016-03-26 12:28:50.027   luup_log:4: GCal3 device: 4 - local function: makeBoolean
2016-03-26 12:28:50.027   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_exactKeyword was: true now: true #hooks:0
2016-03-26 12:28:50.027   luup_log:4: GCal3 device: 4 - local function: makeBoolean
2016-03-26 12:28:50.027   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_ignoreKeyword was: false now: false #hooks:0
2016-03-26 12:28:50.027   luup_log:4: GCal3 device: 4 - local function: makeBoolean
2016-03-26 12:28:50.027   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_triggerNoKeyword was: false now: false #hooks:0
2016-03-26 12:28:50.027   luup_log:4: GCal3 device: 4 - local function: makeBoolean
2016-03-26 12:28:50.027   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_ignoreAllDayEvent was: false now: false #hooks:0
2016-03-26 12:28:50.027   luup_log:4: GCal3 device: 4 - local function: makeBoolean
2016-03-26 12:28:50.027   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_retrip was: true now: true #hooks:0
2016-03-26 12:28:50.027   luup_log:4: GCal3 device: 4 - local function: makejson
2016-03-26 12:28:50.028   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_jsonEvents was: [] now: [] #hooks:0
2016-03-26 12:28:50.028   luup_log:4: GCal3 device: 4 - local function: makejson
2016-03-26 12:28:50.028   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_jsonActiveEvents was: [] now: [] #hooks:0
2016-03-26 12:28:50.028   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_ActiveEvents was:  now:  #hooks:0
2016-03-26 12:28:50.028   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_displaystatus was: 0 now: 0 #hooks:0
2016-03-26 12:28:50.028   luup_log:4: GCal3 device: 4 - Checking CalendarID: {removed}
2016-03-26 12:28:50.028   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEvent was:  now: CalendarID is set #hooks:0
2016-03-26 12:28:50.028   luup_log:4: GCal3 device: 4 - Checking for Credential file: GCal3.json
2016-03-26 12:28:50.053   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was:  now: Credentials Set #hooks:0
2016-03-26 12:28:50.053   luup_log:4: GCal3 device: 4 - Checking for access-token
2016-03-26 12:28:50.290   luup.variable_set:4: 4.urn:srs-com:serviceId:GCalIII.gc_NextEventTime was: Credentials Set now: Got new token #hooks:0
2016-03-26 12:28:50.290   luup_log:4: GCal3 device: 4 - Running Plugin ...
Title: Re: GCAL3 - Version 2.0
Post by: chocorem on March 28, 2016, 01:40:24 pm
Hello,

I've performed all the steps for the calendard ID, installed the V2. Vera is saying "Startup Lua Failed' in the GCAL3 .....

when I'm trying to set the Calendar ID "https://calendar.google.com/calendar/embed?src=ddg3tl7u19n13256d35hm06grc%40group.calendar.google.com%26ctz=Europe/Paris"

It says Device not Ready

What am I doing Wrong ?

Thanks

Greg
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 29, 2016, 12:38:56 pm
Hello,

I've performed all the steps for the calendard ID, installed the V2. Vera is saying "Startup Lua Failed' in the GCAL3 .....

when I'm trying to set the Calendar ID "https://calendar.google.com/calendar/embed?src=ddg3tl7u19n13256d35hm06grc%40group.calendar.google.com%26ctz=Europe/Paris"

It says Device not Ready

What am I doing Wrong ?

Thanks

Greg

Probably not doing anything wrong - likely it needs a reboot - there are some configuration changes on initial install for UI7 different vera's may behave a little differently.
  If that does not fix it - lets take a look at the log file.
Title: Updated User Instruction
Post by: Stuart on March 29, 2016, 05:44:46 pm
Updated the user instructions with new screen shots and modified for Rel 2.0
Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on March 29, 2016, 08:26:24 pm
Hello, forgive my English,
To me it all works very well, and with "VeraAlerts" I managed to talk my tablet in the morning reading "gc_ActiveEvents", the sensor sees me, and before I go to work, warns me of the events of the day.  ;D
Well, I created a new Device "Appointments Tomorrow" and modified "gc_ExtraDays" with "1" but read only the events of today.
Where Am I wrong? thank you
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 31, 2016, 12:18:49 am
Hello, forgive my English,
To me it all works very well, and with "VeraAlerts" I managed to talk my tablet in the morning reading "gc_ActiveEvents", the sensor sees me, and before I go to work, warns me of the events of the day.  ;D
Well, I created a new Device "Appointments Tomorrow" and modified "gc_ExtraDays" with "1" but read only the events of today.
Where Am I wrong? thank you

gc_ActiveEvents only lists events where the current time is inside the event or events.  So an event that starts in the future cannot be "active" or "triggered".

The variable gc_jsonEvents lists all events from the start of today until 24hrs in the future + "ExtraDays".  So this is the variable that you need to look at.  Your code will need to filter out unwanted event from this variable.

There is an example for parsing gc_jsonEvents (a json string) in the documentation.
Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on March 31, 2016, 11:16:27 am
Quote
gc_ActiveEvents only lists events where the current time is inside the event or events.  So an event that starts in the future cannot be "active" or "triggered".
The variable gc_jsonEvents lists all events from the start of today until 24hrs in the future + "ExtraDays".  So this is the variable that you need to look at.  Your code will need to filter out unwanted event from this variable.
There is an example for parsing gc_jsonEvents (a json string) in the documentation.

Stuart hi, thanks for the reply,
I tried to understand the document and studied other Topicper be answered but I'm not as versed. :-[
My interest is to be notified of events that will occur, not those present!
If possible, I would most basic examples or explanations.
Thank you for your work.
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on March 31, 2016, 01:22:23 pm
@ Nettuno

As GCal3 became more capable it also became more complex - so don't feel bad ...

Here's some code (incomplete) that will get you on the right track

Edit:  corrected a line of code that should have read
local GCAL SID = "urn:srs-com:serviceId:GCalIII"

Code: [Select]
  Edit:   See fully working code example in later post
Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on April 01, 2016, 02:43:45 pm
@ Nettuno

As GCal3 became more capable it also became more complex - so don't feel bad ...

Here's some code (incomplete) that will get you on the right track

Hi Stuart, I have a VeraPlus, I tried to study your code but I'm really Lua fasting; I do not know where to look for the result when you launch "Test Luup code" ???  (gc_ActiveEvents is still the same today). They are only end user. :-[
I hope you'll soon have a version that can refer to future events
Thank you for the time you have dedicated to me
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 01, 2016, 07:03:58 pm
Can you explain what you would like to happen.  Do you want to get an alert (at the start of each day) for each event tomorrow ?.

As an example - if you have 3 events tomorrow.  What do you want to happen today ?  Three notifications from Vera Alerts (one for each event) ?
Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on April 01, 2016, 09:01:39 pm
Currently in "gc_ActiveEvents" there is a list of today's events.
In a scene with SendAlert of VeraAlerts I added:
Today the events are {device ([63] .service [urn: srs-com: ServiceID: GCalIII] .gc_ActiveEvents)}
In doing so he tells me all of today's events! well ... but I do not need this.

I Wish That night, before going to bed, tell me the events of the next day!
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 05, 2016, 12:22:48 am
Currently in "gc_ActiveEvents" there is a list of today's events.
In a scene with SendAlert of VeraAlerts I added:
Today the events are {device ([63] .service [urn: srs-com: ServiceID: GCalIII] .gc_ActiveEvents)}
In doing so he tells me all of today's events! well ... but I do not need this.

I Wish That night, before going to bed, tell me the events of the next day!

Here is some complete code that you can add to a scheduled scene and it will do what you want.  You will need to change the values for the GCal plugin device #, the VeraAlerts device # and the profile for sending out alerts.
This is part of the point of Vera.  With a little Lua code you can make it sing and dance.  8)

Code: [Select]
function futureEvents()
  local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
  local GCal_number = 42 -- change this to be the GCal plugin to read from
  local VeraAlerts_number = 47 -- change this to be theVera Alert plugin number
  local Profile = "VeraAlerts"
 
  -- find out when tomorrow starts
  local nextday = os.time() + (3600*24)
  local ta = os.date("*t", nextday)
  local tomorrow = string.format("%d-%02d-%02d", ta.year, ta.month, ta.day)
 
  -- get the contents of gc_jsonEvents
  local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",GCal_number)
  if (jsonEvents == "[]") then -- equivalent of a nul
    return
  end

  -- read the events in gc_jsonEvents into an array
  local json = require("dkjson") -- depending on your vera version you may need to use require("json")
  local eventList =json.decode(jsonEvents)
  package.loaded.json = nil

  local numberEvents = #eventList
  local startevent, startDate, eventname, startTime, endTime
  local Msg = ""
 
  -- now process the array one entry at a time
  for i = 1,numberEvents do
    startevent = eventList[i].eventStart -- the start time for this event
    startDate = os.date("%Y-%m-%d", startevent)
   if startDate == tomorrow then
    startTime = os.date("%H:%M:%S", startevent)
    endTime = os.date("%H:%M:%S", eventList[i].eventEnd)
    eventname = eventList[i].eventName
    Msg  = Msg .. "\n" .. "Event " .. eventname .. " will start at " .. startTime .. " and end at " .. endTime
    end
  end
  luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert",
                  {Message = Msg, Recipients = Profile}, VeraAlerts_number)
  return
end

futureEvents()

Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on April 06, 2016, 10:38:34 am
Quote
Here is some complete code that you can add to a scheduled scene and it will do what you want.  You will need to change the values for the GCal plugin device #, the VeraAlerts device # and the profile for sending out alerts.
This is part of the point of Vera.  With a little Lua code you can make it sing and dance.  8)


Hello Stuart, in my calendar now everything works perfectly. excellent Plugin.  ;D

Now I have another little problem   :P
Even my wife Elena has a Google calendar, so I added a new Device # 77 but created the "Gcal3E.json" file from her account.
I followed the same procedure but after "Upload" file and set "Calendar ID" "Credential File" returns the following error when I press button Check:
Missing Calendar ID
Busy Process: 1 checkGCal
No Credential File
Fatal Error Calendar

What do you suggest?
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 06, 2016, 12:51:32 pm
I believe a restart will fix this.  I've seen it a couple of times in testing and one of the in-memory variables may not be reset properly.
I will take a look at the code as soon as I can for a permanent fix.

Can you let us know if a restart solves the problem.
Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on April 06, 2016, 03:09:09 pm
I believe a restart will fix this.  I've seen it a couple of times in testing and one of the in-memory variables may not be reset properly.
I will take a look at the code as soon as I can for a permanent fix.

Can you let us know if a restart solves the problem.
I made many restarts and repeated the steps, but it presents the same problem "No Credential File", I enter credentials but remains with written "then Reboot ...".
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 06, 2016, 05:09:59 pm
Goto the Advanced Tab --> Variables and look at gc_Variables.  you should see something that looks like this:

[ { "NextCheck": "2016-04-06 at 15:01:16", "TrippedID": "", "CredentialFile": "GCal3Test.json", "Version": " V2.0:", "addCalendar": "true", "LastCheck": "2016-04-06 at 14:58:16", "gCal": "true", "UI7Check": "true", "CalendarID": "https://calendar.google.com/calendar/embed?src=<some numbers>%40group.calendar.google.com" } ]

Make sure that "CredentialFile": "GCal3Test.json" is the correct name for the new credentials file.  If if is then upload the credentials file
Apps --> Develop Apps --> Luup Files -->  Browse [select your credentials file].
Note that Lua will restart (UI7) if using UI56 then check the restart box

If this does not fix the problem then you will need to send me a log file.  If you do, first set gc_debug to 3.

Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on April 06, 2016, 06:38:13 pm
I removed and installed a new device, repeat all the steps and restarted.
Everything works now.  ;D
I have my calendar and that of my wife that work ....
Now it remains for me to talk VeraAlerts with 2 devices.

Stuart, you did a great job ... Thanks  :D
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 08, 2016, 04:18:28 pm
@Nettuno

In a PM to me you asked

Quote
Hello Stuart, forgive me, I would like a clarification.
I have 2 Device for 2 Calendars (that work :D) and I have your code to talk VeraAlerts events of tomorrow, so I would like to know whether the code should be repeated 2 times or must be rewritten?

At this stage in your relationship with Vera - you need to start playing with Lua code (and in the process, understanding how Vera works) - simple things are easy and fun ...
To get you on your way -- here is one way of make it do what you are asking.

Code: [Select]
function futureEvents(GCal_number,VeraAlerts_number,Profile,Msg)
  local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
  Msg = Msg or "" -- makes sure it is not a nil
  Msg  = Msg .. "\n" -- puts this on a new line
 
  -- find out when tomorrow starts
  local nextday = os.time() + (3600*24)
  local ta = os.date("*t", nextday)
  local tomorrow = string.format("%d-%02d-%02d", ta.year, ta.month, ta.day)
 
  -- get the contents of gc_jsonEvents
  local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",GCal_number)
  if (jsonEvents == "[]") then -- equivalent of a nul
    return
  end

  -- read the events in gc_jsonEvents into an array
  local json = require("dkjson") -- depending on your vera version you may need to use require("json")
  local eventList =json.decode(jsonEvents)
  package.loaded.json = nil

  local numberEvents = #eventList
  local startevent, startDate, eventname, startTime, endTime
 
  -- now process the array one entry at a time
  for i = 1,numberEvents do
    startevent = eventList[i].eventStart -- the start time for this event
    startDate = os.date("%Y-%m-%d", startevent)
   if startDate == tomorrow then
    startTime = os.date("%H:%M:%S", startevent)
    endTime = os.date("%H:%M:%S", eventList[i].eventEnd)
    eventname = eventList[i].eventName
    Msg  = Msg .. "\n" .. "Event " .. eventname .. " will start at " .. startTime .. " and end at " .. endTime
    end
  end
  luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert",
                  {Message = Msg, Recipients = Profile}, VeraAlerts_number)
  return
end


local VeraAlerts_num = 47 -- change this to be the Vera Alert plugin number

local GCal_num = 42 -- change this to be the GCal plugin number for your Events
local VA_profile = "VeraAlerts" -- this will be the name of the VeraAlerts profile for you
local Message = "alerts for me" -- this will be the first line of the message sent to you
futureEvents(GCal_num,VeraAlerts_num,VA_profile,Message)

GCal_num = 42 -- change this to be the GCal plugin number for your wife's Events
VA_profile = "VeraAlerts" -- change this will be the name of the VeraAlerts profile for your wife
Message = "Per la mia bella moglie" -- you may not want to change this
futureEvents(GCal_num,VeraAlerts_num,VA_profile,Message)

Take a look at the code for the main function and you will see the differences are small.
Title: Re: GCAL3 - Version 2.0
Post by: Nettuno on April 09, 2016, 08:23:14 am
Quote
At this stage in your relationship with Vera - you need to start playing with Lua code (and in the process, understanding how Vera works) - simple things are easy and fun ...
To get you on your way -- here is one way of make it do what you are asking.
good but, due to problem VeraAlerts, code launches 2 messages at a distance of about 25 seconds and it does seem strange or, it seems that there is not another..

He should be saying:
Tomorrow appointments are, xxx, yyy, zzz etc ..

Ie those of calendars together
You think you cure my craze?  ;D ;D ;D
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 09, 2016, 06:41:20 pm
Quote
At this stage in your relationship with Vera - you need to start playing with Lua code (and in the process, understanding how Vera works) - simple things are easy and fun ...
To get you on your way -- here is one way of make it do what you are asking.
good but, due to problem VeraAlerts, code launches 2 messages at a distance of about 25 seconds and it does seem strange or, it seems that there is not another..

He should be saying:
Tomorrow appointments are, xxx, yyy, zzz etc ..

Ie those of calendars together
You think you cure my craze?  ;D ;D ;D

The function futureEvents is being called twice and the call to VeraAlerts is inside that function - That's why you get two Alerts sent.

You will need to modify the code if you want to just call VeraAlerts once with the events for both calendars together in one alert.  If that is what you want -- One way is to modify futureEvents to return the Msg variable (remove the Vera Alerts Call and the two parameters  VeraAlerts_num,VA_profile,).  Then call it twice (once for each calendar).  Concatenate the two messages into one and then call Vera Alerts.

It's up to you how you want to do it -- but as I said before, you will need to learn to use Lua.
 
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on April 11, 2016, 10:29:59 am
@ Nettuno

I decided that the suggestions I made earlier would be a good example for the documentation -- so this may save you some time.

Code: [Select]

function futureEvents(GCal_number)
  local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
  local outInfo  = ""
 
  -- find out when tomorrow starts
  local nextday = os.time() + (3600*24)
  local ta = os.date("*t", nextday)
  local tomorrow = string.format("%d-%02d-%02d", ta.year, ta.month, ta.day)
 
  -- get the contents of gc_jsonEvents
  local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",GCal_number)
  if (jsonEvents == "[]") then -- equivalent of a nul
    return
  end

  -- read the events in gc_jsonEvents into an array
  local json = require("dkjson") -- depending on your vera version you may need to use require("json")
  local eventList =json.decode(jsonEvents)
  package.loaded.json = nil

  local numberEvents = #eventList
  local startevent, startDate, eventname, startTime, endTime
 
  -- now process the array one entry at a time
  for i = 1,numberEvents do
    startevent = eventList[i].eventStart -- the start time for this event
    startDate = os.date("%Y-%m-%d", startevent)
   if startDate == tomorrow then -- this is just an example filter
    startTime = os.date("%H:%M:%S", startevent)
    endTime = os.date("%H:%M:%S", eventList[i].eventEnd)
    eventname = eventList[i].eventName
    outInfo  = outInfo .. "\n" .. "Event " .. eventname .. " will start at " .. startTime .. " and end at " .. endTime
    end
  end
  return outInfo
end

local VeraAlerts_number = 47 -- change this to be the Vera Alert plugin number

local GCal_num = 42 -- change this to be the GCal plugin number for your Events
local Msg1 = futureEvents(GCal_num)

local Profile = "VeraAlerts" -- this will be the name of the VeraAlerts profile for you
Msg1 = "Alerts from calendar one \n" .. Msg1
local Msg = Msg1
-- luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message = Msg, Recipients = Profile}, VeraAlerts_number)
               
GCal_num = 42 -- change this to be the GCal plugin number for another plugin
local Msg2 = futureEvents(GCal_num)
Msg2 = "Alerts from calendar two \n" .. Msg2
Msg = Msg1 .. "\n\n" .. Msg2
luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message = Msg, Recipients = Profile}, VeraAlerts_number)

NOTE:  If there are no events then this code will fail -- please see post later on in this thread
Title: Re: GCAL3 - Version 2.0
Post by: MSW on May 03, 2016, 02:40:45 pm
Stuart - can you clarify in scene trigger creation the difference between "Event Matches Keyword" and "Event has a specified name"?  I can't figure out when I would use one or the other. 

I have a scene using Event has a specified name, and I specified one of the two keywords I set (semi-colon delimited) in the configuration.  Next event has the correct value but the scene isn't triggering.

thanks!
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on May 03, 2016, 06:59:19 pm
Stuart - can you clarify in scene trigger creation the difference between "Event Matches Keyword" and "Event has a specified name"?  I can't figure out when I would use one or the other. 

I have a scene using Event has a specified name, and I specified one of the two keywords I set (semi-colon delimited) in the configuration.  Next event has the correct value but the scene isn't triggering.

thanks!

For a full explanation - take a look at the documentation.

Basically you either set gc_Keyword to something -- in which case you use "Event Matches Keyword"; or you leave gc_Keyword blank -- in which case you use "Event has a specified name" and supply that value (Note: must be Upper Case).

Soooo -- if you have an event called tEsT and another event called StuFf (These get converted to TEST and STUFF internally)

If you set gc_Keyword blank and set "Event has a specified name" to TEST -- it will activate on the event called tEsT but not StuFf ..... or

you could set gc_Keyword to test; STUFF and trigger on Event Matches Keyword and it will trigger on both events.

There are many variations - some examples are in the documentation


Title: Re: GCAL3 - Version 2.0
Post by: MSW on May 03, 2016, 11:24:03 pm
I read through the PDF doc twice before I posted. I don't believe what you wrote below is in there (I didn't see anything about scene creation). Thanks for the clarification! 
Stuart - can you clarify in scene trigger creation the difference between "Event Matches Keyword" and "Event has a specified name"?  I can't figure out when I would use one or the other. 

I have a scene using Event has a specified name, and I specified one of the two keywords I set (semi-colon delimited) in the configuration.  Next event has the correct value but the scene isn't triggering.

thanks!

For a full explanation - take a look at the documentation.

Basically you either set gc_Keyword to something -- in which case you use "Event Matches Keyword"; or you leave gc_Keyword blank -- in which case you use "Event has a specified name" and supply that value (Note: must be Upper Case).

Soooo -- if you have an event called tEsT and another event called StuFf (These get converted to TEST and STUFF internally)

If you set gc_Keyword blank and set "Event has a specified name" to TEST -- it will activate on the event called tEsT but not StuFf ..... or

you could set gc_Keyword to test; STUFF and trigger on Event Matches Keyword and it will trigger on both events.

There are many variations - some examples are in the documentation
Title: Re: GCAL3 - Version 2.0
Post by: Stuart on May 04, 2016, 06:30:58 pm
I'm not trying to be argumentative here, I  would appreciate your input on how to better the documentation (my objective is "good enough" as it's not exactly my life's work  ;D ).

Can you take a look at the Usage Notes.  Short of an expansive explanation - what needs to be added to make it simpler for the new user.  Understanding that vera specific things (like setting up scenes and the like) are not in scope as this is just about using the plugin, assuming the user already has some familiarity with Vera.
Title: Re: GCAL3 - Version 2.0
Post by: MSW on May 05, 2016, 02:34:24 am
I'm not trying to be argumentative here, I  would appreciate your input on how to better the documentation (my objective is "good enough" as it's not exactly my life's work  ;D ).

Can you take a look at the Usage Notes.  Short of an expansive explanation - what needs to be added to make it simpler for the new user.  Understanding that vera specific things (like setting up scenes and the like) are not in scope as this is just about using the plugin, assuming the user already has some familiarity with Vera.

Stuart - I wouldn't presume you are being argumentative and we are all very grateful for your continued improvement of this plugin!  What is not in the documentation is exactly what you posted above.  Something along the lines of:  "When you are creating a scene, the scene can be triggered a few different ways.  Basically you either set gc_Keyword to something -- in which case you use "Event Matches Keyword"; or you leave gc_Keyword blank -- in which case you use "Event has a specified name" and supply that value (Note: must be Upper Case)."

The documentation focuses on the parameters to make the events available to the controller, but not on how to consume them within the controller.
Title: Re: GCAL3 - Version 2.1
Post by: Stuart on May 13, 2016, 11:25:39 am
@ MSW - thanks!  I made the updates you suggested and a few other minor edits.  There is a new version of the document in the first post.  There is also a new version of the plugin available through the marketplace.

Enjoy.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on May 13, 2016, 04:13:05 pm
@ Nettuno

I was going through the code I posted earlier and noticed that if there are no events then it will fail :-(
This is because of trying to concatenate a value that is nil.

Here is code that is more correct:

Code: [Select]

function futureEvents(GCal_number)
  local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
  local outInfo  = ""
 
  -- find out when tomorrow starts
  local nextday = os.time() + (3600*24)
  local ta = os.date("*t", nextday)
  local tomorrow = string.format("%d-%02d-%02d", ta.year, ta.month, ta.day)
 
  -- get the contents of gc_jsonEvents
  local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",GCal_number)
  if (jsonEvents == "[]") then -- equivalent of a nul
    return
  end

  -- read the events in gc_jsonEvents into an array
  local json = require("dkjson") -- depending on your vera version you may need to use require("json")
  local eventList =json.decode(jsonEvents)
  package.loaded.json = nil

  local numberEvents = #eventList
  local startevent, startDate, eventname, startTime, endTime
 
  -- now process the array one entry at a time
  for i = 1,numberEvents do
    startevent = eventList[i].eventStart -- the start time for this event
    startDate = os.date("%Y-%m-%d", startevent)
   if startDate == tomorrow then -- this is just an example filter
    startTime = os.date("%H:%M:%S", startevent)
    endTime = os.date("%H:%M:%S", eventList[i].eventEnd)
    eventname = eventList[i].eventName
    outInfo  = outInfo .. "\n" .. "Event " .. eventname .. " will start at " .. startTime .. " and end at " .. endTime
    end
  end
  return outInfo
end

local VeraAlerts_number = 47 -- change this to be the Vera Alert plugin number

local GCal_num = 42 -- change this to be the GCal plugin number for your Events
local Msg1 = futureEvents(GCal_num)
Msg1 = Msg1 or "NONE"
local Profile = "VeraAlerts" -- this will be the name of the VeraAlerts profile for you
Msg1 = "Alerts from calendar one \n" .. Msg1
local Msg = Msg1
-- luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message = Msg, Recipients = Profile}, VeraAlerts_number)
               
GCal_num = 42 -- change this to be the GCal plugin number for another plugin
local Msg2 = futureEvents(GCal_num)
Msg2 = Msg2 or "NONE"
Msg2 = "Alerts from calendar two \n" .. Msg2
Msg = Msg1 .. "\n\n" .. Msg2 .. "\n"
luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message = Msg, Recipients = Profile}, VeraAlerts_number)

The edits to the original are simple:
after this line
Code: [Select]
local Msg1 = futureEvents(GCal_num)
add
Code: [Select]
Msg1 = Msg1 or "NONE"

after this line
Code: [Select]
local Msg2 = futureEvents(GCal_num)
add
Code: [Select]
Msg2 = Msg2 or "NONE"

also change this line for formatting reasons
Code: [Select]
Msg = Msg1 .. "\n\n" .. Msg2
to
Code: [Select]
Msg = Msg1 .. "\n\n" .. Msg2 .. "\n"
Title: Re: GCAL3 - Version 2.2
Post by: MSW on June 04, 2016, 02:30:01 pm
I just had an issue where the plugin failed - it was working fine for at least a month (version 2.0) before this.  Tonight, after working fine for a calendar event yesterday, it missed an event on the calendar and I logged in to Vera to see a "Fatal calendar error" on the device.  The event it missed today had the same name as an event it had caught several times successfully in the past. I clicked "check" and it seemed to reset and looks fine now for the next event, but any idea what caused that and what I can do to not have it happen in the future so I can count on the trigger?  (I have since upgraded to 2.2, but the release notes didn't indicate anything that seemed to be related to this, so I assume whatever caused it is still in the code base).

thanks!
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 05, 2016, 12:23:53 am
You need to look at the log file at the time that the fatal event was reported.  Depending on the debug level set in gc_debug - the error may (or may not) have been caught.  I suspect that there may have been a network issue.

I have never seen this type of error in my testing or reported by any one else other than during initial setup (because of credential / setup issues)
Title: Re: GCAL3 - Version 2.2
Post by: MSW on June 05, 2016, 12:31:34 am
You need to look at the log file at the time that the fatal event was reported.  Depending on the debug level set in gc_debug - the error may (or may not) have been caught.  I suspect that there may have been a network issue.

I have never seen this type of error in my testing or reported by any one else other than during initial setup (because of credential / setup issues)

Stuart - unfortunately, it's too late for that. Say there was an Internet outage. If it already had the next event known brogue the outage, couldn't it be coded to fire the next event as opposed to dying because it couldn't check to see if there was any more current information?  Also, if there is an internet outage, does it continue checking to see if the Internet reconnects or once it fails, it needs someone to manually reset it?
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 05, 2016, 11:45:02 pm
Let me take a look -- there is some retry logic associated with creating events.  What I need to think about is "unintended consequences" -- For example - not seeing that an event has been deleted since it last checked the calendar (because it could not check "this time") and behaving as if the event were still there .....
Title: Re: GCAL3 - Version 2.2
Post by: MSW on June 06, 2016, 12:23:41 am
I understand you were only giving an example, but in this case the calendar hadn't been changed for months. I think your initial thought about an Internet outage might be the direction. The question is does the plugin "die" when that happens or can it use what it already knows and then self recover when the intently is back?
Title: Re: GCAL3 - Version 2.2
Post by: aladur on June 06, 2016, 10:41:18 am
Hi Stuart,
After installation according to the installation steps everything looks fine - except the events aren't triggered.
The VeraPlus shows the correct date+time: Mon 16:28:00
The Plugin-Calendar correctly shows the Google-Calendar-events:
10:00:00
16:30:00
17:00:00
The variables are correclty: gc_eventsToday=3, gc_eventsLeftToday=2
When reaching 16:30:00, nothing happens. The scene with (trigger when event has name ...) isn't triggered.
Also none of the notifications is triggered (EVENT_HAS_A_SPECIFIED_NAME, EVENT_MATSCHES_KEYWORD, EVENT_START_OR_END).
The plugin control at 16:40:00 still reports "Next Event 16:30 Jun 06"
After 17:00 it reports "Next Event 17:00 Jun 06".

What's wrong?
Thanks!

Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 07, 2016, 03:37:33 pm
I understand you were only giving an example, but in this case the calendar hadn't been changed for months. I think your initial thought about an Internet outage might be the direction. The question is does the plugin "die" when that happens or can it use what it already knows and then self recover when the intently is back?

Try this version.  I made a couple of changes.  Previously - if the plugin could not access the calendar it made 3 attempts about one minute apart and if it still could not connect - it stopped.

The new behavior is that it will make  3 attempts and then continue to use the last "good" list of events.  It will recheck the connection periodically (mostly this means at the start and end of events).  When it is in this "offline" mode it will place two asterisks ( **) a the start of the event name.

Note that events are held in memory and so if the vera unit reloads when there is no internet connection - then the plugin will stop.

I've tested this my plugging and unplugging my router to the outside world and it worked fine in that testing.  Any additional testing would be helpful.

Edit: File Removed
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 07, 2016, 03:48:17 pm
Hi Stuart,
After installation according to the installation steps everything looks fine - except the events aren't triggered.
The VeraPlus shows the correct date+time: Mon 16:28:00
The Plugin-Calendar correctly shows the Google-Calendar-events:
10:00:00
16:30:00
17:00:00
The variables are correclty: gc_eventsToday=3, gc_eventsLeftToday=2
When reaching 16:30:00, nothing happens. The scene with (trigger when event has name ...) isn't triggered.
Also none of the notifications is triggered (EVENT_HAS_A_SPECIFIED_NAME, EVENT_MATSCHES_KEYWORD, EVENT_START_OR_END).
The plugin control at 16:40:00 still reports "Next Event 16:30 Jun 06"
After 17:00 it reports "Next Event 17:00 Jun 06".

What's wrong?
Thanks!

It is hard to interpret what you are saying - there is not enough information.  It sounds like you may not be setting up triggers on your scenes correctly. Please provide a log file and I can help you.
Title: Re: GCAL3 - Version 2.2
Post by: aladur on June 08, 2016, 04:42:11 am
is gc_debug=1 sufficient?

Edit: file removed
Title: Re: GCAL3 - Version 2.2
Post by: MSW on June 08, 2016, 04:49:44 am
I understand you were only giving an example, but in this case the calendar hadn't been changed for months. I think your initial thought about an Internet outage might be the direction. The question is does the plugin "die" when that happens or can it use what it already knows and then self recover when the intently is back?

Try this version.  I made a couple of changes.  Previously - if the plugin could not access the calendar it made 3 attempts about one minute apart and if it still could not connect - it stopped.

The new behavior is that it will make  3 attempts and then continue to use the last "good" list of events.  It will recheck the connection periodically (mostly this means at the start and end of events).  When it is in this "offline" mode it will place two asterisks ( **) a the start of the event name.

Note that events are held in memory and so if the vera unit reloads when there is no internet connection - then the plugin will stop.

I've tested this my plugging and unplugging my router to the outside world and it worked fine in that testing.  Any additional testing would be helpful.

Stuart - thanks for being responsive!  I think this solution solves most of the issue and would be fine.
Just to be really clear as to the problem case: If a GCAL user is away for a week and early in the week there was an internet outage for a few hours, they shouldn't need to manually intervene for their system to keep working. 
The gap I can see in your solution is it seems like reconnect is only attempted if another GCAL event (that is in memory) is fired.  If there wasn't another vent in memory (or the event in memory occurred during the outage) then potentially there could still be cases where the system needs manual intervention to continue.  Is it possible to attempt to reconnect every few hours (or use the configuration setting already there)?  That way, even if the internet goes down, it will automatically reset itself when it comes back up.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 08, 2016, 10:27:34 am
@MSW -- the plugin also checks the calendar every gc_Interval minutes (default 180) if there are no events..  The real problem (and I have to think further on this) is what happens if vera reloads (which it does for different reasons) and there is no internet connection at that time.  In the current execution model - GCal will stop if, at startup, it cannot verify credentials / access the calendar.
Title: Re: GCAL3 - Version 2.2
Post by: MSW on June 08, 2016, 10:51:56 am
@MSW -- the plugin also checks the calendar every gc_Interval minutes (default 180) if there are no events..  The real problem (and I have to think further on this) is what happens if vera reloads (which it does for different reasons) and there is no internet connection at that time.  In the current execution model - GCal will stop if, at startup, it cannot verify credentials / access the calendar.

That's excellent.  What you have should cover 99% of  internet down scenarios then, which is a huge improvement.  Thanks!
Title: Re: GCAL3 - Version 2.2
Post by: aladur on June 09, 2016, 12:57:30 pm
Hi Stuart, are you able to view my log?
Thanks!!
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 09, 2016, 03:46:13 pm
Hi Stuart, are you able to view my log?
Thanks!!

Yes -- I looked at your log.  I believe you are using V2.0 - it would be best if you were using V2.2.
gc_debug should be set to 3 for troubleshooting.
In any case - from the log file, the plugin is not "seeing" any events.So it is not doing anything (as is to be expected) .  It does appear to be accessing the calendar ok (although with gc_debug set to 1 I'm somewhat guessing).
I suspect that you do not have the permissions set in the calendar as described in the documentation.

My recommendation is to take a 3 step approach.
1) Upgrade to release 2.2
2) Test using the test calendar nd credentials to make sure everything works.
3) Check the permissions on your calendar and then test it.

Let me know how you make out.  It will be something simple .....
Title: Re: GCAL3 - Version 2.2
Post by: aladur on June 10, 2016, 03:19:51 am
Hi Stuart,
step-1 helped. After upgrading to 2.2 it is workig well. Just the "Check" button does not react when clicking on it. I need to disarm+arm.
Thanks!
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 10, 2016, 02:04:45 pm
Hi Stuart,
step-1 helped. After upgrading to 2.2 it is workig well. Just the "Check" button does not react when clicking on it. I need to disarm+arm.
Thanks!
I assume that the check button not working was a "one-time" thing immediately after the upgrade ?
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on June 14, 2016, 03:52:59 pm
For those interested in GCal working through an internet outage --  here's a newer version which I'll release in the marketplace shortly.

If the internet drops - GCal will continue to work using the last "good" calendar information.
If vera reboots and there is no internet  - GCal will continue to work using the last "good" calendar information.
If the calendar id or Credentials file are changed -- GCal MUST have an internet connection at that time to validate that the calendar is accessible, and to get a "good" set of calendar information.

Of course - if you have an extended internet outage - the last "good" calendar information may not be any use if all the events have passed ....

When working "offline" the event name in the display panel will be proceeded by two asterisks i.e. **

There are two files to update.  Make sure to reboot your vera after you have downloaded these files and make sure you have internet connection when you do  :-) .

Edit: remove files -- please use the formal release 2.3 from the marketplace.
Title: Re: GCAL3 - Version 2.2
Post by: powisquare on July 27, 2016, 05:57:22 pm
Have gcal checking an ical calendar in the hope to eventually control a heating setup. The calendar items being checked are whole day events. I believe the timings for these events are 00.00 to 00.00 (midnight to midnight) on the google side. The time showing in ical for my next event is 00:00 Jul 23 to 00:01 Jul 30. Problem I have is the event after this starts 00.00 JUL 30 and so my test switch gets turned on (at 00.00) and then off (00.01). Perhaps it should read 00.00 JUL 30? Any help appreciated.
Title: Re: GCAL3 - Version 2.2
Post by: CudaNet on July 27, 2016, 06:04:55 pm
Hi Stuart,

I haven't loaded plugins to Vera in quite a while (there I go showing my love for Vera). I typically grab what I can off these threads and upgrade all my openLuup systems. Akbooer/amg0 now have their own App Store and I'd love to see this plugin available there. I believe they host their plugins loaded to Github, perhaps another means to make accessibility easier.

Thoughts ?

For those interested in GCal working through an internet outage --  here's a newer version which I'll release in the marketplace shortly.

If the internet drops - GCal will continue to work using the last "good" calendar information.
If vera reboots and there is no internet  - GCal will continue to work using the last "good" calendar information.
If the calendar id or Credentials file are changed -- GCal MUST have an internet connection at that time to validate that the calendar is accessible, and to get a "good" set of calendar information.

Of course - if you have an extended internet outage - the last "good" calendar information may not be any use if all the events have passed ....

When working "offline" the event name in the display panel will be proceeded by two asterisks i.e. **

There are two files to update.  Make sure to reboot your vera after you have downloaded these files and make sure you have internet connection when you do  :-) .

Edit: remove files -- please use the formal release 2.3 from the marketplace.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on July 28, 2016, 11:55:17 am
The time showing in ical for my next event is 00:00 Jul 23 to 00:01 Jul 30.

Is this what is showing up in GCal3 ?   If so - it's a single 7 day event.

Quote
I believe the timings for these events are 00.00 to 00.00 (midnight to midnight) on the google side.

Are you reading from the ical or from the google calendar ?  This is an important distinction since iCal is not a tight specification.   It's best to read from the google calendar direct  (without using the iCal option in google)

The best approach is usually to set up a one-day repeating event as opposed to one long multi-day event.

See my recent release notes on what happens at midnight when getting events from google - by default GCal looks back into the prior day.  If it's reading an ical then it has to download the entire calendar (for as far back as it goes).

With a little more info we can get you working.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on July 28, 2016, 12:03:40 pm
Hi Stuart,

I haven't loaded plugins to Vera in quite a while (there I go showing my love for Vera). I typically grab what I can off these threads and upgrade all my openLuup systems. Akbooer/amg0 now have their own App Store and I'd love to see this plugin available there. I believe they host their plugins loaded to Github, perhaps another means to make accessibility easier.

Thoughts ?


Happy to take a look -- is there a link to their App Store ?
Title: Re: GCAL3 - Version 2.2
Post by: powisquare on July 28, 2016, 12:20:32 pm
The time showing in ical for my next event is 00:00 Jul 23 to 00:01 Jul 30.

Is this what is showing up in GCal3 ?   If so - it's a single 7 day event.

Correct - this is what shows in gcal and this one is a seven day event.

Quote
I believe the timings for these events are 00.00 to 00.00 (midnight to midnight) on the google side.

Are you reading from the ical or from the google calendar ?  This is an important distinction since iCal is not a tight specification.   It's best to read from the google calendar direct  (without using the iCal option in google)

Reading this from google calendar. Times are .. Sat, 23 July, 00:00 ? Sat, 30 July, 00:00.

The best approach is usually to set up a one-day repeating event as opposed to one long multi-day event.

Unable to alter the event - it is created by booking software automatically and then passed to google by ical.

See my recent release notes on what happens at midnight when getting events from google - by default GCal looks back into the prior day.  If it's reading an ical then it has to download the entire calendar (for as far back as it goes).

Will do

With a little more info we can get you working.

Thanks Stuart
Title: Re: GCAL3 - Version 2.2
Post by: CudaNet on July 28, 2016, 12:32:37 pm
Hope this helps, access to the Alternate App Store is via AltUI. Thanks Stuart !
http://forum.micasaverde.com/index.php/topic,38102.0.html (http://forum.micasaverde.com/index.php/topic,38102.0.html)

Hi Stuart,

I haven't loaded plugins to Vera in quite a while (there I go showing my love for Vera). I typically grab what I can off these threads and upgrade all my openLuup systems. Akbooer/amg0 now have their own App Store and I'd love to see this plugin available there. I believe they host their plugins loaded to Github, perhaps another means to make accessibility easier.

Thoughts ?


Happy to take a look -- is there a link to their App Store ?
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on July 29, 2016, 05:21:06 pm
@ powisquare

I was thinking about your "long events" and the variability of how long they might be.  As well - I was not really satisfied with the changes I recently made to look back into past days using gc_extraDays.  How many extra's is enough?

I've come up with a different approach and am testing it now.  With luck I should have a patch file in the next couple of days  i.e. gotta wait for a few "midnights".
Title: Re: GCAL3 - Version 2.2
Post by: powisquare on July 31, 2016, 03:05:40 pm
The events are usually between 2 days and seven days. Very ocassionally up to fourteen. I shall need to read up further on gc_extraDays as unsure about that.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on July 31, 2016, 04:29:24 pm
The events are usually between 2 days and seven days. Very ocassionally up to fourteen. I shall need to read up further on gc_extraDays as unsure about that.

Hold off for a day or two.  I'm testing a different approach that will mean you will not need to worry about gc_extraDays.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 01, 2016, 02:38:28 pm
@ powisquare and @ possum

I've been digging into the "midnight" thing and noticed that google is correctly returning events that span midnight.  So it's not clear to me that the change in the last release of the code actually did anything to fix the original issue.

So I backed out those changes and my current code base is close to the 2.2 version (as far as "midnight" is concerned).  What I suspect is there may have been some other issue caused by Luup making repeat calls to check the calendar in the same second (something I just noticed).  Usually this would be unlikely to occur during normal running but could easily happen when someone is testing / setting up.  I've added some code to mitigate this ..

I'm testing two situations.
1.  An event that starts at 11:00 pm and ends at 2:00am with the next event starting at 2:00 am
2.  An event that starts at 11:00 pm and ends at midnight with the next event starting at midnight

If these two do not capture the situations you reported - please let me know.  @ powisquare - your 'x' day event should not matter as I do see google calendar returning multi-day events in the current day.
Title: Re: GCAL3 - Version 2.2
Post by: possum on August 08, 2016, 08:04:08 am
Your app has been working flawlessly since I installed the change that you have since removed. However, I will monitor this thread so that I can install your final change once you have made it. Better to have the right fix than something that just masks the problem.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 11, 2016, 02:20:32 pm
I believe I have the "midnight thing" fixed in a sensible way.  Testing has taken a while because:
- midnight does not happen every testing-day
- needed to change my vera log setup so log files did not disappear mid test
- vera's event notification sometimes works and sometimes not (yes I know I should use Richard's plugin but I like to test on a "clean" system if I can)
- there is a quirk in google calendar that I needed to work around


Anyway - try this (2 files).  I don't seem to be able to make it break but others have greater skills in this regard  ::)  ::)  ::)

Edit: removed files
Title: Re: GCAL3 - Version 2.2
Post by: powisquare on August 15, 2016, 11:39:54 am
Sorry for the delay - not getting email notifications from micasaverde anymore?! Just tried the updated files and re checked the calendar. Still get the 1 minute past midnight. Have attached pic.
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 15, 2016, 03:00:48 pm
@powisquare --

Check the value of gc_EndDelta.  It should be zero (usually) .  I seem to remember looking at someone's log files (yours ?) and it was set to 1 (i.e. add a minute to the end time).

Also - I have noticed the same strange behavior with notifications - although the logs tell me that the device was tripped correctly.

I'm testing to see if it's a (relatively new) vera setting that is getting in the way.  I had not paid any attention to it before .....
Try setting IgnoreTripTime to 0 (Looks like vera defaults it to 2 sec)
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 15, 2016, 06:13:25 pm
Sorry for the delay - not getting email notifications from micasaverde anymore?!

Was not paying attention ...  when you say "anymore" do you mean that you did not get a notification on 13 Aug when this event started?   Was there an event immediately before that finished at 00:00 on 13 Aug (or 00:01 on 13th Aug) ?
Title: Re: GCAL3 - Version 2.2
Post by: powisquare on August 16, 2016, 04:33:34 am
Thx Stuart. I was referring to the email notifications which are sent out when someone posts here,  but saying that I did not get a notification for an event which should have been triggered this weekend. I shall keep an eye on things.

The good news - gc_EndDelta now set to 0 and end time shows midnight correctly. Will wait and see what happens with triggers and notifications. Have not changed IgnoreTripTime at this stage.

PS is it possible to give gc_EndDelta a value of -1 ?
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 19, 2016, 06:43:01 pm
PS is it possible to give gc_EndDelta a value of -1 ?

From the manual  (if this is ambiguous please let me know and I will update the wording):

gc_StartDelta   A number in minutes
Default is 0
Negative numbers are preceded by - positive numbers have no +   Configuration. This is the number of minutes before (negative) or after the event start time that you want the plugin to turn on. Applies to all events unless an event specific start / end delta is defined (see usage notes below).
gc_EndDelta   A number in minutes
Default is 0
Negative numbers are preceded by - positive numbers have no +   Configuration. This is the number of minutes before (negative) or after the event end time that you want the plugin to turn off. Applies to all events unless an event specific start / end delta is defined (see usage notes below).

P.S. I would try to avoid setting gc_EndDelta to -1 to fix the notification problem (see post below)


Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 19, 2016, 06:53:29 pm
The previous patch for events spanning midnight worked well enough in both UI5 and UI7 as far as the plugin was concerned.  However the first notification after the "midnight spanning event" ( i.e. when the next event started at the same time the prior one ended) was not being sent by UI7.  Strangely UI5 was happily sending notifications for the exact same calendar ......

It took some tracking down but I think the notifications are fixed now (I got a notification from both UI5 and UI7 last night from the GCal test calendar).

Here are the updated files -- appreciate any feedback / confirmation

EDIT: Removed patch files
Title: Re: GCAL3 - Version 2.2
Post by: RastusB2 on August 20, 2016, 05:51:49 pm
Stuart, I downloaded the GCal3, v2.2,
Made the Google Service Account, copied the Service key and inserted the new email client details into json file
This is the new ID,
Calendar ID: 8h8lrulp01qpdrje5obtlihmv4@group.calendar.google.com
This is the error log:
09 08/20/16 7:36:44.630 JobHandler_LuaUPnP::Run device 87 GCal3 Sensor room 0 type urn:schemas-srs-com:device:GCal:3 id parent 0/0x9f6d18 upnp: 0 <0x2b425000> 50 08/20/16 7:36:47.508 luup_log:87: GCal3 device: 87 - local function: GCalStartup <0x2bd59680> 50 08/20/16 7:36:47.530 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0 <0x2bd59680> 50 08/20/16 7:36:47.549 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 256 <0x2bd59680> 50 08/20/16 7:36:47.569 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 256 <0x2bd59680> 50 08/20/16 7:36:47.590 luup_log:87: GCal3 device: 87 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 256 <0x2bd59680> 50 08/20/16 7:36:47.610 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 256 <0x2bd59680> 50 08/20/16 7:36:47.637 luup_log:87: GCal3 device: 87 - Command cat /etc/*release | grep -i OpenWrt returned 0 <0x2bd59680> 50 08/20/16 7:36:47.637 luup_log:87: GCal3 device: 87 - Distro is: OPENWRT <0x2bd59680> 50 08/20/16 7:36:47.980 luup_log:87: GCal3 device: 87 - Existing openssl version is: 1.0.0 <0x2bd59680> 50 08/20/16 7:36:47.983 luup_log:87: GCal3 device: 87 - No Module: dkjson <0x2bd59680> 50 08/20/16 7:36:47.984 luup_log:87: GCal3 device: 87 - Check for module: dkjson returned false <0x2bd59680> 50 08/20/16 7:36:48.014 luup_log:87: GCal3 device: 87 - Check for module: json returned true <0x2bd59680> 50 08/20/16 7:36:48.014 luup_log:87: GCal3 device: 87 - Function getVariables <0x2bd59680> 50 08/20/16 7:36:48.459 luup_log:87: GCal3 device: 87 - local function: makejson <0x2bd59680> 01 08/20/16 7:36:48.461 LuImplementation::StartLua running startup code for 87 I_GCal3.xml failed <0x2bd59680> 09 08/20/16 8:51:23.008 JobHandler_LuaUPnP::Run device 87 GCal3 Sensor room 0 type urn:schemas-srs-com:device:GCal:3 id parent 0/0xfd5d18 upnp: 0 <0x2af4c000> 50 08/20/16 8:51:25.951 luup_log:87: GCal3 device: 87 - local function: GCalStartup <0x2b87f680> 50 08/20/16 8:51:25.974 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0 <0x2b87f680> 50 08/20/16 8:51:25.993 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 256 <0x2b87f680> 50 08/20/16 8:51:26.013 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 256 <0x2b87f680> 50 08/20/16 8:51:26.033 luup_log:87: GCal3 device: 87 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 256 <0x2b87f680> 50 08/20/16 8:51:26.052 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 256 <0x2b87f680> 50 08/20/16 8:51:26.079 luup_log:87: GCal3 device: 87 - Command cat /etc/*release | grep -i OpenWrt returned 0 <0x2b87f680> 50 08/20/16 8:51:26.080 luup_log:87: GCal3 device: 87 - Distro is: OPENWRT <0x2b87f680> 50 08/20/16 8:51:26.142 luup_log:87: GCal3 device: 87 - Existing openssl version is: 1.0.0 <0x2b87f680> 50 08/20/16 8:51:26.147 luup_log:87: GCal3 device: 87 - No Module: dkjson <0x2b87f680> 50 08/20/16 8:51:26.148 luup_log:87: GCal3 device: 87 - Check for module: dkjson returned false <0x2b87f680> 50 08/20/16 8:51:26.250 luup_log:87: GCal3 device: 87 - Check for module: json returned true <0x2b87f680> 50 08/20/16 8:51:26.263 luup_log:87: GCal3 device: 87 - Function getVariables <0x2b87f680> 50 08/20/16 8:51:26.387 luup_log:87: GCal3 device: 87 - local function: makejson <0x2b87f680> 01 08/20/16 8:51:26.389 LuImplementation::StartLua running startup code for 87 I_GCal3.xml failed <0x2b87f680> 09 08/20/16 8:54:52.606 JobHandler_LuaUPnP::Run device 87 GCal3 Sensor room 0 type urn:schemas-srs-com:device:GCal:3 id parent 0/0x9b7d18 upnp: 0 <0x2b241000> 50 08/20/16 8:54:55.541 luup_log:87: GCal3 device: 87 - local function: GCalStartup <0x2bb75680> 50 08/20/16 8:54:55.594 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0 <0x2bb75680> 50 08/20/16 8:54:55.615 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 256 <0x2bb75680> 50 08/20/16 8:54:55.649 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 256 <0x2bb75680> 50 08/20/16 8:54:55.673 luup_log:87: GCal3 device: 87 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 256 <0x2bb75680> 50 08/20/16 8:54:55.713 luup_log:87: GCal3 device: 87 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 256 <0x2bb75680> 50 08/20/16 8:54:55.756 luup_log:87: GCal3 device: 87 - Command cat /etc/*release | grep -i OpenWrt returned 0 <0x2bb75680> 50 08/20/16 8:54:55.756 luup_log:87: GCal3 device: 87 - Distro is: OPENWRT <0x2bb75680> 50 08/20/16 8:54:55.810 luup_log:87: GCal3 device: 87 - Existing openssl version is: 1.0.0 <0x2bb75680> 50 08/20/16 8:54:55.812 luup_log:87: GCal3 device: 87 - No Module: dkjson <0x2bb75680> 50 08/20/16 8:54:55.823 luup_log:87: GCal3 device: 87 - Check for module: dkjson returned false <0x2bb75680> 50 08/20/16 8:54:55.871 luup_log:87: GCal3 device: 87 - Check for module: json returned true <0x2bb75680> 50 08/20/16 8:54:55.871 luup_log:87: GCal3 device: 87 - Function getVariables <0x2bb75680> 50 08/20/16 8:54:56.029 luup_log:87: GCal3 device: 87 - local function: makejson <0x2bb75680> 01 08/20/16 8:54:56.030 LuImplementation::StartLua running startup code for 87 I_GCal3.xml failed <0x2bb75680> 08 08/20/16 12:39:17.883 JobHandler_LuaUPnP::HandleActionRequest argument new_Grep=GCal3 <0x30375680> 50 08/20/16 12:39:17.884 luup_log:86: GetLog device: 86 - User input Grep Pattern = GCal3 <0x30375680> 06 08/20/16 12:39:17.885 Device_Variable::m_szValue_set device: 86 service: urn:srs-com:serviceId:GetLog variable: gl_Grep was: 3 now: GCal3 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x30375680> 50 08/20/16 12:39:20.119 luup_log:86: GetLog device: 86 - Command grep GCal3 /var/log/cmh/LuaUPnP.log > /etc/cmh-ludl/00-GetLog.log returned 0 <0x307b1680> 50 08/20/16 15:30:20.654 luup_log:86: GetLog device: 86 - Command grep GCal3 /var/log/cmh/LuaUPnP.log > /etc/cmh-ludl/00-GetLog.log returned 0 <0x307b1680> 50 08/20/16 16:08:27.668 luup_log:86: GetLog device: 86 - Command grep GCal3 /var/log/cmh/LuaUPnP.log > /etc/cmh-ludl/00-GetLog.log returned 0 <0x307b1680> 50 08/20/16 16:22:56.419 luup_log:86: GetLog device: 86 - Command grep GCal3 /var/log/cmh/LuaUPnP.log > /etc/cmh-ludl/00-GetLog.log returned 0 <0x30375680>

Can you please point me in the right direction?
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 21, 2016, 01:08:18 pm
Stuart, I downloaded the GCal3, v2.2,
 .......

Can you please point me in the right direction?

By "download" do you mean install from the marketplace or download files and manually install ?   The reason I ask is that the log file looks very strange so I'm wondering if the install was "clean".  It's also very hard to read :-( .

To figure out what's happening:
set gc-debug to 3
reboot  your vera
capture the log file with something that doesn't mangle the formatting - I use notepad++
send the logfile as an attachment to me using PM (since there can be some account specific info in the log file)

   
Title: Re: GCAL3 - Version 2.2
Post by: possum on August 22, 2016, 07:31:26 am
Stuart,

I downloaded your latest two patches and it turned off at 00:01:01:507 rather than the 02:00:00 that is programmed into Google calendar, I find the 1 minute after midnight rather odd. Normally the time stamp is a couple of seconds after the programmed time. The 1 minute seems like a lot more than can be explained by Vera being busy doing other things.

I am running UI5 and the previous patch that you released for UI5 seemed to be working fine.

I have a question. I am unaware of how Google stores an event time in a calendar entry but I assume they can be converted to UTC. Vera is using UTC which has no intrinsic notion of midnight. So if the event start and stop times were calculated in UTC, wouldn't that eliminate all of these problems?
Title: Re: GCAL3 - Version 2.2
Post by: Stuart on August 22, 2016, 10:16:35 am
@ Possum --

I'm going to need to see your log file with gc_debug = 3 that surround the time of the issue. I'm testing simultaneously on UI5 and UI7 using the test calendar (see first post in this thread). Both UI5 and UI7 are both behaving correctly (event starts at 23:30 and finishes at 02:00 next event starts at 02:00 and goes to 03:00 - these times are MST).  I just checked and this worked perfect;y last night.

What time zone are you in ?  I can add in a couple of events to the test calendar that span your midnight and we can both test against the same calendar.

Yes - google uses UTC and GCal internally also uses UTC - all the event start stop times are compared as UTC.  GCal calculates the local timezone offset and uses that for display purposes and things like knowing when it's midnight.  It relies however on the timezone for the google calendar and the timezone for the vera unit being the same. Any inconsistency between the two will give strange results.

One question -- when you say it turned off at 00:01:01 -- what are you using as your reference.  The reason I ask is that if it's an email notification, they can be off by quite a bit.  If it's the log file or PLEG then that's likely very accurate.   Having said that, if there was some network issue or vera was busy doing "vera things" (like a reboot or whatever) - then a minute variation is entirely possible.  That of course does not explain the 00:00 versus 02:00 difference - hence we need to see the log file ...
Title: Re: GCAL3 - Version 2.3
Post by: Stuart on August 22, 2016, 10:55:02 am
@ RastusB2 --

Before you go ahead with the instructions I gave in the PM.  You should do the following:

1. Delete the plugin from your vera and reboot - I'm saying this because you reported that you had installed V2.2.  V2.3 has been in the marketplace for a while and that is what you need to be using.  Also there is a fatal error reported in the log above that suggests the install failed.
2. Install V2.3 from the marketplace and reboot.
3. Set gc-debug to 3 (per the PM).  use F5 after to refresh the browser and make sure the value actually changed (this is a "vera thing").
4. Configure the Calendar ID and if necessary the credentials file name (if you used the default of GCal3,json then it will be recognized)

If it's still not working  - get a log file and PM the log file as an attachment.
Also let me know what the message is on the GCal plugin display panel.
Title: Re: GCAL3 - Version 2.3
Post by: possum on August 22, 2016, 05:15:45 pm
It will take me a couple of days to get you the log file (other priorities).

I am in the Eastern time zone. As far as I know all of this is set up correctly. I remember doing this when I initially set up Vera. Also, the event start time and stop time have always been displayed by your app correctly in the browser (even now). In addition, it was working fine until I updated the two files that you modified.

The event time that I reported  came from the STATUS page of the PLEG app.

I am not sure of this but I am beginning to wonder whether the event off time was correct on the first day after I updated the files. The data that I sent you was from the second day after I updated your files in which case, all of the data that was being used had been generated by your modified files. In other words, if the event off time is determined when the event is first "discovered" and persisted through a restart, then the first day your modified files would still be using the data calculated from the older files. Unfortunately, I didn't examine the data carefully after the first day so this speculation may be completely off base.
Title: Re: GCAL3 - Version 2.3
Post by: Stuart on August 22, 2016, 05:54:38 pm
In other words, if the event off time is determined when the event is first "discovered" and persisted through a restart, then the first day your modified files would still be using the data calculated from the older files. Unfortunately, I didn't examine the data carefully after the first day so this speculation may be completely off base.

The event list is refreshed every time there is an event start, event end or reboot (and by default every 3 hr if none of these things happen).  The only time there is "event memory" is if google the calendar cannot be reached (e.g. network issue), in which case GCal will try to continue based on the last good list of events.

Why not give the test calendar a go.  I put in an event for tonight --  TEST Midnight Span  EST 23:30 to 00:30.  Lets get rid of a variable.
Title: Re: GCAL3 - Version 2.3
Post by: marcusstorm on August 23, 2016, 02:39:59 am
Hi,

Can anyone help see what is wrong with the code below, i don?t get any list with events and the code don?t execute the comment line in red. I have checked the plugin with GCAL3 and Sonos so they are working and i have cheack and there are info in variabale gc_jsonEvents in this format:

gc_jsonEvents variable has the following information then i check the plugin device variables

[ { "eventEnd": 1471869960, "eventStart": 1471868100, "eventParameter": "", "eventName": "MAMMOGRAFI KL.14.15, KULTIVATORG3, V?N2, ANGERED" }, { "eventEnd": 1471928460, "eventStart": 1471924800, "eventParameter": "", "eventName": "DINNER TIME" }, { "eventEnd": 1471960860, "eventStart": 1471949100, "eventParameter": "", "eventName": "NOEL REP OPERAN 12:45-16:00" } ]

 
--Code--
local function getjsonEvents()
  local gCalDeviceNo = 51
  local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
  local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",gCalDeviceNo)

  local SONOSDeviceNo = 49
  local SONOS_SID = "urn:micasaverde-com:serviceId:Sonos1"

  if (jsonEvents == "[]") then -- equivalent of a nul so don't try
    return false
  end

  local json = require("json")
  local eventList =json.decode(jsonEvents)    -- I cant get this line executed, anyone se anything wrong???
  package.loaded.json = nil

  local numberEvents = table.getn(eventList)
  local startevent, startDate, startTime, endevent, endTime, nameEvent, event
 
  for i = 1,numberEvents do
    nameEvent = eventList.eventName
    luup.call_action(SONOS_SID , "Say", {Text = nameEvent }, SONOSDeviceNo )
  end
return true
end
Title: Re: GCAL3 - Version 2.3
Post by: wriede on August 23, 2016, 01:29:54 pm
I keep getting "Startup Lua Failed" for GCal3 even after several reboots of my Veralite. I tried V2.3 and in desperation uninstalled that and explicitly installed V2.0 because I could find the url for that but it makes no difference. If I try to do anything with the device it created like set the calendar id or getlog I get "Device not ready". I cannot find gc_debug to set to 3 to see if that tells me anything. FWIW, I'm still on UI5 (firmware 1.5.622) but if I read the release notes correctly that's still supported.

I ssh'd into the box and in log file LuaUPnP.log I found what may be the smoking gun:

01   08/23/16 10:50:21.772   LuaInterface::CallFunction_Startup-1 device 54 function GCalStartup failed /usr/lib/lua/json.lua:366: Unexpected character at Line 1 character 2: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
01   08/23/16 10:50:21.773   LuImplementation::StartLua running startup code for 54 I_GCal3.xml failed <0x2ba7b680>

the first bit of I_GCal3.xml reads:

<implementation><files>GCal3.lua</files><incoming><lua>luup.log("GCal3 - Incoming should not be called on this device")

which is not what json.lua is looking for - I have no idea why there is that mismatch or what to do about it.

As you can tell I'm in over my head here as this plugin causes me much more trouble than anything I've done with Vera so far. Hopefully someone can give me some step by step instructions on how to figure out what I'm doing wrong...
Title: Re: GCAL3 - Version 2.3
Post by: possum on August 24, 2016, 08:40:04 am
Stuart,

I want to make sure that I am running the correct software. It is  bothersome that my system is consistently tripping off at "00:01:01" and your system is apparently working correctly. I noticed this morning that you released V2.3. I have been running V2.2 with the two file updates that you provided in a previous post.

I attempted to update the app to V2.3 this morning from the MIOS marketplace and after a minute or two, I received a brief message that stated that it was unable to successfully download the app. That dialog then disappeared. I then went to my system and found that the app is listed as "V2.3*". I have attempted to search the forums a number of times for the meaning of the "*" and have been unsuccessful.  I don't know whether there was a delay in downloading V2.3 that was eventually resolved or whether there is now an issue of some kind with the files on my controller or whether the "*" simply means that the files are not "official". Can you provide any insight into what is happening? I am very reluctant to delete the app and do a clean install because it messes up all of the references from other apps.

Hopefully I will be able to get the log file tonight.
Title: Re: GCAL3 - Version 2.3
Post by: possum on August 24, 2016, 09:14:29 am
Quick Update.

I went and reviewed the information on the "Advanced" tab and I noticed that after I attempted to download your current V2.3 release, there is a difference. For the first time since I loaded your two patch files, I am now seeing that gc_EventsToday has a value of 2. Previously, it has consistently shown a value of 1. This never made any sense since on every day there is an ON event and an OFF event so I expected that the number of events would be 2 (as it now is).

I then went and compared the GCal3.lua file that I had downloaded from your previous post (it had V2.4 as a comment) with the GCal3.lua file that is now running on my controller (it has V2.3 as a comment) and they have many differences. This makes me wonder what the file was that you had previously posted. However, I suspect that it explains why our two systems have been behaving differently. I should know tomorrow morning.

I would still appreciate an explanation of the "*" next to the version number.
Title: Re: GCAL3 - Version 2.3
Post by: Stuart on August 24, 2016, 01:09:25 pm
  local json = require("json")

Try

Code: [Select]
local json = require("dkjson")

Depending on the vera version it can be different.  See the notes here:

http://forum.micasaverde.com/index.php/topic,26692.msg276087.html#msg276087

Title: Re: GCAL3 - Version 2.3
Post by: Stuart on August 24, 2016, 01:43:07 pm
@ Possum --

No idea what the "*" is.

The 00:01:xx thing is very bothersome, I agree ......  I assume by this that you have an event that starts before midnight and ends at some time after midnight, is triggered On at the correct time but goes OFF, prematurely at midnight(ish) ?      I spend several hrs over the last few days testing and debugging and cannot get it to fail.  Having said that I have on occasion NOT got an email notification from vera - but in checking the logs I can see that the event did start and stop at the right time.

Now -- to be clear, the "midnight check" is forced at a minute past midnight (to allow for small variations in vera's internal time).   The purpose of the midnight check is to allow for a reset of the counts of Events Today and Events Left Today.

For reference - I use a test calendar (details in the first post) and have been using "events" that start / stop ant midnight (MST) and which span midnight.

Now by "events" I mean "calendar events" as opposed to on/off or any other type of transition that could be called an event.  Basically - it's a count of the number of calendar events (entries) for that day and the number left in the calendar from "now".   "now" being the last time the plugin updated.

To add to the confusion - I had a silly bug ( =< as opposed to <) in the code for that section so the counts were sometimes picking up events that it should not have.  I did not notice this in my testing because the test calendar was too regular and gave the counts I was expecting (it's not regular any more).  So that likely explains the incorrect counts you saw (depending on how you interpreted and what your calendar looked like).

Having said that, it did not affect any of the code that recognizes events  and when they start / stop.  The fix is in the attached patch - if you want to try it.  This patch goes on top of R2.3.

Bottom line -- we need a log file to see what's truly going on.

For practical reasons - I always patch on top of the latest versions in the marketplace and that version # will usually be reflected in the thread title (I forgot to update that last time - and changed it a few days ago). I also try to remember to remove older patches .

Edit: removed patch files
Title: Re: GCAL3 - Version 2.3
Post by: possum on August 25, 2016, 08:24:26 am
The problem has been fixed. It appears to be have been caused by the confusion that existed around the patch files that you provided on Aug 19 - reply 526. I mistakenly assumed that these files were patches on V2.2 which is what I was running at the time. Based on your last message, it now appears that these patches were based on V2.3.

After I updated to V2.3, the gc_EventsToday variable started to work correctly and last night, the OFF event tripped at 2am as it was supposed to do. I can only assume that there were other file modifications in the official V2.3 release that were missing when I applied your patches to V2.2 and that is what caused the problem.

I do not seem to be affected by the bug that you mentioned in your last post so I think I may wait a bit to make any further modifications.
Title: Re: GCAL3 - Version 2.3
Post by: wriede on August 30, 2016, 12:38:15 pm
I really hope that you can help me get past this...

I keep getting "Startup Lua Failed" for GCal3 even after several reboots of my Veralite. I tried V2.3 and in desperation uninstalled that and explicitly installed V2.0 because I could find the url for that but it makes no difference. If I try to do anything with the device it created like set the calendar id or getlog I get "Device not ready". I cannot find gc_debug to set to 3 to see if that tells me anything. FWIW, I'm still on UI5 (firmware 1.5.622) but if I read the release notes correctly that's still supported.

I ssh'd into the box and in log file LuaUPnP.log I found what may be the smoking gun:

01   08/23/16 10:50:21.772   LuaInterface::CallFunction_Startup-1 device 54 function GCalStartup failed /usr/lib/lua/json.lua:366: Unexpected character at Line 1 character 2: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
01   08/23/16 10:50:21.773   LuImplementation::StartLua running startup code for 54 I_GCal3.xml failed <0x2ba7b680>

the first bit of I_GCal3.xml reads:

<implementation><files>GCal3.lua</files><incoming><lua>luup.log("GCal3 - Incoming should not be called on this device")

which is not what json.lua is looking for - I have no idea why there is that mismatch or what to do about it.

Title: Re: GCAL3 - Version 2.3
Post by: Stuart on September 01, 2016, 06:08:38 pm
My test machine is on 1.5.622 -- so we are likely good there.  I routinely test on UI5 as well as UI7.

What version were you on prior to trying the upgrade to 2.3 ?  If it was a version prior to 2.0 then did you pay attention to these notes ?

http://forum.micasaverde.com/index.php/topic,26692.msg276087.html#msg276087

Specifically -- I'd go through this part of the upgrade sequence again BUT use the V2.3 install instead of the 2.0.  I  added an additional step 2.a to help be sure the vera is "clean" at each step.

To upgrade to  V2 you will need to do the following:
1.  Take a note of the settings in your existing
  Advanced --> Variables tab.
2.  DELETE your existing plugins
2.a REBOOT
3.  Install version 2.0 Note: If you get a "Lua Startup Failed" message, rebooting should clear the error.
4.  Set the Calendar ID using the Control Tab -  - wait a bit as vera will restart
5.  If you are using a credential file different to the default name (GCal3.json)
    set it using the Control Tab -  - wait a bit as vera will restart
4.  Set the appropriate variables in the Advanced --> Variables tab
6.  Change any scenes etc to use the new plugin number.
     (See especially the note below on JSON Parser)
Title: Re: GCAL3 - Version 2.3
Post by: wriede on September 02, 2016, 12:34:27 pm
Stuart,

I originally installed the calendar app called GCAL (without the trailing "3"). That was about three years ago. Personal circumstances forced me to abandon that aspect of my home automation before I got anywhere so it was never activated.

Could the json.lua on my system be left over from those days?

root@MiOS_xxx:~# ls -l /usr/lib/lua/json.lua
-rw-r--r--    1 root     root         17997 Jul 10  2012 /usr/lib/lua/json.lua

Recently I decided to pick back up where I left off, and figured that upgrading to the latest version was first on the list. But GCAL was obsolete, and GCal3 arrived in its place. I did find the instructions that you included a link to in your latest post and followed those. Since it didn't work out as intended I may or may not have made a mistake in the process.

Since I had never customized GCAL I did not write down any settings in Advanced --> Variables, assuming all those to be default values. So those are lost if they ever mattered.

I did delete GCAL before proceeding. Now that I am sensitive to the letter of your instructions, I note you say "DELETE your existing plugins" - plural - should I have deleted any other plugins or more importantly still do so now?

As I wrote in my post, I then first installed GCal3 V2.3 and only rolled that back to 2.0 after V2.3 failed at startup after each of several reboots - just in case anything had changed in UI5 support between V2.0 and 2.3 since the instructions are for 2.0. More out of desperation than anything else...

Moving on - this is a step by step log on attempting re-install of V2.3:

- uninstall GCal3 V2.0
- reboot veralite
- see what happened to json.lua: still there
- install GCal V2.3: "GCal3 Sensor" device created, "GCal3 Sensor[54] : Startup Lua Failed"
- hit "save": startup fail message reappears
- see what happened to json.lua: still the same one as listed above
- reboot veralite: startup fail message reappears

So here I am with V2.3 now installed but still failing its initial startup :-(

What do I do next?

Thanks for your help, Willem Riede.


Title: Re: GCAL3 - Version 2.3
Post by: Stuart on September 04, 2016, 03:39:27 pm
Willem --

Sorry that you are having problems.  V2.3 is the correct one to work with - so lets stick to that as we figure out what is happening.

By  "DELETE your existing plugins" I meant any existing GCAL / GCal2 / GCal3 plugins - not other unrelated ones.  By DELETE I did mean using the vera UI to delete them (as there is some internal to vera references that get cleaned up).  If you just delete using the operating system rm command then sometimes strange things happen.  I don't think that is the case here.

I cannot remember if the old json.lua file is the same version as is currently being used.  The safest thing is to delete it and then restart vera.  The pluging will reinstall the appropriate version if it needs to.

Since this is failing during the initialization phase - we will need to get a copy of the log following a reboot to see what is happening.  One thing you can try is to first upload these two files -- they are  the latest version ( will become V2.4 soon).  I have a few more debug messages and may (no promises) have fixed something silly along the way :-).

Make sure you reboot (not just a Lua reload) after you have uploaded the files and then get a log file after the error shows up.

Edit: Removed files
Title: Re: GCAL3 - Version 2.3
Post by: wriede on September 05, 2016, 12:47:55 pm
Stuart,

I did indeed use the UI App Uninstall mechanism to delete CGAL and later GCal3 V2.0, no worries there.

Since deleting my existing json.lua file is irreversible, I decided to rename it instead so it wouldn't be recognized as such but could be restored if need be. As a bonus that'll allow me to compare the version that gets pulled in in its place to see if it's different.

Here is what I did:

- mv json.lua json-lua.bak
- upload GCal3.lua and I_GCal3.xml
- reboot veralite
- lo and behold - no startup error

root@MiOS_xxx:~# ls -l /usr/lib/lua/*json*
-rw-r--r--    1 root     root         17997 Jul 10  2012 /usr/lib/lua/json-lua.bak
-rw-r--r--    1 root     root         16947 Sep  5 10:26 /usr/lib/lua/json.lua

The new json.lua file that got pulled in is totally different from what was left over from before - the 'diff' command didn't find anything in common.

So we declare success and I move on to configuring the plugin. Hopefully that'll be trivial in comparison :-)

Thanks!!!

Willem.
Title: GCAL3 - Version 2.4 Beta
Post by: Stuart on September 19, 2016, 09:55:52 am
If there is no feedback on the beta candidate in the next few days - I will assume that all is well and release it to the marketplace.

For those that tried the beta (I know there was at least one) -- thank you.  If anyone does have feedback - good / bad / neutral.  Please let me know.
Title: GCAL3 - Version 2.4 Upgrade notes
Post by: Stuart on September 21, 2016, 05:02:38 pm
To upgrade to R2.4 :

1.  Switch all of the GCal plugins to Bypass Mode and leave it(them) there until all the steps below are complete.
2.  Upgrade from the marketplace

After the upgrade -- the plugin will complain "CalendarID not set" and may also complain "No Credential File" if you are using a credentials file other than the default name(GCal3.json)

Perform the following steps:
For UI7
Note: the old gc_Variables is automatically removed

1.  Set the credential file name using the control Tab  (the default is GCal3.json but set it anyway)
     - wait a bit as vera will restart
2.  Set the Calendar ID using the Control Tab -  - wait a bit as vera will restart

For UI5
Note: the old gc_Variables needs to be removed manually:
for each GCal3 device execute the following in a browser (you must be local to your vera).

http://< your vera IP >:3480/data_request?id=variableset&DeviceNum=< your device number >&serviceId=urn:srs-com:serviceId:GCalIII&Variable=gc_Variables&Value=

1.  Set the credential file name using the control Tab  (the default is GCal3.json but set it anyway)
 - the plugin will say that it is restarting, but it's not ....
2.  Press Reload
3.  Set the Calendar ID using the Control Tab -  - the plugin will say that it is restarting, but it's not ....
4.  Press Reload
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 26, 2016, 04:50:46 pm
My GCal devices all stopped working today with Lua startup failures.  Reading some of the recent posts and seeing 2.4 released, I decided to uninstall the plugin and attempt to reinstall. 

I'm not sure what version I had previously but it was definitely greater than 2.0 as I had setup my Google credentials.  Everytime I restart or reboot, I get GCal3 Sensor[72] : Startup Lua Failed message.

I can't use the device - any attempt to set ID, getLog, set credentials results in a Device not ready error. 

Here's all I can find on GCal from the log:

Code: [Select]
09      09/26/16 13:40:54.611   JobHandler_LuaUPnP::Run device 72 GCal3 Sensor room 0 type urn:schemas-srs-com:device:GCal:3 id  parent 0/0xd5a5b8 upnp: 0 <0x2af9d000>
50      09/26/16 13:41:00.400   luup_log:72: GCal3 device: 72 - local function: GCalStartup <0x2b8d1680>
50      09/26/16 13:41:00.422   luup_log:72: GCal3 device: 72 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0 <0x2b8d1680>
50      09/26/16 13:41:00.448   luup_log:72: GCal3 device: 72 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 256 <0x2b8d1680>
50      09/26/16 13:41:00.476   luup_log:72: GCal3 device: 72 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 256 <0x2b8d1680>
50      09/26/16 13:41:00.503   luup_log:72: GCal3 device: 72 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 256 <0x2b8d1680>
50      09/26/16 13:41:00.521   luup_log:72: GCal3 device: 72 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 256 <0x2b8d1680>
50      09/26/16 13:41:00.550   luup_log:72: GCal3 device: 72 - Command cat /etc/*release | grep -i OpenWrt returned 0 <0x2b8d1680>
50      09/26/16 13:41:00.551   luup_log:72: GCal3 device: 72 - Distro is: OPENWRT <0x2b8d1680>

50      09/26/16 13:41:00.587   luup_log:72: GCal3 device: 72 - Existing openssl version is: 1.0.0 <0x2b8d1680>
50      09/26/16 13:41:00.590   luup_log:72: GCal3 device: 72 - No Module: dkjson <0x2b8d1680>
50      09/26/16 13:41:00.591   luup_log:72: GCal3 device: 72 - Check for module: dkjson returned false <0x2b8d1680>

50      09/26/16 13:41:00.624   luup_log:72: GCal3 device: 72 - Check for module: json returned true __LEAK__ this:16384 start:2207744 to 0x1506000 <0x2b8d1680>
50      09/26/16 13:41:00.624   luup_log:72: GCal3 device: 72 - Function getVariables <0x2b8d1680>

50      09/26/16 13:41:00.679   luup_log:72: GCal3 device: 72 - local function: readfromFile __LEAK__ this:81920 start:2289664 to 0x151a000 <0x2b8d1680>
50      09/26/16 13:41:00.697   luup_log:72: GCal3 device: 72 - Command /bin/ls /etc/cmh-ludl/GCal3/72GCalVariables returned 0 <0x2b8d1680>
50      09/26/16 13:41:00.698   luup_log:72: GCal3 device: 72 - local function: makejson __LEAK__ this:4096 start:2293760 to 0x151b000 <0x2b8d1680>
01      09/26/16 13:41:00.699   LuImplementation::StartLua running startup code for 72 I_GCal3.xml failed <0x2b8d1680>

Help! I was depending on this for Vacation Rental guest arrival automation and its been working flawlessly for years.

Steve
Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 26, 2016, 05:26:10 pm
@ sclodeca --
Can you see if you can set gc_debug to 3 and then reboot.  Not sure if it will take.  If it does we might get some more info.

Are you on UI5 or UI7 ?

I'm wondering if whatever suddenly caused the startup failures is getting in the way ?  Are you running out of space ?

I'll download from the marketplace and double check that there is no corruption there.

Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 26, 2016, 05:53:42 pm
@ sclodeca

I just tested on UI5 and UI7.  I first deleted the existing plugins and then did a fresh install  from the marketplace.
I did not get any startup failed messages.  The only thing I did notice is that you will need to add in the Credential file name even if you are using the default GCal3.json.  I have modified the instructions here:

http://forum.micasaverde.com/index.php/topic,26692.msg294064.html#msg294064

In any case - this is not the problem you are having.

You could try deleting the plugin again, reboot, then install again from the marketplace using the instructions above.   At this stage the only thing I can think of is the install did not complete correctly or there is some issue on your vera.   Either way, we will get to the bottom of it !  But be quick, I'm traveling from tomorrow and will have limited access to my systems.
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 26, 2016, 06:34:40 pm
Wierd : I tried Wilem's tactic of renaming json.lua in /usr/lib/lua to Json-lua.bak and like him, I got a new json.lua after reboot that seemed to solve the problem. 

FYI. I am on UI5 and have had no other recent installs or activity so am at a loss as to why this happened and/or why removing this json.lua file made a difference.  All seems working now.

Thanks.
Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 26, 2016, 06:45:40 pm
I will take a closer look when I get the chance but that is really strange.  I can see in the log file you posted that the plugin did indeed get as far as finding and successfully loading json.lua.  It then seemed to abort while in (or just after) the routine makejson, which (surprisingly) does not use json.lua ....

Can you tell me the file size for the now saved json-lua.bak ?   I may do a file size check as well (assuming it's different to the one that ought to be downloaded) and force an update if it's "old".
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 26, 2016, 06:50:02 pm
Stuart,

Here are the files:

Code: [Select]
root@MiOS_30005109:/usr/lib/lua# ls -als json*
  18 -rw-r--r--    1 root     root         17997 Feb  3  2014 json-lua.bak
  17 -rw-r--r--    1 root     root         16947 Sep 26 14:43 json.lua


Steve
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 26, 2016, 06:52:47 pm
Sorry to be a pain:  One thing is still not working.  The calendar tab just spins with message "Opening calendarTab"  with no entries in the log (even when set to level 3).  I AM logged into the Google account in same browser in a different tab.  I copied the iframe code out of settings as instructed.

Any ideas how to debug this or known gotchas?

Steve...
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 26, 2016, 08:28:25 pm
Stuart,

I have checked for character encoding and this is what I am pasting in:


<iframe src="https://calendar.google.com/calendar/embed?height=600%26wkst=1%26bgcolor=%23FFFFFF%26src=tahoetimberwolf%40gmail.com%26color=%23711616%26ctz=America%2FLos_Angeles" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

Event triggering is working fine.  It accesses the calendar without an issue - just refuses to show the embeded calendar tab.  Tried logging into and using different browsers without success.

Thanks,
Steve.
Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 26, 2016, 10:06:39 pm
Steve --

If you are feeling adventurous - you could try reverting back to the old json.lua file (error should return) and then try this version, which should delete the old json.lua and force a replacement because of a file-size mismatch.

Stuart

Edit: Removed File
Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 26, 2016, 10:10:02 pm
Sorry to be a pain:  One thing is still not working.  The calendar tab just spins with message "Opening calendarTab"  with no entries in the log (even when set to level 3).  I AM logged into the Google account in same browser in a different tab.  I copied the iframe code out of settings as instructed.

Any ideas how to debug this or known gotchas?

Steve...

The calendar tab does not have any debugging -- it's essentially a frame with a url.   I've never seen that error before.
Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 26, 2016, 10:21:51 pm
Stuart,

I have checked for character encoding and this is what I am pasting in:


<iframe src="https://calendar.google.com/calendar/embed?height=600%26wkst=1%26bgcolor=%23FFFFFF%26src=tahoetimberwolf%40gmail.com%26color=%23711616%26ctz=America%2FLos_Angeles" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

Event triggering is working fine.  It accesses the calendar without an issue - just refuses to show the embeded calendar tab.  Tried logging into and using different browsers without success.

Thanks,
Steve.

OK - I broke the calendar tab in R2.4.  My bad - I will not have time to fix it for a couple of weeks.  It's something that I just did not look at when testing.
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 26, 2016, 10:44:59 pm
Is there a way to revert to 2.3?
Title: Re: GCAL3 - Version 2.4
Post by: Stuart on September 27, 2016, 01:52:00 am
Is there a way to revert to 2.3?

If the reason for asking is to get back the calendar tab.  The attached should have it working again (it was a quick fix) - it includes the change to test the json.lua file size.  Both changes work on both my UI5 and UI7.

If there is another reason - let me know what the issue is.

Edit: removed file as it has been submitted as R2.5
Title: Re: GCAL3 - Version 2.4
Post by: sclodeca on September 27, 2016, 02:44:21 am
There were no other reasons.  I will check this out tomorrow.  Thanks for responsiveness on the eve of your trip.

Steve.
Title: Upgrade to R2.5
Post by: Stuart on September 27, 2016, 12:27:53 pm
To upgrade to R2.5 :

1.  Switch all of the GCal plugins to Bypass Mode and leave it(them) there until all the steps below are complete.
2.  Upgrade from the marketplace

After the upgrade -- the plugin will complain "CalendarID not set" and may also complain "No Credential File" if you are using a credentials file other than the default name(GCal3.json)

Perform the following steps:
For UI7

1.  Set the credential file name using the control Tab  (the default is GCal3.json but set it anyway)
     - wait a bit as vera will restart
2.  Set the Calendar ID using the Control Tab -  - wait a bit as vera will restart

For UI5

1.  Set the credential file name using the control Tab  (the default is GCal3.json but set it anyway)
 - the plugin will say that it is restarting, but it's not ....
2.  Press Reload
3.  Set the Calendar ID using the Control Tab -  - the plugin will say that it is restarting, but it's not ....
4.  Press Reload
Title: Re: GCAL3 - Version 2.5
Post by: echino on September 27, 2016, 11:23:57 pm
I had 2.4 installed which stopped working. So I tried upgrading to 2.5 using force upgrade link in the first post since there was no 2.5 in the UI7 marketplace. Instead of upgrading, it shows that my version is now 2.3 and this error message in the calendar tab:

Events from one or more calendars could not be shown here because you do not have the permission to view them.
Title: Re: GCAL3 - Version 2.4
Post by: davidw on September 28, 2016, 01:18:15 am
Stuart, My GCal3 (v.2.4) / UI5 has stopped working also.
Gcal3 Reader [38][38] : Startup Lua Failed

From the log, it seems to be choking trying to read a JSON file.
I read the posts here, but I can't set the "Credentials File" to GCal3.json because it says "Device not Ready"

It is able to connect to Google and get all the upcoming events.

I can't update to 2.5. There is no 2.5 in the store, in fact, a search in the Apps > Install Apps store shows no results for "Google Calendar" or "GCal" or "Gcal3"

Log:

10   09/27/16 21:23:46.149   Device_Variable::m_szValue_set device: 9 service: urn:rts-services-com:serviceId:ProgramLogicC variable: Triggers startup: [{'name':'_tGcalStarted','device':'38','template':'3','service':'urn:srs-com:serviceId:GCalIII','args':[{'name':'gc_notify','op':'=','value':'1'}]}] v:0xd4d998/NONE <0x2b38a000>
10   09/27/16 21:23:46.432   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: UI7Check startup: false v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.433   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent startup: Initial Startup v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.433   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.434   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedEvent startup:  v:0xe13890/NONE <0x2b38a000>
10   09/27/16 21:23:46.434   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_TrippedID startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.435   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_Value startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.435   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_Interval startup: 180 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.436   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_StartDelta startup: 0 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.436   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_EndDelta startup: 0 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.436   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_Keyword startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.437   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_exactKeyword startup: true v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.437   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreKeyword startup: false v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.438   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_triggerNoKeyword startup: false v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.438   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_ignoreAllDayEvent startup: false v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.439   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_retrip startup: true v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.439   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_CalendarID startup: https://www.google.com/calendar/embed?

....

10   09/27/16 21:23:46.440   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_jsonActiveEvents startup: [] v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.441   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_ActiveEvents startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.441   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_EventsToday startup: 8 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.441   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_EventsLeftToday startup: 8 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.442   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_lastCheck startup: 2016-09-26 at 06:15:22 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.442   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_nextCheck startup: 2016-09-26 at 06:50:00 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.443   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_debug startup: 3 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.443   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_displaystatus startup: 0 v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.444   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_notify startup: 0 v:0xe13850/NONE <0x2b38a000>
10   09/27/16 21:23:46.444   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_notifyName startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.444   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_notifyValue startup:  v:(nil)/NONE <0x2b38a000>
10   09/27/16 21:23:46.445   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_notifyType startup:  v:(nil)/NONE <0x2b38a000>
25   09/27/16 21:23:46.715   JobHandler_LuaUPnP::ParseAllImplementations parsed I_GCal3.xml <0x2b38a000>
10   09/27/16 21:23:46.748   Device_LuaUPnP::MatchupImplementations device 38 using implementation: I_GCal3.xml with 2 services <0x2b38a000>
local GCAL_SID = "urn:srs-com:serviceId:GCalIII"
local PLUGIN_NAME = "GCal3"
GC.Status = "Idle" -- default status used to mediate between GCalMain and Calendar Even Adds
  GCV.CredentialFile = Variables[1].CredentialFile or "GCal3.json"
local GS_SID = "urn:srs-com:serviceId:GCalIII"
09   09/27/16 21:23:54.665   JobHandler_LuaUPnP::Run device 38 Gcal3 Reader [38] room 0 type urn:schemas-srs-com:device:GCal:3 id  parent 0/0xce6498 upnp: 0 <0x2b38a000>
25   09/27/16 21:23:57.070   luup_variable_watch added hook to device 38 on urn:srs-com:serviceId:GCalIII:gc_notify to call 0xef1098:TriggerPropertyUpdate __LEAK__ this:151552 start:610304 to 0x161b000 <0x2babd680>
25   09/27/16 21:24:08.035   LuImplementation::StartLua device: 38 file:I_GCal3.xml startup:GCalStartup pLuaInterface: 0x1322130 ip:  port 0 protocol: (null) <0x2babd680>
25   09/27/16 21:24:08.036   LuImplementation::StartLua running startup code for 38 I_GCal3.xml <0x2babd680>
50   09/27/16 21:24:08.037   luup_log:38: GCal3 device: 38 - local function: GCalStartup <0x2babd680>
06   09/27/16 21:24:08.037   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: Initial Startup now: Initial Startup #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2babd680>
06   09/27/16 21:24:08.058   Device_Variable::m_szValue_set device: 38 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was:  now:  #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2babd680>
50   09/27/16 21:24:08.162   luup_log:38: GCal3 device: 38 - Command /bin/ls /etc/cmh-ludl/GCal3/ returned 0 __LEAK__ this:24576 start:5369856 to 0x1aa5000 <0x2babd680>
50   09/27/16 21:24:08.264   luup_log:38: GCal3 device: 38 - Command /bin/ls /etc/cmh-ludl/GCal3/GCal3.sem returned 256 __LEAK__ this:4096 start:5419008 to 0x1ab1000 <0x2babd680>
50   09/27/16 21:24:08.335   luup_log:38: GCal3 device: 38 - Command /bin/ls /etc/cmh-ludl/GCal3/*.token returned 256 __LEAK__ this:40960 start:5459968 to 0x1abb000 <0x2babd680>
50   09/27/16 21:24:08.398   luup_log:38: GCal3 device: 38 - Command /bin/ls /usr/lib/lua/googlejwt.sh returned 256 __LEAK__ this:159744 start:5619712 to 0x1ae2000 <0x2babd680>
50   09/27/16 21:24:08.454   luup_log:38: GCal3 device: 38 - Command /bin/ls /etc/cmh-ludl/D_GCal37.json.lzo returned 256 <0x2babd680>
50   09/27/16 21:24:08.559   luup_log:38: GCal3 device: 38 - Command cat /etc/*release | grep -i OpenWrt returned 0 <0x2babd680>
50   09/27/16 21:24:08.560   luup_log:38: GCal3 device: 38 - Distro is: OPENWRT <0x2babd680>
50   09/27/16 21:24:08.682   luup_log:38: GCal3 device: 38 - Existing openssl version is: 1.0.0 <0x2babd680>
50   09/27/16 21:24:08.685   luup_log:38: GCal3 device: 38 - No Module: dkjson <0x2babd680>
50   09/27/16 21:24:08.685   luup_log:38: GCal3 device: 38 - Check for module: dkjson returned false <0x2babd680>
50   09/27/16 21:24:08.787   luup_log:38: GCal3 device: 38 - Check for module: json returned true <0x2babd680>
50   09/27/16 21:24:08.808   luup_log:38: GCal3 device: 38 - Function getVariables <0x2babd680>
50   09/27/16 21:24:09.042   luup_log:38: GCal3 device: 38 - local function: readfromFile <0x2babd680>
50   09/27/16 21:24:09.094   luup_log:38: GCal3 device: 38 - Command /bin/ls /etc/cmh-ludl/GCal3/38GCalVariables returned 0 <0x2babd680>
50   09/27/16 21:24:09.094   luup_log:38: GCal3 device: 38 - local function: makejson <0x2babd680>
01   09/27/16 21:24:09.096   LuaInterface::CallFunction_Startup-1 device 38 function GCalStartup failed /usr/lib/lua/json.lua:366: Unexpected character at Line 1 character 2: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
01   09/27/16 21:24:09.096   LuImplementation::StartLua running startup code for 38 I_GCal3.xml failed <0x2babd680>

Is there a way to revert to 2.3?

If the reason for asking is to get back the calendar tab.  The attached should have it working again (it was a quick fix) - it includes the change to test the json.lua file size.  Both changes work on both my UI5 and UI7.

If there is another reason - let me know what the issue is.

Edit: removed file as it has been submitted as R2.5
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on September 28, 2016, 07:12:26 am
My apologies to all.  R2.5 is waiting approval from Vera. I am traveling and wanted to get it out.  I will email them and ask them to expedite the approval.

Title: Re: GCAL3 - Version 2.5
Post by: Stuart on September 28, 2016, 07:31:05 am
I had 2.4 installed which stopped working. So I tried upgrading to 2.5 using force upgrade link in the first post since there was no 2.5 in the UI7 marketplace. Instead of upgrading, it shows that my version is now 2.3 and this error message in the calendar tab:

Events from one or more calendars could not be shown here because you do not have the permission to view them.

R2.3 should continue to work.  I pulled R2.4 for a couple of reasons.  Is your browser logged into google ?   The calendar tab just invokes a URL to the calendar and does not pass permissions. Because of this your browser session needs to have already been authenticated.

Hopefully R2.5 will get released today by Vera - they are usually quick at this.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on September 28, 2016, 07:41:57 am
@Davidw

There has been an issue with some, but not all UI5 users due to an old json.lua file.  The best I can make out is that it is unhappy with some data that was being presented in R2.4.
The change in R2.5 is to check the file size instead of the existence of the file and force an update of the file if necessary.  Because of this I pulled R2.4 from the marketplace (not quickly enough)  :'(

As I type R2.3 is the latest version in the marketplace but I expect R2.5 to be released today / tomorrow.

You can force an update to the latest version in the marketplace using the URL command in the first post.

Appologies
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on September 28, 2016, 12:39:13 pm
R2.5 is now in the marketplace. Hopefully all should be well  :D
Title: Re: GCAL3 - Version 2.5
Post by: toy67 on September 28, 2016, 02:20:31 pm
hi STUART , I have changed from V2.3 to V2.5 and now the status Tripped don't change from 0 to 1

(VeraLite UI5)
Title: Re: GCAL3 - Version 2.5
Post by: baxy_AU on September 28, 2016, 03:09:55 pm
My calendar tab has never worked since upgrading to 2.3 and ui7. I was hoping this update might fix it but alas no, what can I do to troubleshoot?
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on September 28, 2016, 03:29:02 pm
My calendar tab has never worked since upgrading to 2.3 and ui7. I was hoping this update might fix it but alas no, what can I do to troubleshoot?

See the post three above.  Try this:  with the Vera hi open , open a new browser tab (not a new window) and display your google calendar (did u have to log in?) - leave the calendar tab open,  go back to the Vera tab and press F5. Does the calendar tab now work ?

If not let's see what you input when setting your calendar if. It's possible it's not being parsed out correctly.
Title: Re: GCAL3 - Version 2.5
Post by: baxy_AU on September 28, 2016, 06:41:39 pm
My calendar tab has never worked since upgrading to 2.3 and ui7. I was hoping this update might fix it but alas no, what can I do to troubleshoot?

See the post three above.  Try this:  with the Vera hi open , open a new browser tab (not a new window) and display your google calendar (did u have to log in?) - leave the calendar tab open,  go back to the Vera tab and press F5. Does the calendar tab now work ?

If not let's see what you input when setting your calendar if. It's possible it's not being parsed out correctly.
No I did not need to login to see my google calendar and refreshing does not help calendar tab just shows "ERROR:No data7"

Calander ID is
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on September 30, 2016, 01:58:44 pm
@baxy_AU
I'm curious where you are reading that CalendarID from.   If that is what you are entering into the CalendarID on the control tab ?  it's not the right format.  There is no http ..... so it cannot work in the calendar tab.
Please review the first post and the documentation on how / where to get a correct CalendarID and then set it again and let's see what's happening.
Title: Re: GCAL3 - Version 2.5
Post by: baxy_AU on October 01, 2016, 06:10:44 am
OK so I read the instructions properly and used the correct id and everything is working, thanks
Title: GCAL3 - Version 2.6a
Post by: Stuart on October 05, 2016, 03:34:40 pm
This has a small change to V2.5 for users of UI7.  In UI5 GCal3 has a dependency on the module "json.lua" (used to encode / decode json strings).  In UI7, vera provides a file "dkjson.lua" which does the same thing so GCal3 deletes the file "json.lua" at startup to save space.

Some users were having problems because of plugins that have not been updated to use "dkjson.lua".

This version of GCal3 still deletes "json.lua" but adds a symbolic link so that plugins looking for it will find "dkjson.lua" instead, and continue to work.

The attached file (R2.6a) has this patch and will be part of the next marketplace release.  It can be applied over R2.5.
Title: Re: GCAL3 - Version 2.5
Post by: gzappala on October 12, 2016, 03:05:08 am
@Stuart

Hi, I installed your plugin today, also downloaded GCal3.lua and uploaded it to my system.  I'm on UI7 running on VeraPlus.

I entered the URL for my calendar ID and set my calendar, did not enter a credentials file (don't know what goes there), but I am able to see my calendar and any updates to it with no problem. 

My question is: When I set up a scene to be triggered ONLY for a matched keyword or a specific event name, the scene actions are always triggered even when no keyword is matched or no events exist with the specified name.  To set up the keyword match, I had to use AltUI because UI7 does not allow me to enter a keyword to match in the trigger section of the scene creation.  Still, the actions in the scene are triggered when nothing matches.

I'm sure I'm doing something stupid, but I can't figure it out.  Any help will be greatly appreciated.

UPDATE:  I did some more digging and figured out how to create the Credentials File.  I followed the instructions, reconfigured the plugin with the calendarId AND the credentials file (which I renamed GCal3.json).   I've confirmed that I can access the calendar when I'm no longer logged in to Google (I'm able to see my test events).

Two things: 

1. The Calendar Tab no longer works even after uploading GCal3.lua
2. I can't get the scenes to match keywords or event names - Scene actions are still triggered regardless of what's in the calendar.

Any ideas?

UPDATE2:  I figured out the scenes issue.  My scenes are now working.

I still need help with the Calendar Tab not showing my calendar.  Thanks in advance!
Title: Re: GCAL3 - Version 2.5
Post by: fabstar81 on October 12, 2016, 03:59:01 am
I assume you are referring to the tab that shows {or not} the calendar from Google. This only worked for me once. Thus, remove.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on October 12, 2016, 11:21:44 am
See this post
http://forum.micasaverde.com/index.php?topic=26692.msg294638#msg294638

The most common reason (assuming a correctly entered CalendarID) for not seeing a calendar in the tab is this:
The calendar tab is "dumb" - it's just a link to your calendar and does NOT attempt to log in.  For the calendar tab to work - your browser needs to be logged in to google.   If you cannot see your calendar from your browser (i.e. in a independently of vera) without having to log in - then it will not show up in the calendar tab.

This is sometimes confusing.  The calendar tab is there for historic reasons (it was in the original version of GCal that I took over - at a time when the google credentials were not needed) and as a quick check to see if the CalendarID is correct.

Frankly - I'm strongly considering removing it in the next formal release as (1) it causes concern and (2) it's not really needed any more as there is a lot of debugging in the logs to indicate a bad CalendarID.  I mentioned that I might remove the calendar tab in a post some time back and have not heard anyone say "oh no - please don't take the tab away"  >:(

Title: Re: GCAL3 - Version 2.5
Post by: korttoma on October 12, 2016, 01:28:28 pm
Feel free to remove the calendar tab. I never used it and it does not bring any value to the plugin.
Title: Re: GCAL3 - Version 2.5
Post by: gzappala on October 13, 2016, 02:07:20 am
@Stuart

Thank you... I agree... no 'real' need to have the calendar tab (except for convenience).  As long as it's known that it will only populate when browser logged into Google, it's a 'nice to have' feature.

Thank you for your help and for all the hard work on the plugin!!
Title: Re: GCAL3 - Version 2.5
Post by: gzappala on October 15, 2016, 12:14:27 am
@Stuart

Sorry to bug again...

I need to check my Calendar settings in luua code, but I can't get the GCalCheck function to work.  Besides my calendar ID, I'm guessing I also need the credentials file info.  How do I construct the values passed to that function?  I tried just my calID, but it obviously does not work.

here's what I have so far:

luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck", {"CalendarId from the json file"} )

What am I missing?
Title: Re: GCAL3 - Version 2.5
Post by: jswim788 on October 16, 2016, 08:22:03 pm
Is there any issue with 2 different Google calendars?  I would like to use more than 1 family member's Google calendar to schedule some events.  Is this a problem?  Seems like it should be okay, but I thought I'd check before I get too far into it.
Title: Re: GCAL3 - Version 2.5
Post by: korttoma on October 17, 2016, 12:29:08 am
@jswim788 I think all you need to do is to create another GCAL3 Device. You can do this if you go to -> Apps -> My Apps -> Google Calendar 3 "Details" and use the button "Create another".
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on October 17, 2016, 01:10:22 am
@Stuart

Sorry to bug again...

I need to check my Calendar settings in luua code, but I can't get the GCalCheck function to work.  Besides my calendar ID, I'm guessing I also need the credentials file info.  How do I construct the values passed to that function?  I tried just my calID, but it obviously does not work.

here's what I have so far:

luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck", {"CalendarId from the json file"} )

What am I missing?

What are you trying to achieve?  GCalCheck should not normally be needed to be called by Luup code.
It would only return true or false anyway as it just tells GCal3 to update itself (which it does anyway)
Title: Re: GCAL3 - Version 2.5
Post by: gzappala on October 17, 2016, 11:00:43 am
@Stuart

Sorry to bug again...

I need to check my Calendar settings in luua code, but I can't get the GCalCheck function to work.  Besides my calendar ID, I'm guessing I also need the credentials file info.  How do I construct the values passed to that function?  I tried just my calID, but it obviously does not work.

here's what I have so far:

luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck", {"CalendarId from the json file"} )

What am I missing?

What are you trying to achieve?  GCalCheck should not normally be needed to be called by Luup code.
It would only return true or false anyway as it just tells GCal3 to update itself (which it does anyway)

Hi, I was merely trying to 'update' the contents of gc_jsonEvents when a particular scene runs to make sure I have the latest calendar info.  I don't want certain scenes to depend on the last time GCal3 checked the calendar based on its interval and I was also trying to avoid setting this interval to something too small.  So I thought to try executing a calendar 'check' using Luup code and I thought this was the method that did that.  Please point me in the right direction.

Thank you again!
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on October 17, 2016, 12:28:51 pm
@Stuart

Sorry to bug again...

I need to check my Calendar settings in luua code, but I can't get the GCalCheck function to work.  Besides my calendar ID, I'm guessing I also need the credentials file info.  How do I construct the values passed to that function?  I tried just my calID, but it obviously does not work.

here's what I have so far:

luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck", {"CalendarId from the json file"} )

What am I missing?

What are you trying to achieve?  GCalCheck should not normally be needed to be called by Luup code.
It would only return true or false anyway as it just tells GCal3 to update itself (which it does anyway)

Hi, I was merely trying to 'update' the contents of gc_jsonEvents when a particular scene runs to make sure I have the latest calendar info.  I don't want certain scenes to depend on the last time GCal3 checked the calendar based on its interval and I was also trying to avoid setting this interval to something too small.  So I thought to try executing a calendar 'check' using Luup code and I thought this was the method that did that.  Please point me in the right direction.

Thank you again!

So several things to note:
1)  There are some delays between issuing the GCalCheck action and when the calendar actually updates (built in delays, google response times, retries, the action occuring while GCal is doing something).  This could be 15 sec or more but in any case is at least a second or so.  So you probably need to put the Luup call in the "immediate" part of the scene and perform the actions that require the potentially updated info in a "delay" portion of the scene (say a minute later to be sure).

2)  The GCalCheck action always succeeds (i.e. returns true) since any errors are handled by other called functions.  It does not require any input parameters (or credentials).  So you need something like this:

local _, _, _, _ = luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck",{},<your device ID> )

Your original code did not specify a device number for the plugin instance you are trying to communicate with
Title: Re: GCAL3 - Version 2.5
Post by: fabstar81 on October 18, 2016, 08:19:36 am
maybe this is something really weird, or i am just doing something wrong.

what i want:
i have a scene switching half of my garden lights on every night.
i want the Gcal plugin to switch the other half of my lights on, whenever an appointment occurs which has the word "here", also, only in night mode -> hence why else would you lighten up your lights when it's not dark :)

for example:
"John and Monica here", planned from 20:00 o'clock to whatever end time

assuming it is already dark at 20 o'clock, i expect half of my lights to switch on at 20, because of the Gcal plugin.

what i did:
i made a scene with a trigger:
Device Trigger
GCal3 Sensor has event with name: here

plus another trigger:
Device Trigger
GCal3 Sensor: Tripped

because the first one alone, was not sufficient. nothing works however. both triggers alone, in any combo, nothing. the lights won't switch on.

as device actions i have to immediately switch on the specific lighting, in home modes HOME and NIGHT (Home was used for testing).

What am i doing wrong? this device just won't trigger.

side note: whenever an appointment in the near future is not present, i get messages like "GCal3.sem Could not Open" a lot.
BTW: i use version 1.3:
App id:7016
Current Version:1.3
Latest VersionN/A
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on October 18, 2016, 10:05:48 am
@fabstar81

I assume you are using two scenes - the first to turn 1/2 the lights on and off normally, the second to selectively turn on the other half.

On the question of triggering the second scene - you don't want to use two triggers as they are mutually exclusive.  You want to use just one
Set the keyword to "here" (no quotes)  and set gc_exactKeyword to false.  That way the plugin will trigger whenever the event has the word here, somewhere in the event (or description name).   Or you could add something unique like "lights on" in the description, leave the keyword blank and use GCal3 Sensor has event with name: lights on.  Note that gc_exactKeyword is ignored when using the event with name approach.

As to the "GCal3.sem Could not Open". Version 1.3 is over 3 years old - and whatever problem that is has been fixed, in fact GCal3.sem is no longer used.  You will need to upgrade to the latest release if you need troubleshooting help.  Also my comments above (on triggering etc) assume there is no problem in V1.3.
Title: Re: GCAL3 - Version 2.5
Post by: fabstar81 on October 18, 2016, 10:17:37 am
thanks stuart, i set the gc_Keyword to "here" in the variables, set gc_EcactKeyword to "false" and deleted one trigger of the scene. i now only have configured as a trigger in the scene: Gsensor gets tripped. assuming this is handled by the variables i just changed.

i will update tomorrow, i thought i used the one that is present in the apps list. how do i upgrade now? where do i find the correct files? should i delete the old version through front end first?
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on October 18, 2016, 10:27:39 am
thanks stuart, i set the gc_Keyword to "here" in the variables, set gc_EcactKeyword to "false" and deleted one trigger of the scene. i now only have configured as a trigger in the scene: Gsensor gets tripped. assuming this is handled by the variables i just changed.

i will update tomorrow, i thought i used the one that is present in the apps list. how do i upgrade now? where do i find the correct files? should i delete the old version through front end first?

To upgrade:
Keep a note of the main settings in the variables tab.
Delete the existing plugin(s) -- this is important especially from old releases.
Reboot
Follow the install instructions (closely) for R2.5  that are in the first post of this thread - installing from the marketplace is easiest.
Title: Re: GCAL3 - Version 2.5
Post by: gzappala on October 18, 2016, 09:32:36 pm
@Stuart

Sorry to bug again...

I need to check my Calendar settings in luua code, but I can't get the GCalCheck function to work.  Besides my calendar ID, I'm guessing I also need the credentials file info.  How do I construct the values passed to that function?  I tried just my calID, but it obviously does not work.

here's what I have so far:

luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck", {"CalendarId from the json file"} )

What am I missing?

What are you trying to achieve?  GCalCheck should not normally be needed to be called by Luup code.
It would only return true or false anyway as it just tells GCal3 to update itself (which it does anyway)

Hi, I was merely trying to 'update' the contents of gc_jsonEvents when a particular scene runs to make sure I have the latest calendar info.  I don't want certain scenes to depend on the last time GCal3 checked the calendar based on its interval and I was also trying to avoid setting this interval to something too small.  So I thought to try executing a calendar 'check' using Luup code and I thought this was the method that did that.  Please point me in the right direction.

Thank you again!

So several things to note:
1)  There are some delays between issuing the GCalCheck action and when the calendar actually updates (built in delays, google response times, retries, the action occuring while GCal is doing something).  This could be 15 sec or more but in any case is at least a second or so.  So you probably need to put the Luup call in the "immediate" part of the scene and perform the actions that require the potentially updated info in a "delay" portion of the scene (say a minute later to be sure).

2)  The GCalCheck action always succeeds (i.e. returns true) since any errors are handled by other called functions.  It does not require any input parameters (or credentials).  So you need something like this:

local _, _, _, _ = luup.call_action("urn:srs-com:serviceId:GCalIII","GCalCheck",{},<your device ID> )

Your original code did not specify a device number for the plugin instance you are trying to communicate with

@Stuart

I've successfully implemented the solution with your help.  Thank you so much!
Title: Re: GCAL3 - Version 2.5
Post by: fabstar81 on October 19, 2016, 07:36:04 am
thanks stuart, i set the gc_Keyword to "here" in the variables, set gc_EcactKeyword to "false" and deleted one trigger of the scene. i now only have configured as a trigger in the scene: Gsensor gets tripped. assuming this is handled by the variables i just changed.

i will update tomorrow, i thought i used the one that is present in the apps list. how do i upgrade now? where do i find the correct files? should i delete the old version through front end first?

To upgrade:
Keep a note of the main settings in the variables tab.
Delete the existing plugin(s) -- this is important especially from old releases.
Reboot
Follow the install instructions (closely) for R2.5  that are in the first post of this thread - installing from the marketplace is easiest.

hi Stuart, i did what you described above. uninstalled the old plugin and installed the new one. i had already made a google services accuont for your previous version of the plugin so i tried using that one and the downloaded json file.

calender ID is set from the <iframe> tags and the plugin approves this too. "Calendar ID is set" shows the plugin. however, the credential file seems to be making some problems. when being disarmed the plugin says: Not a Service Account. When arming the plugin it says "Fatal Calendar Error".

when pressing the calendar tab however, it does show the calendar in full detail.

when comparing my json file and your testfile, i see a great difference in the available tags in your json file that are missing in mine. perhaps that is the problem...

dont know how to proceed now because i think everything works because i can see the calendar.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on October 19, 2016, 09:04:04 am
@fabstar81 --

Seeing the calendar really only validates that the CalendarID points where it should.  It does not validate the credentials file.

First step:  Try the test credentials file and the test CalendarID to make sure you have a clean instal.  If that works then we know the plugin was successfully installed.

Next: - go back to google console and get a new credentials file and try that with the associated calendar id.
Title: Re: GCAL3 - Version 2.5
Post by: jswim788 on November 02, 2016, 05:45:00 pm
Shouldn't these lines be 'grep -i', not '-i grep' in GCal3.lua?

Code: [Select]
      local Distro = ""
      if osExecute("cat /etc/*release | grep -i OpenWrt") == 0 then
        Distro = "OPENWRT"
      elseif osExecute("cat /etc/*release | -i grep Debian") == 0 then
        Distro = "DEBIAN"
      elseif osExecute("cat /etc/*release | -i grep Suse") == 0 then
        Distro = "SUSE"
      elseif osExecute("cat /etc/*release | -i grep Ubuntu") == 0 then
        Distro = "UBUNTU"
      elseif osExecute("cat /etc/*release | -i grep Raspbian") == 0 then
        Distro = "RASPBIAN"
      else
        Distro = "Unknown"
      en

Not sure that this will make any functional difference...
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on November 02, 2016, 07:54:49 pm
@jswim788 --

Good catch !!   You are right though, the typo will not make any functional difference.  I put it in there for some future proofing.  I'll fix it now and it will at least not embarrass me in the future -- although something else will for sure.
Title: Re: GCAL3 - Version 2.5
Post by: jswim788 on November 03, 2016, 12:28:26 pm
Is it likely that GCal3 will work on Raspbian?  Is it untested?  Or known not to work?  Thanks.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on November 03, 2016, 02:29:38 pm
Is it likely that GCal3 will work on Raspbian?  Is it untested?  Or known not to work?  Thanks.

Some folks are running openLuup and that may not be on OpenWRT - which is the vera distro.  So I put tests in there as a way of using (or not) certain commands during the startup sequence.  So far there is only one .....

Code: [Select]
          if Distro == "OPENWRT" then
            result = osExecute ("/bin/opkg update && opkg install openssl-util")
          else
            result = 0
          end

i.e. don't try to use opkg if you are on (say) Debian.

If openLuup (or some other Lua based variant) is available on Raspbian then "maybe" GCal3 code can be re-purposed (likely with some fiddling).  But GCal as it stands is Vera only.
   
Title: Re: GCAL3 - Version 2.5
Post by: CudaNet on November 03, 2016, 04:42:31 pm
It does indeed work. Stuart was kind enough to put a check in so GCal could operate within an openLuup environment without halting on startup. The requirements are that you have all the necessary modules loaded and this is our problem not Stuart's. If you're using one of my turn-key installs then I have pretty much everything loaded to run most plugins (e.g. GCal, Sonos etc.)

Is it likely that GCal3 will work on Raspbian?  Is it untested?  Or known not to work?  Thanks.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on November 03, 2016, 06:40:14 pm
@ CudaNet --

Over winter I'll try OpenLuup on my Pi.  Just have to find a day where skiing sucks (is there such a thing ?) and other projects are under control (is there such a thing?)
Title: Re: GCAL3 - Version 2.5
Post by: CudaNet on November 03, 2016, 06:56:12 pm
No (awesomeness will always come 1st) and No (there's always another project to take crazy's place) !
Disclaimer: Once you try openLuup/AltUI you may never return to V3ra again. With the addition of a Razberry Z-Wave board and remote management (via Remot3.it), things have never been better.

@ CudaNet --

Over winter I'll try OpenLuup on my Pi.  Just have to find a day where skiing sucks (is there such a thing ?) and other projects are under control (is there such a thing?)
Title: Re: GCAL3 - Version 2.4
Post by: clippermiami on November 05, 2016, 10:26:53 am
I'm currently running GCal 2.4 on a Vera Plus and it was working fine UNTIL I did a firmware update to 1.7.2138. Along with losing track of my KwikSet door lock, GCal has stopped working, complaining of no Credentials file. I recreated the file and uploaded the new one via "Develop Apps" and it still claims its not there despite the fact that i can search for it and it is.

And I tried forcing an update to 2.5 (http:<ip addre>:3840/ and so on) but it stayed on 2.4.

The joys of Vera.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on November 06, 2016, 11:09:49 pm
I'm on 1.7.2139.  Try putting the name of the credentials file in again.

Title: Re: GCAL3 - Version 2.5
Post by: clippermiami on November 07, 2016, 06:37:52 am
I'm on 1.7.2139.  Try putting the name of the credentials file in again.

I've entered the name a half dozen times now. Each time it says "reboot" and when it comes up it still says no credentials file. I'm still on 1.7.2138 on this VeraPlus but I'm thinking about going back to 2044.

I fell back to 2044 on my primary VeraPlus because I lost my Kwikset lock  and a bunch of fibaro sensors --- on that VeraPlus the lock recovered the sensors no so much :)
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on November 07, 2016, 09:59:40 am
@clippermiami --

Let me make a couple of statements for those newer members that may happen upon this post  (you will recognize these statements  ??? ).

1.  The upgrade of vera firmware should not break anything but .....
2.  When I upgraded, I had no problems and know of no reason why GCal should break but .......
3.  (Not so obvious)  release 2.4 has not been in the marketplace for about 6 weeks so it should not show up when you execute the following (to force an upgrade) but .......  http://<your vera ip>:3480/data_request?id=update_plugin&Plugin=7016

So something is not happy (clearly).

Try again - following the upgrade instructions here:
http://forum.micasaverde.com/index.php/topic,26692.msg294527.html#msg294527

If R2.5 does not show up then retry the steps above but instead of installing from the marketplace try asking for the specific version
http://<your vera IP>:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=7016&Version=32216

If none of this works - lets get a log file with gc_debug set to 3



Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 10, 2016, 11:58:46 pm
I'm running a Veralite on UI5 and am trying to install gcal3.  Install went okay and I see the calendar appear on the Google Calendar device.  However, I keep getting a missing access_token error.  If I clicke the "check" button I get Fatal Calendar Error.

Any help would be appreciated.

Here's what I'm seeing:

ice_Variable::m_szValue_set device: 114 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEvent was: CalendarID is set now: Setting Credential File #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f373680>
06   12/10/16 23:50:40.920   Device_Variable::m_szValue_set device: 114 service: urn:srs-com:serviceId:GCalIII variable: gc_NextEventTime was: missing access_token now: Restarting ..... #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f373680>
01   12/10/16 23:50:40.921   LuaInterface::CallFunction_Job device 114 function SGCal3_GCalIII_SetCredentialFile_run failed [string "-- Google Calendar Plugin..."]:2345: attempt to call field 'reload' (a nil value) <0x2f373680>
02   12/10/16 23:50:50.101   ZWJob_GetNodeDetails::ZWJob_GetNodeDetails skipping return_route for 46 2/1/-1 job job#37 :getnodedetails_ri_poll 46 dev:47 (0x1f60bd8) P:50 S:0 <0x2b51f680>
06   12/10/16 23:50:50.168   Device_Variable::m_szValue_set device: 47 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: LastRouteUpdate was: 1481388643 now: 1481431850 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2b71f680>
06   12/10/16 23:50:50.169   Device_Variable::m_szValue_set device: 47 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Neighbors was: 1,63,81,85,88,89,92,94,95,99,100,102,114,117, now: 1,63,81,85,88,89,92,94,95,99,100,102,114,117, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2b71f680>
04   12/10/16 23:50:50.170    <0x2b71f680>
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 11, 2016, 07:32:56 pm
@ MikeQ

Double check that you have followed the steps here:
http://forum.micasaverde.com/index.php/topic,26692.msg294527.html#msg294527

Try the Calendar Id and the Credentials file from the first post to verify that all is well.

Based on the log- it looks like your Credentials file is incorrect (you can ignore the log message that complains about 'reload' as UI5 does not have that call.
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 13, 2016, 09:26:49 am
Thanks. Been busy since the post.  I'll take a look tonight.
Title: Re: GCAL3 - Version 2.5
Post by: Ronald on December 14, 2016, 03:57:30 pm
I really love using GCAL3. Great app. I am using it in UI5 on a Vera 3
Trouble is though that scenes that are triggered by GCAL3 'armed and tripped' will also trip after a Vera3 reboot.

Is there a way to prevent it from doing so, to detect that it is not the start of GCAL 'armed and tripped' but only a reboot causing it?

Thanks for any help!
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 16, 2016, 07:53:51 pm
@ MikeQ

Double check that you have followed the steps here:
http://forum.micasaverde.com/index.php/topic,26692.msg294527.html#msg294527

Try the Calendar Id and the Credentials file from the first post to verify that all is well.

Based on the log- it looks like your Credentials file is incorrect (you can ignore the log message that complains about 'reload' as UI5 does not have that call.

Getting the same results from the test Calendar.  I uninstalled and re-installed the plugin and started from scratch with the test calendar.

I get the same "missing access_token" error.

edit:  FYI, when I go to the Calendar tab, the test calendar shows but there's a banner across the top that says:

"Events from one or more calendars could not be shown here because you do not have the permission to view them."

When I point to my Calendar, I don't get this error and I see the whole Calendar and all the events.  However, I still get the missing access_token.

Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 17, 2016, 05:21:00 pm
@ MikeQ

Double check that you have followed the steps here:
http://forum.micasaverde.com/index.php/topic,26692.msg294527.html#msg294527

Try the Calendar Id and the Credentials file from the first post to verify that all is well.

Based on the log- it looks like your Credentials file is incorrect (you can ignore the log message that complains about 'reload' as UI5 does not have that call.

Getting the same results from the test Calendar.  I uninstalled and re-installed the plugin and started from scratch with the test calendar.

I get the same "missing access_token" error.

edit:  FYI, when I go to the Calendar tab, the test calendar shows but there's a banner across the top that says:

"Events from one or more calendars could not be shown here because you do not have the permission to view them."

When I point to my Calendar, I don't get this error and I see the whole Calendar and all the events.  However, I still get the missing access_token.

The fact that you can see the calendar in the tab is, in this case, incidental.  It just confirms that the you have a valid CalendarID.  The missing access token is likely due to a bad credential file. 

Please set gc_debug=3 and post a copy of the log file you get when you
try re-running by first re-setting and making sure the Credential file is set to GCal3Test.json



Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 17, 2016, 05:29:24 pm
I really love using GCAL3. Great app. I am using it in UI5 on a Vera 3
Trouble is though that scenes that are triggered by GCAL3 'armed and tripped' will also trip after a Vera3 reboot.

Is there a way to prevent it from doing so, to detect that it is not the start of GCAL 'armed and tripped' but only a reboot causing it?

Thanks for any help!

Possibly - but that would not be everyone's preferred behavior and would not necessarily apply to all events / scenes / devices.

You may be better off using PLEG and setting up a states so that transitions occur only due to specific input transitions.

What specific scenario do you have in mind.
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 18, 2016, 08:04:54 pm
@ MikeQ

Double check that you have followed the steps here:
http://forum.micasaverde.com/index.php/topic,26692.msg294527.html#msg294527

Try the Calendar Id and the Credentials file from the first post to verify that all is well.

Based on the log- it looks like your Credentials file is incorrect (you can ignore the log message that complains about 'reload' as UI5 does not have that call.

Getting the same results from the test Calendar.  I uninstalled and re-installed the plugin and started from scratch with the test calendar.

I get the same "missing access_token" error.

edit:  FYI, when I go to the Calendar tab, the test calendar shows but there's a banner across the top that says:

"Events from one or more calendars could not be shown here because you do not have the permission to view them."

When I point to my Calendar, I don't get this error and I see the whole Calendar and all the events.  However, I still get the missing access_token.

The fact that you can see the calendar in the tab is, in this case, incidental.  It just confirms that the you have a valid CalendarID.  The missing access token is likely due to a bad credential file. 

Please set gc_debug=3 and post a copy of the log file you get when you
try re-running by first re-setting and making sure the Credential file is set to GCal3Test.json

Is there a log file created or does gc_debug=3 just spew more stuff to the cgi-bin/cmh/log.sh?Device=LuaUPnP log?

I see some log files showing up on the page where you can upload files but they have old data in them.

Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 19, 2016, 03:17:02 pm
@ Mike Q

This error occurs when an non-valid token (has an error) is returned by google.

This could be a network error or some issue with vera (missing the curl command ??).  I'm grasping at straws here since I've never seen this error in testing.  What you see on the UI is the last error message - a log file will tell us what's happened before.

To get a log file can use the log function in GCal3 described here:

http://forum.micasaverde.com/index.php/topic,26692.msg276087.html#msg276087
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 19, 2016, 06:03:05 pm
log attached.

Don't know if this is an issue but on the control tab I see "Calendar ID is set" and "missing access_token".  After hitting "get log"  it then says "Calendar ID is not set" and "Fatal Calendar Error".  Hitting reload puts me back to "Calendar ID is set" and "missing access_token"
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 19, 2016, 08:31:13 pm
log attached.

Don't know if this is an issue but on the control tab I see "Calendar ID is set" and "missing access_token".  After hitting "get log"  it then says "Calendar ID is not set" and "Fatal Calendar Error".  Hitting reload puts me back to "Calendar ID is set" and "missing access_token"

The code attempts to make a request to the linux application called curl.   This call is returning nothing at all - not even an error (so it looks like it's not even making contact with google).  It's possible that curl is missing missing from your vera (or not in the path).  You should check that first.

Log into your vera using putty (or similar) and run the following and lets see what's up ..

find / -name curl
echo $PATH
 
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 20, 2016, 04:59:07 pm
Seems like it's there:


root@MiOS_35006465:~# which curl
/usr/bin/curl
root@MiOS_35006465:~# echo $PATH
/bin:/sbin:/usr/bin:/usr/sbin

root@MiOS_35006465:~# curl --version
curl 7.38.0 (mipsel-openwrt-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1l zlib/1.2.5
Protocols: file ftp ftps http https imap imaps pop3 pop3s rtsp smtp smtps tftp
Features: IPv6 NTLM NTLM_WB SSL libz TLS-SRP


I tried pasting the curl command from the log into the shell but it's too long.  I made a shell script and ran it instead.  I get an error:

root@MiOS_35006465:~# ./tst
{
  "error" : "invalid_grant",
  "error_description" : "Invalid JWT: Token must be a short-lived token and in a reasonable timeframe"
}root@MiOS_35006465:~#
root@MiOS_35006465:~#

Title: Re: GCAL3 - Version 2.5
Post by: Greybeardvacationrental on December 21, 2016, 03:09:23 am
Hello,  I just noticed this plugin and am trying to set it up as it may come in handy.  I followed the install instructions and everything goes well until I try to paste the credential file I got from service account key on my google calendar.  I paste it in the field and then hit the set button.  Sometimes nothing happens and other times the entire text pastes itself over everything in that area and does nothing.  I did get the ID to set although the options for putting it in bypass mode are gone. 

(BTW #3 in the heading post of this thread says "Change the GCal3Test.json into the Credential File field and Press "Set" and I think it was meant to be Paste.)

Any help would be greatly appreciated!
Title: Re: GCAL3 - Version 2.5
Post by: korttoma on December 21, 2016, 03:19:25 am
I think you should past the name of your credentials file that you have uploaded to the Vera device. I use the name "GCal3.json" name for my file.
Title: Re: GCAL3 - Version 2.5
Post by: Greybeardvacationrental on December 21, 2016, 03:41:24 am
Ohhhh thanks.  That was confusing.  So I guess #3 should say something like TYPE "GCal3.json" into the credentials field.  I'm wondering if #4 shouldn't come before #3 then?   In any case.  That did it.  And now to play but initially it may not do what I was hoping.  First of all my google calendar is set to month view but the calendar in Vera is showing me daily?  And how I have it now is that when I book my vaca rental on either Airbnb or VRBO those bookings go into my google calendar but I think because my google calendar is "accessing" those other other calendars for information the plug in doesn't recognize those.  Not sure I want to duplicate the events around the 3 calendars because of errors.  Was hoping it would see my google calendar the way I see it but I get it.  Will play with it some. 

Thanks for your help!
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 21, 2016, 05:20:34 pm
Thanks guys -- I've fixed the wording (and order) of the test instructions on the first post.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 21, 2016, 05:34:38 pm
Ohhhh thanks.  That was confusing.  So I guess #3 should say something like TYPE "GCal3.json" into the credentials field.  I'm wondering if #4 shouldn't come before #3 then?   In any case.  That did it.  And now to play but initially it may not do what I was hoping.  First of all my google calendar is set to month view but the calendar in Vera is showing me daily?  And how I have it now is that when I book my vaca rental on either Airbnb or VRBO those bookings go into my google calendar but I think because my google calendar is "accessing" those other other calendars for information the plug in doesn't recognize those.  Not sure I want to duplicate the events around the 3 calendars because of errors.  Was hoping it would see my google calendar the way I see it but I get it.  Will play with it some. 

Thanks for your help!

GCal3 does not care how you display your calendar and the display in the plugin is just informational.

It depends on how google calendar is accessing / representing your Airbnb and VRBO entries.  i.e. whether it creats "real" google events (that get returned to GCal from google) or whether google is just displaying those other calendar events on your behalf.
Title: Re: GCAL3 - Version 2.5
Post by: Greybeardvacationrental on December 21, 2016, 07:03:31 pm
Yeah the way it works is you can share the VRBO calendar with the Google Calendar but they aren't "events" on the google calendar.  They just are informational.  So they don't show up on GCal3 as I'm assuming it's looking for "events" and can not see other information from shared calendars elsewhere.  I tried to add the vrbo calendar and although I could add the ID it of course ran into issues with the credentials. 

So I think if it does what I hope it can I can go into my google calendar and just mirror the reservation information coming from AirBnb and VRBO by creating a simple event.  I'll have two lines for everything on my google calendar but I can live with that.  I still am not able to get the google calendar to show in month format, only daily even though I have the default for the calendar set at month.

Now that I have an idea of what information it is and isn't looking at I now have to try to figure out how the triggers work.  My goal would be for the calendar event to trigger one of my Modes.  So for instance.  I enter an "event" called Res on my calendar for the dates of an upcoming reservation.  On that day then I'd like the calendar to trigger the mode "HOME" which will set different lights and things while the guest is staying at the property.  And when they check out I would like to Trigger the "AWAY" mode which has different light and temp scenes.  This would be amazing but haven't gotten that far yet to see if a calendar event can trigger a mode.

The potential for controls like this in the vacation rental market is quite huge especially if it could just integrate AirBnB and VRBO calendar events as you make them on those websites.  HUGE.  For now... I am just enjoying seeing how I can make things work!  Great job developer.   
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 21, 2016, 10:42:41 pm
Hi Stuart,

Any ideas on my issue?

Thanks,

Mike
Title: Re: GCAL3 - Version 2.5
Post by: Greybeardvacationrental on December 22, 2016, 12:23:44 am
Update.  So I've done a few tests and it seems to be working perfectly.   For simplicity sake, after I make a reservation on the VR sites I just will go to the google calendar and since I can see the information from the VR calendars (even though they aren't actually google events) I just create the simple events of "IN" "OUT" or "Turn" (for turnover, in and out the same day).  I then used the HOUSE MODES PLUGIN and then set the triggers from Gcal3 for IN, OUT and TURN which will then trigger the mode I want. 

It's one extra step but honestly....  not having to babysit the UI to change my modes based on when people check in and out is well worth it.  This will be fun to see how effective it will be.  The other nice thing is once I set everything I can have the scene notify me by text that it's check in day or check out day or turn over day and therefore I won't have to constantly baby sit a calendar. 

THIS IS AUTOMATION.  Thanks Stuart. 
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 22, 2016, 11:42:26 am
Hi Stuart,

Any ideas on my issue?

Thanks,

Mike

Kinda --
The problem is either:
 a badly formed credentials file (unlikely seeing you are using the test file)
curl or a network problem (most likely)
or the json decode module (less likely since a known good module is being downloaded)

I'm working on getting some additional info from curl - it's not obvious

P.S. The error you got just running the curl command directly was to be expected since token requests include an embedded time element - and the request from the log file was in the past.


Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 22, 2016, 12:41:31 pm
@ Mike

Try this version -- it's just got some additional logging, but should give some clues.  Will need a log file after a REBOOT -- not just a reload
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 22, 2016, 08:20:18 pm
I'm not getting any new log files and when I restart or reload, I get: "GCal3 Sensor[158] : Startup Lua Failed"
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 22, 2016, 09:17:31 pm
Ok, found the issue with the "Startup Lua Failed".   Had to add the bold part.  the code is nil and was being concatenated to the error message.  Still don't see why the code is coming back nil though.

 local token, code = curl_get(request)
  DEBUG(3, "curl code: " .. tostring(code))
 
  if (code ~= 200) then -- anything other than 200 is an error
      local errorMessage = ""
      if (code == 404) then
        errorMessage = "Check Credentials: " .. code
      else
       if (code == nil) then
         errorMessage = "nil code"
       else
          errorMessage = "curl error code: " .. code
      end

      end
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 22, 2016, 09:50:35 pm
Strange, looking at the log it seems like the curl commands aren't doing anything. 

FROM THE LOG
***************************************

Command was: curl -ksL -w "%{http_code} %{url_effective}\n"  -X POST "https://accounts.google.com/o/oauth2/token" -d "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnY2FsdGVzdEBnY2FsLXRlc3QtMTIwMy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNjb3BlIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vYXV0aC9jYWxlbmRhciIsImF1ZCI6Imh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbS9vL29hdXRoMi90b2tlbiIsImV4cCI6MTQ4MjQ2Mzc2MSwgImlhdCI6MTQ4MjQ2MDE2MX0.PoPxpFjEcA9Ca0DH8P7BR_aJQgm6lMgCC9ao2su4ydE4Le1JPCUZ754q0Dz3XYyBeqzEyziRcDZ0RsaS2etlIMUkO1eFz1sLdjsPnvkmKL-idpWtVEje5LGQc_EqItKyA5T1uI4prgKQpGX_aDmf3IO0gKIXBg8AbmOEB2XqiepBCKDrX3pgeug5fbbNj7AEDus8PGG96SvNPddHNIk64BHJcaCwQrv_PGkjOBM6SACd4ydUPUrKJWRKZR1N5SCtTRV7DVEMr6ESg80D7_bm8AVi3iuoarNmVPA2Ajt2El012alH2l4QWCrPhRIPP2APoByrSlokF7a12SSzGH4W7Q" --header "Content-type: application/x-www-form-urlencoded" -o /dev/null <0x2c0e7680>
50   12/22/16 21:29:23.705   luup_log:158: GCal3 device: 158 - curl returned status:  <0x2c0e7680>
50   12/22/16 21:29:23.706   luup_log:158: GCal3 device: 158 - curl error code: nil <0x2c0e7680>
50   12/22/16 21:29:23.716   luup_log:158: GCal3 device: 158 - curl request error:  <0x2c0e7680>
50   12/22/16 21:29:23.717   luup_log:158: GCal3 device: 158 - curl code: nil <0x2c0e7680>

however, issuing the same command from the shell produces expected results:


FROM THE COMMAND LINE
**************************************

curl -ksL -w "%{http_code} %{url_effective}\n"  -X POST "https://accounts.google.com/o/oauth2/token" -d "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnY2FsdGVzdEBnY2FsLXRlc3QtMTIwMy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNjb3BlIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vYXV0aC9jYWxlbmRhciIsImF1ZCI6Imh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbS9vL29hdXRoMi90b2tlbiIsImV4cCI6MTQ4MjQ2Mzc2MSwgImlhdCI6MTQ4MjQ2MDE2MX0.PoPxpFjEcA9Ca0DH8P7BR_aJQgm6lMgCC9ao2su4ydE4Le1JPCUZ754q0Dz3XYyBeqzEyziRcDZ0RsaS2etlIMUkO1eFz1sLdjsPnvkmKL-idpWtVEje5LGQc_EqItKyA5T1uI4prgKQpGX_aDmf3IO0gKIXBg8AbmOEB2XqiepBCKDrX3pgeug5fbbNj7AEDus8PGG96SvNPddHNIk64BHJcaCwQrv_PGkjOBM6SACd4ydUPUrKJWRKZR1N5SCtTRV7DVEMr6ESg80D7_bm8AVi3iuoarNmVPA2Ajt2El012alH2l4QWCrPhRIPP2APoByrSlokF7a12SSzGH4W7Q" --header "Content-type: application/x-www-form-urlencoded" -o /dev/null

root@MiOS_35006465:~# ./tst
200 https://accounts.google.com/o/oauth2/token
root@MiOS_35006465:~#



Is the issue with os_command?

I'm printing out the result from stdout:read("*a") and the results don't look right.

50   12/22/16 21:55:09.827   luup_log:158: GCal3 device: 158 - local function: os_command <0x2bda3680>
50   12/22/16 21:55:09.828   luup_log:158: GCal3 device: 158 - Command was: curl -ksL -w "%{http_code} %{url_effective}n"  -X POST "https://accounts.google.com/o/oauth2/token" -d "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnY2FsdGVzdEBnY2FsLXRlc3QtMTIwMy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNjb3BlIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vYXV0aC9jYWxlbmRhciIsImF1ZCI6Imh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbS9vL29hdXRoMi90b2tlbiIsImV4cCI6MTQ4MjQ2NTMwNywgImlhdCI6MTQ4MjQ2MTcwN30.dT9RIILTufsAxF666UaLIgacpQtUw15SDlQrmQ_dfsSBdT1wVEC2i2PP6-EfjxLICLwduf_X3dOk7wY8NnFB0h_dNWDn4y4wPpJnuPZ5EZjnk0Q5x1AWDTVNYxQTezu0yUPRqHtSnhbrtTC8mTREkX4D9dQ3IMbQsxF1LNNTi8E-onUpCfMcQkjLSIv4wmgh-9OC94X5XFtNeRU8Bu8ciQCr0VsMglWVNVZKV1EzJtuOtoWB1pJwFzKPebo_tiwxJb4jEo1j4pVq2GMSc8vFG35riggRSko-pTbiU98Ouqs-2BOq_sqMmpOTHkX7c90ppcmBUX8II_I8__F53BoQvg" --header "Content-type: application/x-www-form-urlencoded" -o /dev/null <0x2bda3680>

50   12/22/16 21:55:09.986   luup_log:158: GCal3 device: 158 - Result Was:  <0x2bda3680>
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 23, 2016, 01:13:59 pm
@Mike --

Some progress -- kinda .....

Did you upgrade the packages on your vera?   The reason I ask was that the version of curl on my veralite (UI5) was 7.21.3 (factory levels as far as I know).  I noticed yours was 7.38.0 so I upgraded curl on my vera and  ........   have the same problem !!!!!

So now the question is why - and can anything be done about it .......   like downgrading curl ?

I'll let you know what I find out but given the time of year ....
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 23, 2016, 10:40:59 pm
Hi Stuart,

Interesting find.  I had done some testing today and found that this:

local command = "date"
local stdout = io.popen(command)
local result = stdout:read("*a")
luup.log("******** result =" .. result)

works correctly.  As you found, I suspected that it was either the length of the command or something with the curl itself. 

I recently tried to upgrade to UI7 and had way too many problems so I reverted back to UI5.  When I did, I reverted to the latest firmware for UI5.  That's also when I upgraded my GCAL3 plugin to the latest.  That's when everything broke.  Too many changes at once to figure out what was the cause.  I guess it was the revert to UI5.  I wonder if it would be possible to copy the curl command from your good setup to my setup without reverting the whole firmware.

Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 24, 2016, 12:46:40 am
@ mike
I'd say something is definitely wrong with the 7.38.0 version  of curl.

I rewrote the function that calls curl to to bypass the command length issue.  Works fine with 7.21.3 but fails with 7.38.0 on UI5 (veralite) BUT works with 7.38.0 on UI7 (vera edge).  Some of the curl dependencies on UI7 are at different levels.

On UI5 and curl 7.38.0 -- the best curl does is complain with error 2 - which is described as
"Very early initialization code failed. This is likely to be an internal error or problem, or a resource problem where something fundamental couldn't get done at init time."

Could be a bad compile ..... or wrong dependencies ..... or phase of the moon .....

Anyway try the this:

find / -name curl

and for each path get the version - with any luck /rom/usr/bin/curl --version should give 7.21.3.
If that's the case - try the attached file.  It explicitly uses /rom/usr/bin/curl

As an aside on UI7 /rom/usr/bin/curl is at 7.35.0 and works.

P.S. versions may be a bit different depending on the device hardware.
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 24, 2016, 01:09:19 am
All my curl versions are 7.38.0.   I'd upgraded this unit to UI7 and then downgraded back to UI5.  I wonder if that has anything to do with it.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 28, 2016, 07:56:22 pm
All my curl versions are 7.38.0.   I'd upgraded this unit to UI7 and then downgraded back to UI5.  I wonder if that has anything to do with it.

Mike --

I spent a lot of time looking at this.  The basic problem seems to be that some of the dependencies are screwed up.  Here is what my UI5 looks like after opkg install curl.  The /usr/bin/curl version no longer seems to work correctly.

Code: [Select]
root@MiOS_35004671:~# /rom/usr/bin/curl --version
curl 7.21.3 (mipsel-openwrt-linux-gnu) libcurl/7.21.3 OpenSSL/1.0.0d zlib/1.2.5

root@MiOS_35004671:~# /usr/bin/curl --version
curl 7.38.0 (mipsel-openwrt-linux-gnu) libcurl/7.21.3 OpenSSL/1.0.0d zlib/1.2.5

By comparison UI7 uses: curl 7.38.0 -- 7.38.0 libcurl -- zlib 1.2.8

In any case - I tried multiple ways of fixing curl and basically gave up.  Instead I changed the token request to use https.request (bypassing what looks like post length issue in this combination of curl).

I would have replaced all the curl calls (used for iCal) but the http(s).request mechanisms are a bit brain dead in that they will not follow redirects .....  I did restrict these to the /rom/usr/bin/curl version  but I suspect they may not work on your setup.  i.e. iCal calendars may not work.

Try this - it should work on your UI5.  Assuming I have not broken anything else along the way - this is the R2.6 candidate.

Edit:  Removed the attachment
Title: Re: GCAL3 - Version 2.5
Post by: powisquare on December 29, 2016, 11:21:52 am
Hi Stuart - have been getting on very nicely with calendar functionality so thought it high time to add another into the mix. Unfortunately I am getting a 404 error on the new calendar.. I have used the same credential file and settings as the working one. Do I need a new credential file perhaps?Attached are a log for both (Old Forge is working great).

Best wishes

PS They are on different Vera3 boxes
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 29, 2016, 11:47:48 am
Hi Stuart - have been getting on very nicely with calendar functionality so thought it high time to add another into the mix. Unfortunately I am getting a 404 error on the new calendar.. I have used the same credential file and settings as the working one. Do I need a new credential file perhaps?Attached are a log for both (Old Forge is working great).

Best wishes

PS They are on different Vera3 boxes

The same credential file can be used for more than one calendar BUT you must set the share permissions for the calendar to allow the client-email associated with the credentials file.   It's the same process as in the documentation.
Title: Re: GCAL3 - Version 2.5
Post by: powisquare on December 29, 2016, 12:28:30 pm
Thanks Stuart. It's one of those ical calendars from a 3rd party so I am unable to share it as such.

Edit - sorry should have posted on an earlier thread. Will do that now.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on December 29, 2016, 12:46:08 pm
@ powisquare

the calendar id you are using is a google calendar (same sharing rules apply)

https://www.googleapis.com/calendar/v3/calendars/< snip >%40import.calendar.google.com

but - as far as I know (have not tried recently and memory could be vague) there are two possibilities:
1) you sync between google and the iCal (i.e. create real google events)
2) you use the google calendar as a UI to display the iCal -- so these events will not show up as google events in GCal.

You could try entering the iCal url as the Calendar ID directly into GCal (assuming that calendar is public and does not require authorization).   It's a crap shoot though -- as only some iCal are recognized by GCal (too many possibilities to cover).

Another approach is to import the iCal into google (i.e. create real google events) from time-to-time
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on December 31, 2016, 06:18:24 pm
Hi Stuart,

It appears to be working.  I had an issue where after rebooting, it stopped working and the https requests were failing.  Turned out that after reboot, the green light on the unit was flashing.  Didn't notice because Vera is in another room.  After realizing this, I had to restore my last backup and re-install the GCal3 stuff again.  After that it appears to be working as expected.

Thanks for looking into the issue.

Mike
Title: error 403
Post by: aladur on January 08, 2017, 02:02:45 am
Hi Stuart,
after adding the plugin and setting up my calendar, I can see the calendar shown in the calendar tab. But in the Controll tab, the next event shows "Http error code: 403".
What might be the cause of this Problem? The calendar itself has all permission rights.
Thanks!
Title: Re: error 403
Post by: Stuart on January 08, 2017, 02:02:03 pm
Hi Stuart,
after adding the plugin and setting up my calendar, I can see the calendar shown in the calendar tab. But in the Controll tab, the next event shows "Http error code: 403".
What might be the cause of this Problem? The calendar itself has all permission rights.
Thanks!
The problem is likely permissions in the calendar or  credentials. First thing to do is use the test calendar and test credentials to make sure everything is working properly.  The try your calendar and credentials.
I realize you said permissions were good but when u try ur calendar again. Make sure you follow the instruction in the first post very carefully.  I'd say 9/10 people with issues like this "fat fingered" a step.  Google is unforgiving 😂 but pretty secure 😑🤐
Title: Re: GCAL3 - Version 2.5
Post by: aladur on January 10, 2017, 09:38:42 am
yeah, thanks!
Title: Re: GCAL3 - Version 2.5
Post by: mike Q on January 17, 2017, 12:21:16 am
Hi Stuart,

I found the source of my 7.38.0 version of Curl.  I ran into another broken plugin with my VeraLite.  On a whim I decided to go back to an early version of firmware.  I had upgraded to a non-public version that was suppose to support zwave+ under UI5.  Apparently it worked with some but not all devices.  It did not work for my device.

Anyway, I was on firmware 1.5.672 so I reverted to 1.5.622 and now my curl version is back to 7.21.3.

Thanks again for the help,

Mike
Title: Re: GCAL3 - Version 2.5
Post by: lawi75 on March 27, 2017, 04:02:51 am
Hi all,

Newbe question but I would like to create a scene that runs every morning and loops through the calendar of today and reads out in my Sonos system every happening... Just so we don't miss what is planned for the day...

Any tips?

BR.,
Lars

Title: Re: GCAL3 - Version 2.5
Post by: lawi75 on March 27, 2017, 08:26:37 am
Hi guys,

I'm now to luup coding and trying to parse some json on my Vera Edge...

But my code always fails here (have tried "dkjson" as well): local json = require("json")

How can I verify if/what json parser I have and if not where to find one to install?

Do I need to import json parser somehow when I'm testing luup code under develop apps??

---- From log ----
01   03/27/17 13:48:40.135   LuaInterface::LoadCode: [string "function oooallEvents()..."]:9: unexpected symbol near '�' <0x74e5a520>
25   03/27/17 13:48:40.135   Code:
1function oooallEvents()
2   local GCAL_SID = "urn:schemas-srs-com:device:GCal:3"
3   local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",lul_device)
4
5   if (jsonEvents == "[]") then -- equivalent of a nul so don't try
6      return
7   end
8
9   local json = require("json")
10   return
11end
---- From log ----

BR.,
Lars
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on March 27, 2017, 02:28:07 pm
Hi all,

Newbe question but I would like to create a scene that runs every morning and loops through the calendar of today and reads out in my Sonos system every happening... Just so we don't miss what is planned for the day...

Any tips?

BR.,
Lars

Others have done this - do a search in the Calendar section for Sonos and also gc_jsonEvents.   The event list in gc_jsonEvents is what you will need to read and parse to then fwd appropriate values to Sonos.  There are exampes of how to do the first part in the threads.
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on March 27, 2017, 02:53:55 pm
Hi guys,

I'm now to luup coding and trying to parse some json on my Vera Edge...

But my code always fails here (have tried "dkjson" as well): local json = require("json")

How can I verify if/what json parser I have and if not where to find one to install?

Do I need to import json parser somehow when I'm testing luup code under develop apps??

---- From log ----
01   03/27/17 13:48:40.135   LuaInterface::LoadCode: [string "function oooallEvents()..."]:9: unexpected symbol near '�' <0x74e5a520>
25   03/27/17 13:48:40.135   Code:
1function oooallEvents()
2   local GCAL_SID = "urn:schemas-srs-com:device:GCal:3"
3   local jsonEvents = luup.variable_get(GCAL_SID, "gc_jsonEvents",lul_device)
4
5   if (jsonEvents == "[]") then -- equivalent of a nul so don't try
6      return
7   end
8
9   local json = require("json")
10   return
11end
---- From log ----

BR.,
Lars

Here is the function I use in GCAL3.  GCAL3 checks to see if dkjson is present.  If so it uses it, if not it downloads a version of json.lua.  So one or the other will be present on your system.  They should be functionally identical (but who knows).



Code: [Select]
       -- check to see if we have a suitable module
      local function haveModule(Module)
          local test = require(Module)
          if type(test) ~= "table" then
            DEBUG(1,"No Module: " .. Module)
            return false
          end
          package.loaded.test = nil
          return true
        end

you could then do something like this

Code: [Select]
        local Module = "dkjson"
        local result = haveModule(Module)
      if result then
        json = require("dkjson")
      else
        json = require("json")
      end

Edit: Also see this post
http://forum.micasaverde.com/index.php/topic,26692.msg295143.html#msg295143
Title: Re: GCAL3 - Version 2.5
Post by: MNB on April 02, 2017, 09:57:56 am
Noobie help!, I've performed the steps in the beginning of this thread by creating a credential file (json) and modifying it to reflect the proper calendar email address by using a JSON editor, in addition I've inserted the proper "Embed This Calendar" code from my calendar details tab. The problem is that I'm getting the following;

I've verified that the modified file has been downloaded onto my VERA Edge within a separate directory "GCal3" below "/etc/cmh-ludl/" prior to using my particulars I first downloaded the GCal3Test particulars and verified that the plug-in works followed by inserting my GCal3.json and calendar ID with no avail.. any suggestions, I noticed that the procedure(s) are a little out of date (google has changed the various screens) but I believe I was able to create a proper JSON which looked and smelled (sic) similar to the GCal3test JSON file albeit the email and key was different. thanxs in advance Mike
Title: Re: GCAL3 - Version 2.5
Post by: MNB on April 02, 2017, 11:42:30 am
Never mind!  ::) It helps to read the steps within the procedure a little closer. Mistake #1 - I thought that I had to edit the GCal3.json with my calendar email. Mistake #2 I did not give the gserviceaccount.com shared access to my calendar. After correcting my mistakes I now have an functioning GCal3. "Teaching old dogs..." Mike
Title: Re: GCAL3 - Version 2.5
Post by: lmet on April 14, 2017, 11:23:36 am
@Stuart
For Debugging in page one: May be better to place step 4 below step 1 so file "GCal3Test.json" is in place before setting Credential
Regards
Title: Re: GCAL3 - Version 2.5
Post by: Stuart on April 14, 2017, 02:34:18 pm
@Stuart
For Debugging in page one: May be better to place step 4 below step 1 so file "GCal3Test.json" is in place before setting Credential
Regards

Yes.  It would work either way but your suggestion is neater.   I have made the change.

Thanks.
Title: Re: GCAL3 - Version 2.5
Post by: 3rdStng on May 01, 2017, 01:45:58 pm
I've been running the GCal app for a few months now with no issues. All along, it has said version 2.5. Last night I created another "switch" for the GCal app so I could pull in the Public Holiday's from Google's calendar. The first thing I noticed was that the switch icon was different. It is the GCal icon instead of the Z with the radio waves coming off of it. The second thing I noticed was that when I drilled into the switch, it looked different. In trying to get the legacy switch to look like the new switch, I forced an upgrade.

No change in appearances, other than now it says I'm running version 2.6. After resetting my Calendar ID for both my calendar and the holiday calendar, it is working. I created a test event and it shows up when I check for events. However, drilling into either switch, I no longer have the Calendar view. I see this was an issue in 2.4 and corrected in 2.5. Did it get broken again in 2.6?
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on May 01, 2017, 02:15:33 pm
@3rdStng
I submitted R2.6 a couple of weeks ago.  It often takes Vera a while to approve but they usually let me know as soon as it's released in the marketplace.  Not this time .....  Your post was my first clue .....

I've updated the release notes in the first post.  The only change of note is that I got rid of the calendar tab.  I did not make any change to the icon.  It's been that way for a long time.  Just why you are seeing a change now will likely remain one of those Vera mysteries.
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on May 01, 2017, 02:20:21 pm
Version 2.6 has been released in the marketplace.

The main change is the removal of the calendar tab.
Title: Re: GCAL3 - Version 2.6
Post by: 3rdStng on May 01, 2017, 02:30:10 pm
I did not make any change to the icon.  It's been that way for a long time.  Just why you are seeing a change now will likely remain one of those Vera mysteries.
It is strange. On my original GCal I see the Z with the wave and on the new GCal switch I created last night shows the icon. I suppose I could dig into the Advanced variables and see if I can change the icon there. It's only cosmetic on the front.

I liked the calendar view. May I ask why it was pulled? <<Never mind - I read your release notes.>>
Title: Re: GCAL3 - Version 2.6
Post by: 3rdStng on May 01, 2017, 02:37:21 pm
I found the difference between the two switches. The old sw json is listed as D_GCal3.json where the new switch is D_GCal3_UI7.json. Is it safe to just make this change or will it break the Calendar ID setting?
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on May 01, 2017, 02:49:14 pm
I did not make any change to the icon.  It's been that way for a long time.  Just why you are seeing a change now will likely remain one of those Vera mysteries.
It is strange. On my original GCal I see the Z with the wave and on the new GCal switch I created last night shows the icon. I suppose I could dig into the Advanced variables and see if I can change the icon there. It's only cosmetic on the front.

I liked the calendar view. May I ask why it was pulled? <<Never mind - I read your release notes.>>

You might try rebooting your vera - to get the icons to line up.  The advanced variables will not help as the icon references are embedded in one of the plugin files.

The calendar tab was a relic of the original Google Calendar Switch (by another author) which this plugin replaced.  When google changed the authentication mechanism a few years ago, one of the affects was the calendar tab would not work unless you happened to already be logged into google from your browser.   If you were not logged in to google  - then you needed to ....  Given this - you may as well just open your calendar in the browser.   If you did not know this, you might think something was not working ..   Also - the calendar tab also does not work across all interfaces.

Time to let it go .....  :'( :'(
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on May 01, 2017, 02:52:23 pm
I found the difference between the two switches. The old sw json is listed as D_GCal3.json where the new switch is D_GCal3_UI7.json. Is it safe to just make this change or will it break the Calendar ID setting?

Strange - something must have gone wrong / not updated properly in the past. In any case - provided you are on UI7 then, yes, go ahead and make the change as that is the file which should be used and which picks up the icon.
Title: Re: GCAL3 - Version 2.6
Post by: 3rdStng on May 01, 2017, 03:32:13 pm
I found the difference between the two switches. The old sw json is listed as D_GCal3.json where the new switch is D_GCal3_UI7.json. Is it safe to just make this change or will it break the Calendar ID setting?

Strange - something must have gone wrong / not updated properly in the past. In any case - provided you are on UI7 then, yes, go ahead and make the change as that is the file which should be used and which picks up the icon.
Sweet! Updated and refreshed my browser. All new icon and look/feel too!
Title: Re: GCAL3 - Version 2.6
Post by: Stephan on June 03, 2017, 03:51:37 am
Stuart Hi,

Where can I download the Plugin-files for 2.6? I can't find a link.
The "forced update" does not work, although I get an "OK" from the link returned.
http://<your vera ip>:3480/data_request?id=update_plugin&Plugin=7016

The reason: My Events show up in the plugin but the trigger does not work any more. I came across this issue just by a regular check. Then I checked the version of the GCal3.lua file which says it is 2.4 although I have updated it a while ago. I'm confused.

Now I first want to ensure that I have the latest files on my system before further analysis. my System runs on UI5 still!

Thanks for your Help.

Stephan
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on June 03, 2017, 04:13:37 am
Try this - it should force an update to version V2.6

http://<your vera IP>:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=7016&Version=33436
Title: Re: GCAL3 - Version 2.6
Post by: Stephan on June 05, 2017, 11:32:07 pm
Sorry Stuart, is there a remote link as well since I'm not at sight?
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on June 06, 2017, 09:10:09 am
Sorry Stuart, is there a remote link as well since I'm not at sight?

The question of a remote link is not a plugin question but a general vera question.  In general, it's difficult due to security constraints.   You could write some Lua code that interrogates some remote data and performs the action locally.

Understanding what you want to do might provide a better answer.
Title: Re: GCAL3 - Version 2.6
Post by: LibraSun on July 10, 2017, 06:31:05 pm
I'm hoping Stuart will update us all once the recent kink (presumably introduced by the roll-out of a Vera UI7 update during the past several weeks?) gets resolved, that is stopping GCal3 from initiating on new installs, at least on the VeraPlus I've been testing it with.

Thanks for all you do, Stuart, and for your tireless support of this useful plug-in!! Good luck...
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on July 10, 2017, 06:57:39 pm
I have sent an email with lots of details to vera.  No reply yet.  I also checked my other, much simpler, plugin (GetLog) and have the same issue.  That particular plugin has not changed since Nov last year.  So it's looking like vera are back into the "crowd sources QA" business.
Title: Re: GCAL3 - Version 2.6
Post by: Stuart on July 11, 2017, 03:14:16 pm
Vera got back to me today to say that their development staff  have identified and fixed the problem and will include the fix in the next update.  They neglected to say when that would be.  I asked - waiting on a reply.
Title: Re: GCAL3 - Version 2.6
Po