Author Topic: iCal  (Read 4543 times)

Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #15 on: January 29, 2016, 06:23:32 am »
Will do.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #16 on: January 29, 2016, 11:13:29 am »
The url format for your calendar was NOT one of the forms that I knew about.  I'm rethinking how best to parse the google url.  In the meantime I added this form to the code and the patch file can be found here:

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

Basically -- because you are using google to get at a non-google calendar, google uses a slightly different url than normal.

So try the patch if everything is ok it should now work.  If you still get an error it's likely a http 404 error (which is the one I get when I try your url) because you do not have access to the calendar (either through settings on the calendar in google or credentials are not set correctly).

In any case - we are getting closer ....   :D

Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #17 on: January 29, 2016, 12:11:35 pm »
Yes, I do appear to be seeing 404 error after updating. Just to recap - I have not set any credentials as I am unable to share (as far as I know) the calendar to the Google Service Account email. I do not know if this will affect what we are trying to achieve even though the calendar link opens a calendar without requiring authentication.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #18 on: January 29, 2016, 04:47:52 pm »
The http 404 error code can mean (usually) one of two things (1) that the url cannot be found or (2) that you do not have permission to access it.

In this case I suspect it's a permission issue.  So now the question is whether it's at the google end or at the ical end.

Can you see and access the calendar in google ?  In an earlier reply you said "Yes I can. I have logged out of google and the calendar displays correctly."  but it was not clear to me if you meant that you were accessing the ical directly or if it was displaying in your google calendar.

If it does not display - then it's a good guess that the problem is at the ical end.  How are the permissions set in your ical -- is it public ?  If it is - and you want to share the ical link via IM I can see if I can access from my system.

Also - if it is public - have you tried putting in the ical link directly into GCal (it will work with some ical calendars but not all as ical is not standardised too well)

have a look in https://calendar.google.com/calendar/syncselect  does your calendar show up as shared and read only ?

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #19 on: January 30, 2016, 12:58:07 am »
I just tried getting an iCloud calendar to show up in google calendar and guess what .... error 404.  So I think the problem may be at the google end.  There are some posts on the web talking about issues.

I'll see if I can make sense of it over the weekend.

Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #20 on: January 30, 2016, 06:32:43 am »
The http 404 error code can mean (usually) one of two things (1) that the url cannot be found or (2) that you do not have permission to access it.

In this case I suspect it's a permission issue.  So now the question is whether it's at the google end or at the ical end.

Can you see and access the calendar in google ?  In an earlier reply you said "Yes I can. I have logged out of google and the calendar displays correctly."  but it was not clear to me if you meant that you were accessing the ical directly or if it was displaying in your google calendar.

I copied the html link in google calendar, logged out, pasted into address bar. This opened up calendar.google.com. Please feel free to try the link - it is not sensitive data.

If it does not display - then it's a good guess that the problem is at the ical end.  How are the permissions set in your ical -- is it public ?  If it is - and you want to share the ical link via IM I can see if I can access from my system.

It is not public. I did visit the syncselect page and ticked the box to this shared calendar

Also - if it is public - have you tried putting in the ical link directly into GCal (it will work with some ical calendars but not all as ical is not standardised too well)

have a look in https://calendar.google.com/calendar/syncselect  does your calendar show up as shared and read only ?

Yes.

Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #21 on: February 07, 2016, 07:00:22 pm »
Hello - did you have any more luck with this?

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #22 on: February 07, 2016, 11:58:46 pm »
I've been doing quite a bit and in the middle of writing up some notes (see draft incomplete below) .  Also making some code changed for Direct method  iCal -- because of some underlying issues in the Lua libraries - that's pretty well done.  Note that this does not affect calendars from google like the one you sent the url for.

One thing that I noted is that the url you sent to me is not public -- so I could not see it -- that may be part of the issue if the permissions are incorrect at the google end.  i.e. given the url you sent gcal will treat it like any google calendar.  Below I say "you need to set up google credentials in the normal way." -- but I still need to figure out exactly what that means because it's not clear what google expects in this circumstance.  That's the next step to figuring this out.

Can you send me the public direct url to the ical ?  Not the one created by google but the one that you input into google.  I can troubleshoot on that come wednesday (traveling in the meantime)

The following notes are ? to the best of my knowledge ? accurate BUT they are based on limited use of iCal and may contain errors.
Basically ? there are two ways GCal can access an iCal:
1.   Directly.  This method uses a direct link to an iCal that bypasses Google calendar
a.   The GCal plugin has some limitations on direct iCal use.  Not all iCal can be interpreted correctly. This is because the iCal specification allows for variations in format ? not all of these variations are handled by GCal.
b.   This is a direct link to your iCal so changes that you make to your iCal will show up immediately.
c.   The iCal must be public.
d.   The calendar information will not show up in the calendar tab of the plugin
e.   There are no credentials required.


2.   Through Google Calendar.
a.   If  google calendar can display the iCal correctly then GCal can.
b.   You are creating a subscription from google calendar to an iCalendar.  Google only updates this subscription from time to time (every 12 hrs. ?).  Changes that you make to your iCal may not show up in google (and hence GCal) for a while.
c.   The iCal must be public for google to see it.
d.   The calendar information will show up in the calendar tab of the plugin
e.   You need to set up google credentials in the normal way.

The Direct Method
GCal will attempt direct access to iCal by looking for ?.ics? or ?.ical? or ?.iCloud? in the url that you input as the Calendar ID.  It then treats the calendar as public and does not use any google credentials.  For example:
https://www.calendarlabs.com/templates/ical/International-Holidays.ics
To test if your url is likely to work, try opening the url into a browser.  If it downloads a .ics file ? then it?s likely good.  Check by opening the .ics file in a text editor.  The top few lines should look something like this:

BEGIN:VCALENDAR
PRODID:-//Calendar Labs//Calendar 1.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:International Holidays
X-WR-TIMEZONE:America/New_York
BEGIN:VEVENT


If it does not have BEGIN:VCALENDAR and VERSION:2.0 then it?s NOT an iCal.  If it does then it should be an iCal.

Through Google Calendar

Yet to write this bit up but intend for it to be a step by step setup for an iCal being accessed by google.


Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #23 on: February 08, 2016, 04:57:53 am »
Tried the Direct Method which does indeed download a file containing BEGIN:VCALENDAR,
VERSION:2.0, PRODID ... have sent you the link.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #24 on: February 08, 2016, 04:55:12 pm »
So the direct method does not currently work on all iCal's because of the lua library issue that I mentioned.  I'm working on it .....

However the "through google calendar" method seems to work perfectly !!

I created a calendar in google using your url
Other Calandars --> Add by url
Insert the ical url
Make the calendar publicly accessible? worked both ways
--> Add Calendar

I then went to Settings --> Calendar --> [your calendar] and got the embedded Calendar Link <iframe .......... </iframe>

put it in as the Calendar ID in the plugin and ..... (tada).

you should try this using the test credentials I posted on the main thread.   I'm now convinced that your credentials are not set up correctly.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #25 on: February 11, 2016, 02:09:41 pm »
@ powisquare

You can try this patch with the direct iCal url if you like.  Seems to be working fine.

Make sure you set the calendar ID again as there was an error encoding certain iCal url's (Direct) that I have corrected.

Did you get the google variant working ?

Edit: Patch removed as it's included in the official version
« Last Edit: May 12, 2016, 11:28:57 am by Stuart »

Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #26 on: February 12, 2016, 05:19:13 am »
Have had a bit of trouble (credentials) but seems to be working now! Will be away for a week so shall look at this in more depth on my return. Kind Regards.

Offline powisquare

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: iCal
« Reply #27 on: May 12, 2016, 05:20:51 am »
Good news. I started again again created a new credential with my personal calendar as there is no way of sharing the ical I am using. I have then used the ical Calendar Link and it works.

Is it possible for the app to look 2 days out instead of one and do you know of any pleg examples out there using your app I might be able to refer to?

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #28 on: May 12, 2016, 11:36:43 am »
Good news. I started again again created a new credential with my personal calendar as there is no way of sharing the ical I am using. I have then used the ical Calendar Link and it works.

Is it possible for the app to look 2 days out instead of one and do you know of any pleg examples out there using your app I might be able to refer to?

Good to hear that it is working for you.   Are you on the latest version from the marketplace ?   It has some additional capabilities and changes that you should upgrade to (so I can continue to support).  I cannot remember if the patch version you were working with includes this - but the latest version in the marketplace has an additional parameter gc_ExtraDays (default is 0) So to look 1 additional day ahead you set it to 1.

I will have a slightly newer version in the marketplace in the next day or 2 (has better handling of initial configuration mistakes).  You may want to to wait for that.

For PLEG - I will have a look to see what examples I have.  I do not know if others do.  You should post a request in the main GCal and PLEG forums.

Good Luck

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 664
  • Karma: +67/-2
Re: iCal
« Reply #29 on: May 12, 2016, 02:20:21 pm »
If you are already on V2.0 you can get the next version (2.1) without waiting for the marketplace to update by using the following:

http://<your vera IP>:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=7016&Version=31461

If you are NOT on V2.0 already - then be sure to follow the upgrade instructions here:
http://forum.micasaverde.com/index.php/topic,26692.msg276087.html#msg276087