Announcement

Collapse
No announcement yet.

AK Google Calendar plugin introduction / instructions / screenshots

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AK Google Calendar plugin introduction / instructions / screenshots

    .
    .
    Click image for larger version  Name:	GC128-2.png Views:	0 Size:	9.7 KB ID:	1453401 Google Calendar plug-in for:

    - Displaying calendar events,
    - Triggering HS events based on upcoming calendar event (reminder, start, and end).
    - HS Event actions for creating Google calendar events (both Event Start and Event End).


    https://shop.homeseer.com/products/alexbk66-ak-google-calendar-software-plugin-for-hs4
    Features:
    1. The plugin creates a parent root device for each Google Calendar you have setup.
    In addition it creates two calendar groups with configurable time range for each (i.e. default Today and Tomorrow calendars, or a week)
    Click image for larger version  Name:	main.png Views:	0 Size:	157.5 KB ID:	1453400
    2. HS Event Triggers:
    • Calendar Event Reminder,
    • Calendar Event Started
    • Calendar Event Ended

    Lots of global variables for use in Actions:
    Click image for larger version  Name:	global_vars.jpg Views:	0 Size:	44.2 KB ID:	1453404
    3. HS Event Actions:
    • Create Calendar Event
    • Set Event End

    I.e. instead of creating two separate calendar events for Gates Open / Gates Close - one event is created with event end time corresponding to Gates Close:
    Click image for larger version  Name:	323_Capture (1).png Views:	0 Size:	39.4 KB ID:	1453462
    Click image for larger version  Name:	create-end.png Views:	1 Size:	18.4 KB ID:	1453409
    Click image for larger version  Name:	CreateEvent1.jpg Views:	0 Size:	20.4 KB ID:	1453407
    Click image for larger version  Name:	SetEnd.jpg Views:	0 Size:	24.6 KB ID:	1453408
    4. All calendars settings:
    Click image for larger version  Name:	MyDevicesFeaturePage.png Views:	0 Size:	49.0 KB ID:	1453406

    #2
    1. Configuring Google Credentials
    For Linux please see post #6 first and this thread !

    See the post:

    https://forums.homeseer.com/forum/hs...le-credentials

    Comment


      #3
      2. Configuration Options
      The plugin creates a parent root device for each Google Calendar you have setup (real calendars). In addition it creates two calendar groups with configurable time range for each (i.e. default Today and Tomorrow virtual calendars).

      General Configuration:

      1. Event display date separator - to display event start date/time on new line use "<BR>". To display date in brackets use one of "(", "[", "{". If left blank - no event start date displayed.

      2. Date and Time display format - see Custom date and time format strings

      3. All Day Event start time (offset from 0:00 - positive or negative)
      Click image for larger version  Name:	settings_general.png Views:	0 Size:	25.9 KB ID:	1453425
      For all calendar groups (both real and virtual calendars) you can configure:

      1. Number of events you want to display (default 5). Plugin will create a child device for each calendar event. To disable this calendar set Events to 0.

      2. Update rate (default 15 minutes). This only matters for detecting newly creating events. The plugin will automatically reduce the update delay closer to the event. To disable this calendar can set Update rate to 0:00.

      3. Show Started Events - events in progress started, but not ended. If unchecked - the started event will disappear from HS.

      For each real calendar additionally:

      1. Include in Today
      2. Include in Tomorrow

      If you want to show events from this calendar in Today/Tomorrow calendars
      Click image for larger version  Name:	real_cal_cfg.jpg Views:	0 Size:	43.0 KB ID:	1453426
      For each virtual calendar additionally:

      1. Range Start - when the time range for this calendar start, i.e. default 0:00 for Today and "1 Day" for Tomorrow
      2. Time Range - default 1 Day for both, can be changed, i.e. to 7 days to show one week events.
      3. Range Type (Fixed/Moving) - i.e. for Today calendar if "fixed" is selected - the display range will be always fixed from 0:00 to 24:00. For "moving" range show the events starting from "now" for the next 24 hours.
      Click image for larger version  Name:	range_cal_cfg.jpg Views:	0 Size:	52.0 KB ID:	1453427
      Note: Most of these settings are also available from "My Calendars" page:
      Click image for larger version  Name:	MyDevicesFeaturePage.png Views:	0 Size:	49.0 KB ID:	1453428

      Comment


        #4
        3. Creating HS Event Triggers/Actions
        HS Event Triggers:
        • Calendar Event Reminder
        • Calendar Event Start (Occures)
        • Calendar Event End
        Click image for larger version  Name:	trigger_cfg.jpg Views:	0 Size:	37.6 KB ID:	1453449
        Note 1: Since HST didn't port timepicker control to HS4 - you need to enter time span as text, i.e. if you want to trigger event 15 minutes before - enter 0:00:15

        Note 2: For "Calendar Event End" trigger you must enable "Show already started events" in each calendar settings. Please read Important Notes below.
        When the event triggers - plugin creates many global variables for using in actions (using format $$GLOBALVAR:name:):
        Click image for larger version  Name:	trigger_cfg_collap.jpg Views:	0 Size:	31.2 KB ID:	1453450
        HS Event Actions:
        (1) Create Google Event

        Note: The event text can use HS Replacement Variables, i.e. device value / status.

        Say you want to keep track of your gate state in the Google calendar. You use "Create Calendar Event" action when your gates are open
        Click image for larger version  Name:	CreateEvent1.jpg Views:	0 Size:	20.4 KB ID:	1453457
        Note the event-action id above (3-3436) you need for "Set Event End" action later.

        (2) Set Google Calendar Event End

        When the gates close - you use "Set Even End" action (make sure you select the id 3-3436):
        Click image for larger version  Name:	createEnd2.png Views:	0 Size:	16.1 KB ID:	1453458
        Click image for larger version  Name:	SetEnd.jpg Views:	0 Size:	24.6 KB ID:	1453459
        Click image for larger version  Name:	323_Capture (1).png Views:	112 Size:	39.4 KB ID:	1453460

        Comment


          #5
          4. Important Notes

          1. Trigger functionality depends on the calendar configuration and works only for Calendar events displayed in HS. For example if you create a trigger for Event Reminder in Today Calendar and the Calendar Event starts tomorrow (so isn't displayed in Today calendar) and the event reminder is set for "One Day before the event" - it won't trigger. In other words, the Event Reminder trigger for Today Calendar only triggers for events starting today (i.e. within 24 hours)

          2. For same reason if you want to use Event End Trigger - then "Show Started" option should be enabled for this calendar.

          3. And for the same reason if you disable updates for particular calendar (by setting number of events or update frequency to 0) - triggers for this calendar won't work.

          4. Event Reminder Triggers work only for the reminder set explicitly for the event - not the default reminders. Google Calendar API provides only reminder "overrides" by default. It is possible though to get the default reminders to work if required - please add Feature Request.

          5. For some calendars Google doesn't send the clean Name, instead it provides an ugly looking ID. In this case I recommend in Google calendar settings set the calendar description field to the display name you want to see in HS - the plugin then will use the description instead of the name.

          Comment


            #6
            Configuring Google Credentials (on Linux)

            Note: Google Chrome is not available for Raspberry PI, see this post for alternatives.

            Problem I found with authenticating with Google from HS - it's caused by HS running as root, for authentication it tries to start a web browser, but on Linux running browsers as root normally is not allowed:
            Code:
            Running Firefox as root in a regular user's session is not supported
            Here's what I did to make it work:

            1. Install Google Chrome
            Code:
            wget wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
            sudo dpkg -i google-chrome-stable_current_amd64.deb
            2. To let Chrome run as root:

            Code:
            sudo vi /opt/google/chrome/google-chrome
            # Find a line starting from "exec -a" and replace it with:
            exec -a "$0" "$HERE/chrome" "$@" --no-sandbox --user-data-dir
            For test try starting Chrome as su

            Note 1: You need to set Chrome as default browser, so when HS starts the browser - it will choose Chrome.

            Code:
            sudo google-chrome
            Note 2: It's highly recommended first to login in Google Chrome with gmail and password before trying to get OAuth2 authentication.

            Now you should be able to obtain OAuth2 ClentID and ClientSecret, copy them to the plugin config page and click "Submit" (see post #2). Then HS will start the Chrome browser and ask for authorisation.

            Comment


              #7
              Configuring Google Credentials (on Linux / Headless)

              Requires Mono 5.20 and above.

              For headless installation I created a little app authenticator.exe (attached) which you can run anywhere (after obtaining ClientID and ClientSecret, see post #2).

              Note: I also recommend to use this app for testing your Mono version before you actually try to use the plugin. It makes it easier to troubleshoot Google Calendar API Mono .NET dependencies.

              Code:
              authenticator.exe ClientID ClientSecret

              It should request "User login & consent" and receive "Authorisation code" and on success print list of your calendars:
              Code:
              *********************************************
              Credential file saved to: D:\My\Temp\Release\token.json
              
              D:\My\Temp\Release\token.json\Google.Apis.Auth.OAuth2.Responses.TokenResponse-user
              
              *********************************************
              pp08kp35e77ap05mmm94a00gmk@group.calendar.google.com HS-Heat #f691b2
              i04d1nir7395dmril3dvpstijg@group.calendar.google.com HS-Gates #16a765
              jgcuopiksi78f231qq5t23b2pg@group.calendar.google.com Homeseer #fbe983
              95dfa41185hao6gmvpss2nelro@group.calendar.google.com HS-TV #ffad46
              All you need to do now - in Google Calendar Credentials configuration click Click image for larger version  Name:	upload_cred.PNG Views:	1 Size:	3.5 KB ID:	1300476 and point to the file received above (
              Google.Apis.Auth.OAuth2.Responses.TokenResponse-user). This should copy the file to the plugin bin folder on HS machine.
              Alternatively you can copy the file manually to "HomeSeer HS3\Bin\AKGoogleCalendar\token.json" folder (may need to create "token.json" folder first)

              Then click "Submit" button to apply the credentials (you still need the ClientID and ClientSecret fields).

              [EDIT]
              authenticator.exe is included in the plugin install from ver. 1.0.0.11 (downloaded version from this post may become incompatible with later plugin versions)
              Attached Files

              Comment


                #8
                Ver 4.0.0.12 - Added support for Replacement Variables in "Create Calendar Event" action

                Comment

                Working...
                X