We have moved at community.getvera.com

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

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - V 0.9 Released
« Reply #225 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




Offline mda

  • Sr. Member
  • ****
  • Posts: 464
  • Karma: +9/-0
GCAL3 - V 0.9 Released
« Reply #226 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.

Offline SM2k

  • Full Member
  • ***
  • Posts: 179
  • Karma: +4/-0
Re: GCAL3 - V 0.9 Released
« Reply #227 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.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - V 0.9 Released
« Reply #228 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'.
« Last Edit: November 18, 2014, 04:37:31 pm by Stuart »

Offline SM2k

  • Full Member
  • ***
  • Posts: 179
  • Karma: +4/-0
Re: GCAL3 - V 0.9 Released
« Reply #229 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.

Offline mda

  • Sr. Member
  • ****
  • Posts: 464
  • Karma: +9/-0
Re: GCAL3 - V 0.9 Released
« Reply #230 on: November 19, 2014, 12:40:28 am »
Thanks !

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - V 0.9 Released
« Reply #231 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   

Offline SM2k

  • Full Member
  • ***
  • Posts: 179
  • Karma: +4/-0
Re: GCAL3 - V 0.9 Released
« Reply #232 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

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - V 0.9 Released
« Reply #233 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.

Offline Don Diego

  • Hero Member
  • *****
  • Posts: 534
  • Karma: +300/-3
Re: GCAL3 - V 0.9 Released
« Reply #234 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
Vera 3 (@1.5.622) (3); Vera Plus (2);
Trane/Schlage TStats (1); Schlage Deadbolt (2); Kwikset Lock (3);  GE 45602 Dimmer (14); GE 45603 Dimmer (17); HSM-100 (16); Everspring Siren (8), Everspring Temp/Humidity (4); HSM 200 (1)

Offline SM2k

  • Full Member
  • ***
  • Posts: 179
  • Karma: +4/-0
Re: GCAL3 - V 0.9 Released
« Reply #235 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.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - V 0.9 Released
« Reply #236 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.


Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GCAL3 - V 1.0 Released
« Reply #237 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
« Last Edit: November 21, 2014, 10:20:47 am by Stuart »

guest141575

  • Guest
Re: GCAL3 - V 1.0 Released
« Reply #238 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?

guest141575

  • Guest
Re: GCAL3 - V 1.0 Released
« Reply #239 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.