GCal3 to write events to Calendar

Any thoughts on making the Calendar plugin operate upstream ? Since you’ve built the ability to oAuth with Google I’d love the ability to utilize lua via the plugin to ‘manage’ events to the Calendar. I actually use this plugin more than any other to control my lights (Lux, Hue, indoor and outdoor LED’s), speech (reminders), push (text messages), irrigation and thermostats. The ability to create events and delete events would make this the perfect solution…

Anyways, just a thought… I noticed things were kind of quiet around here so I thought I’d make some noise… 8)

[quote=“CudaNet, post:1, topic:185162”]Any thoughts on making the Calendar plugin operate upstream ? Since you’ve built the ability to oAuth with Google I’d love the ability to utilize lua via the plugin to ‘manage’ events to the Calendar. I actually use this plugin more than any other to control my lights (Lux, Hue, indoor and outdoor LED’s), speech (reminders), push (text messages), irrigation and thermostats. The ability to create events and delete events would make this the perfect solution…

Anyways, just a thought… I noticed things were kind of quiet around here so I thought I’d make some noise… 8)[/quote]

I seem to recall that there is already a plugin for creating events in google calendar ??? Have not used or looked at it myself - but perhaps this has already been done.

Hmm, I checked a little and thought that maybe that code was abandoned (event2gcal)… I’ll load the plugin and see if I can possibly make it work. Will report back.

[quote=“Stuart, post:2, topic:185162”][quote=“CudaNet, post:1, topic:185162”]Any thoughts on making the Calendar plugin operate upstream ? Since you’ve built the ability to oAuth with Google I’d love the ability to utilize lua via the plugin to ‘manage’ events to the Calendar. I actually use this plugin more than any other to control my lights (Lux, Hue, indoor and outdoor LED’s), speech (reminders), push (text messages), irrigation and thermostats. The ability to create events and delete events would make this the perfect solution…

Anyways, just a thought… I noticed things were kind of quiet around here so I thought I’d make some noise… 8)[/quote]

I seem to recall that there is already a plugin for creating events in google calendar ??? Have not used or looked at it myself - but perhaps this has already been done.[/quote]

No bueno… Event2GCal : Lua error
Plug is fully configured, a little digging through the logs show :

08      01/06/15 13:09:36.842   JobHandler_LuaUPnP::HandleActionRequest device: 232 service: urn:event2gcal:serviceId:Event2GCal1 action: SetCalendarName <0x30dc2680>
08      01/06/15 13:09:36.842   JobHandler_LuaUPnP::HandleActionRequest argument fwdserver=1 <0x30dc2680>
08      01/06/15 13:09:36.843   JobHandler_LuaUPnP::HandleActionRequest argument remoteIP=70.251.39.9 <0x30dc2680>
08      01/06/15 13:09:36.843   JobHandler_LuaUPnP::HandleActionRequest argument token=[removed by Cuda] <0x30dc2680>
08      01/06/15 13:09:36.843   JobHandler_LuaUPnP::HandleActionRequest argument PK_AccessPoint=[removed by Cuda] <0x30dc2680>
08      01/06/15 13:09:36.843   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=232 <0x30dc2680>
08      01/06/15 13:09:36.843   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:event2gcal:serviceId:Event2GCal1 <0x30dc2680>
08      01/06/15 13:09:36.844   JobHandler_LuaUPnP::HandleActionRequest argument action=SetCalendarName <0x30dc2680>
08      01/06/15 13:09:36.844   JobHandler_LuaUPnP::HandleActionRequest argument NewCalendarName=[removed by Cuda] <0x30dc2680>
08      01/06/15 13:09:36.844   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.25600285013206303 <0x30dc2680>
06      01/06/15 13:09:36.845   Device_Variable::m_szValue_set device: 232 service: urn:event2gcal:serviceId:Event2GCal1 variable: CalendarName was:  now: [removed by Cuda] #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0

And UPNP crashed the system so the restart occured and then this :

[size=8pt]01 01/06/15 13:10:03.789 JobHandler_LuaUPnP::CreateLuaInterfaces can’t load plugin /etc/cmh-lu//google.lua <[/size]

Guess I’ll have to open up the Google.lua and see what it’s doing inside…

If it’s been abandoned then I think it unlikely that it uses the new auth mechanism. Let me know what you see and I can decide if it makes sense to maybe try to update it or add some functionality into GCal3 or …

I found a link to the developers website (French) based on his event2Gcal thread. Per his/her advice, I removed the plugin and added it manually. That, at the very least cleared all the issues I was having with Lua errors. However, it appears that this is where the trail goes cold (so to speak). System logs show the following :

08      01/06/15 14:49:29.885   JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x31750680>
08      01/06/15 14:49:29.885   JobHandler_LuaUPnP::HandleActionRequest argument Code=local now = os.date("*t")
luup.call_action("urn:event2gcal:serviceId:Event2GCal1", "SetEventDesc", {NewEventDesc= "L'alarme a ?t? correctement d?sactiv?e ? "..tostring(now.hour).." heures "..tostring(now.min).." minutes "..tostring(now.sec).." secondes"},234) <0x31750680>
08      01/06/15 14:49:29.887   JobHandler_LuaUPnP::HandleActionRequest device: 234 service: urn:event2gcal:serviceId:Event2GCal1 action: SetEventDesc <0x31750680>
08      01/06/15 14:49:29.887   JobHandler_LuaUPnP::HandleActionRequest argument NewEventDesc=L'alarme a ?t? correctement d?sactiv?e ? 14 heures 49 minutes 29 secondes <0x31750680>
06      01/06/15 14:49:29.887   Device_Variable::m_szValue_set device: 234 service: urn:event2gcal:serviceId:Event2GCal1 variable: EventDesc was: L'alarme a ?t? correctement d?sactiv?e ? 14 heures 49 minutes 9 secondes now: L'alarme a ?t? correctement d?sactiv?e ? 14 heures 49 minutes 29 secondes #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x31750680>

… but nothing else, I too suspect an error (since it’s not using oAuth2) from Google is occurring but we just never see it (lack of debug logs). When I changed the credentials (that’s all I did) I got a nice email from Google letting me know they blocked access to my calendar. In conclusion, I looked at the last time developer logged into this site and it’s been almost 2 years come the 24th of this month.

I wonder if this plugin was using what I see now (being referred to) as a ‘Quick Add’ as I don’t see parameters for date/time or location of the event - just the event name and description using Google ‘english’ (e.g. Pick up John Doe at 8:00am today). I foresee a plugin not only being a method for creating events for HA but also logs of information (‘John Doe’ entered the ‘Front Door’ at ‘9:02am’ or ‘Front Door’ camera sensed motion at ‘9:02am’) stored back into the Calendar or alternatively a secondary calendar.

Much appreciated Stuart…

I will take a look no promise as to how quickly.

I might be able to do something simple like add a service call to GCal3 that does something simple like addEvent and pass in eventName, startdate/time, enddate/time. That would be pretty generic, be able to be called from Luup code and probably satisfy a number of use cases .

Thanks again and totally appreciate you taking the time to look at all of this…

[quote=“Stuart, post:7, topic:185162”]I will take a look no promise as to how quickly.

I might be able to do something simple like add a service call to GCal3 that does something simple like addEvent and pass in eventName, startdate/time, enddate/time. That would be pretty generic, be able to be called from Luup code and probably satisfy a number of use cases .[/quote]

Later today I will publish a beta version of GCal3 that will enable calendar events to be created using Lua in scenes and etc

It will be on the main GCal3 board

Thanks Stuart, I’ve really been looking forward to this…

[quote=“Stuart, post:9, topic:185162”]Later today I will publish a beta version of GCal3 that will enable calendar events to be created using Lua in scenes and etc

It will be on the main GCal3 board[/quote]

I got curious about what the use-case would be for this. Could you give an example what you will be using this for CudaNet?

My use case my differ from others but here was my intent.

Create a secondary calendar (read-only) which would be shared with my family. A format (web based) which they can view specific information about my home (including me). They won’t have access to Vera (remotely) and sending them emails or notifications would be annoying. So the readable events would be, the time I left work and arrived at the office. The temperature and mode state within the home (each zone). The time the maids entered the house and left. How long the sprinkler system ran (each zone) and at what time - or perhaps it didn’t run due to weather or water restrictions. Are my dogs being active or sleeping (via Whistle; IFTTT) etc. Camera sensed motion by the Garage. Someone rang my doorbell. Think of it as a permanent log whereby I can look back and see what happened that day. You could even write some LUA to read back the days events to you at the click of a button (e.g. Homewave).

Hope that helps…

That is not a bad idea CudaNet, now I want it to :smiley:

I just released new version of GCal3 to the marketplace - with well tested calendar add feature.

Just for information - I used the calendar add event with 3 different plugins on 3 different calendars (2 on a vera running UI7 and one on a vera running UI5). I used these to trigger scenes which created different events (some fixed some random) on calendars different to the one the plugin was connected to and sometimes to the same calendar.

This allowed me to really stress test the plugin (found and fixed a few weaknesses - mostly with timing) by exercising the plugin with many many events over days and in both UI5 and UI7.

So just as food for thought: Can use a calendar event to create an event in the same or different calendar (if using more than one plugin) and can use this as a technique for having one vera trigger another (via the calendar). This is near-real time (to the minute) because whenever a calendar event is added - if it starts before the plugin would otherwise update - it forces a re-read of the calendar.

Not sure if this will inspire some ideas - but hope so.