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 ("real" calendars).

    In addition it creates two "virtual" calendars with configurable time range for each (i.e. default Today and Tomorrow calendars)
    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:	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
    NOTE: New HS feature "Run as Service" prevents authorisation prompt. To configure Google credentials HS must run as normal process, not as service.

    First time you start the plugin - it will pop up authorization prompt in browser.

    Note 1: For this reason you have to use web browser on same computer where HS server is installed and logged in in your browser with your Google email.

    Note 2: From version 4.0.2.00 you don't need to create your own calendar credentials. If ver 4.0.2.00 isn't available in updater - please try BETA (enable "Show Beta Plugins").

    Note 3: Until Google approve my app (which takes time) - the authorisation prompt may warn that the app is unsafe - select "Advanced" and "Go to Google Calendar plugin for HomeSeer (unsafe)".

    For Linux please see this post !

    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:
        If GC event has reminder (notification) set - trigger HS Event at the reminder time. Each Google Calendar can have "default" notification (used for each new event) and "event specific" notification (added manually after the event is created). Hence the HS event trigger configuration has two options: "Use default calendar reminders" and "Use event specific reminders".​
        • Calendar Event Start (Occures):
        Triggered when GC Event starts (or before the event if Trigger Before 'hh:mm:ss' is set in the HS event configuration).​
        • Calendar Event End
        • Calendar Event Contains condition
        Note: if you want to trigger HS event some time before the GC event starts, you can use either Calendar Event Reminder​ trigger (and set the notification time in the GC event configuration); or Calendar Event Start (Occures)​ trigger (and set the Trigger Before 'hh:mm:ss' time in the HS event configuration).​
        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

        Note 1: Global Vars are set only when event triggers - so the contents of the variables reflects only one event, until next trigger when they become overwritten.​

        Note 2: To see what variable values are set you can enable the calendar Log and see all variables in HS log when event is triggered.
        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.

            Comment


              #7
              Note on plugin loosing Google authorization.

              Some users report that the plugin sometimes looses authorisation and needs to re-authenticate.

              While I can't (yet) get to the bottom of the issue, I made a lot of improvements to detect if authorisation is lost.

              When authorisation is lost - the main plugin root device should change to "Not Authorised" state. Then it should also pop-up Google login prompt (which won't work if HS is running as service).

              There's also "Authorise" button on main plugin root device (in case the prompt didn't pop-up automatically).

              Please note that after every service reset the plugin will poll all calendars, so don't set the "service reset timeout" too low. Probably once or twice a day should be sufficient.

              Also, if "Reset above timer on successful comms" is enabled - then timer will restart after every successful poll. In this case it's probably safe to set "service reset timeout" just a bit longer then calendar polling period (i.e. 15 minutes) - so it should only fire if there's no reply from Google.

              Note: it's probably a good idea to setup a HS event in case the main plugin root device state becomes "Waiting Authorisation" or "Not Connected" to inform that the plugin needs attention.

              Click image for larger version

Name:	Waiting Authorisation.png
Views:	270
Size:	18.2 KB
ID:	1536615

              Click image for larger version  Name:	config2.png Views:	0 Size:	121.4 KB ID:	1536613

              Comment


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

                Comment


                  #9
                  Ver 4.0.0.18 - Added "Contains Text" Condition sub-trigger

                  Ver 4.0.0.20 - Added "Waiting Authorisation" root state so you can get notification and execute some action if requires Google Authentication

                  Click image for larger version

Name:	2021-12-09 (1).png
Views:	364
Size:	53.8 KB
ID:	1512992Click image for larger version

Name:	WaitingAuth.png
Views:	350
Size:	14.5 KB
ID:	1512993

                  Comment


                    #10
                    Finally Google approved my application, so users don't need to create their own app / credentials.
                    Click image for larger version

Name:	OAuth.png
Views:	226
Size:	74.2 KB
ID:	1554448

                    Comment


                      #11
                      alexbk66 Congrats! For users that have had this plugin installed already, do we need to do anything other than update the plugin?
                      HS4 4.2.6.0 &HSTouch Designer 3.0.80
                      Plugin's:
                      BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
                      EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
                      weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave

                      Comment


                        #12
                        Originally posted by The Profit View Post
                        alexbk66 Congrats! For users that have had this plugin installed already, do we need to do anything other than update the plugin?
                        If you want to use my client id/secret (most probably) - you need to delete them in the plugin settings (set to empty string).

                        Also delete just in case C:\Program Files (x86)\HomeSeer HS4\Bin\AKGoogleCalendar\token.json

                        Comment


                          #13
                          Originally posted by alexbk66 View Post

                          If you want to use my client id/secret (most probably) - you need to delete them in the plugin settings (set to empty string).

                          Also delete just in case C:\Program Files (x86)\HomeSeer HS4\Bin\AKGoogleCalendar\token.json
                          I've just updated to version 4.0.2.3 and already have a client ID and secret under the "Enable the Google Calendar API" section, will these work or will it only work under your client id and token? The plugin seems to be updating and working fine at the moment.
                          HS4 4.2.6.0 &HSTouch Designer 3.0.80
                          Plugin's:
                          BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
                          EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
                          weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave

                          Comment


                            #14
                            Originally posted by The Profit View Post

                            I've just updated to version 4.0.2.3 and already have a client ID and secret under the "Enable the Google Calendar API" section, will these work or will it only work under your client id and token? The plugin seems to be updating and working fine at the moment.
                            Yes, it should have your client ID/secret if you configured before, I didn't want to delete them in case users want to use their creds.

                            But if you delete both of them - the plugin should use my creds.

                            Comment


                              #15
                              Ver 4.0.4.1 (BETA) - Fixed Calendar Event Reminder trigger

                              Comment

                              Working...
                              X