We have moved at community.getvera.com

Author Topic: GCAL3 - General Discussion  (Read 192690 times)

Offline mike Q

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +3/-0
Re: GCAL3 - Version 2.5
« Reply #630 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.


Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - Version 2.5
« Reply #631 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.
« Last Edit: December 28, 2016, 07:43:32 pm by Stuart »

Offline mike Q

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +3/-0
Re: GCAL3 - Version 2.5
« Reply #632 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.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - Version 2.5
« Reply #633 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
« Last Edit: May 01, 2017, 02:18:28 pm by Stuart »

Offline powisquare

  • Full Member
  • ***
  • Posts: 146
  • Karma: +1/-0
Re: GCAL3 - Version 2.5
« Reply #634 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
« Last Edit: December 29, 2016, 12:20:31 pm by Stuart »

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - Version 2.5
« Reply #635 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.

Offline powisquare

  • Full Member
  • ***
  • Posts: 146
  • Karma: +1/-0
Re: GCAL3 - Version 2.5
« Reply #636 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.
« Last Edit: December 29, 2016, 12:50:17 pm by powisquare »

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - Version 2.5
« Reply #637 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

Offline mike Q

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +3/-0
Re: GCAL3 - Version 2.5
« Reply #638 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

Offline aladur

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
error 403
« Reply #639 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!

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: error 403
« Reply #640 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 😑🤐

Offline aladur

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: GCAL3 - Version 2.5
« Reply #641 on: January 10, 2017, 09:38:42 am »
yeah, thanks!

Offline mike Q

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +3/-0
Re: GCAL3 - Version 2.5
« Reply #642 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

Offline lawi75

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: GCAL3 - Version 2.5
« Reply #643 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


Offline lawi75

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: GCAL3 - Version 2.5
« Reply #644 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