Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,


as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.


As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!



Smart Home Forum by FIBARO Team

Google Calendar Synchronization 1.2

   (0 reviews)

1 Screenshot

About This File

Hi All,


I came across the problem of making my private Google Calendar's entries available in HC2 with the intention of using it in some of my home's automation scenarios. Since I was unable to find any simple solution on the internet I did create my own and here it is :)


The scene runs on my HC2 since few weeks without any issues. I did schedule the scene using Sankotronic's Main Scene for Time Based Events and it is synchronizing my Google Cal every hour.



There are three basic steps to make the scene working for you:


·       Provide the link to your google calendar by modifying the address hold in the local variable

local gCalUrl = https://calendar.google.com/calendar/ical/xxxxxxx.ics


  • Create global variable GCalendar which will hold the synchronized Google Calendar entries


  • Maintain the translation table monthMapping to map the names of the months to your local language. This is needed due to the fact that global variable “Month” could the name of current month in your local language – which is the case for me.


Once GCalendar global variable is synchronized with Google Calendar I can use it in "good morning" scene which is reading the agenda for the day once I'm brushing my teeth in the morning :-P 


Any comments highly appreciated. :D


Global variable GCalendar is holding the information on upcoming events. The information is structured in the following way:

GCalendar = { Name, StartDate, EndDate, WholeDay };

Name holds the name of Calendar event, StartDate and EndDate are the event's start and end-date accordingly, WholeDay is a flag with values "Yes" in case the event was defined as "whole day" and "No" if this isn't the case.



jompa68 did create VD which shows today's events from your calendar for current date. VD is attached below (hope you don't mind jompa68 but having it in the first post makes it easier to find :-) ). 




Update 8.3.2017

Thanks to @jompa68 I realized there is no handling of recurring events. Honestly I did not think this small topic can be so much complicated... anyway. Some basic recurrence rules should now be supported by the script.


Update 12.3.2017

@emielstroeve figured out that calendar events marked as "whole day" were not recognized by the script. Version 1.2 solves this problem by adding the missing functionality. I did extend the structure of GCalendar variable with additional field "WholeDay". The field contains "Yes" in case the event is defined as "whole day" otherwise the field is set to "No".

  • Thanks 1

User Feedback

Recommended Comments

Hi, Can you please explain wat goes wrong if I have the following error in the lua scene to collect my Gcal info?


Link to comment
Share on other sites

Line 107: ## local days_in_month = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; ##

And what if february has 29 days?





Link to comment
Share on other sites

On 6/1/2018 at 2:04 PM, CoenA said:

Hi, Can you please explain wat goes wrong if I have the following error in the lua scene to collect my Gcal info?



I had same error and changed the value under "local monthMapping".

Left column should be the months as displayed in Google calender (in my case Dutch) right English. 



Does anybody know how I can use google calender in other scenes?

I'd like to change a variable based on a meeting in mij agenda.


So when meeting with subject X is ongoing I want a global to switch to "on". When meeting is finished the global should switch "off"




Edited by julesmartens
Link to comment
Share on other sites

Hi jcichon01,


many thanks for your script. It would really help me if I could get it in operation. Is it still running on your HC2 without any problens? Whatever I do, I always get the information: Synchronisation completed, Add total of: 0 calendar entries.

I really don't know whats going wrong. The global variable is there, but the content is {}. I used the public as well as the private google ics address.


As I get the note ' Synchronsation complete' it seems that the link to the calendar is correct. As the global variable has the entry {} the script writes something into this variable. But without any content.


Do you know whats going wrong? Is this a Fibaro problem?


Best regards



2020-09-30 07_40_09-SandboxieControlBorderWindow.png

Link to comment
Share on other sites

Hello, I want to ask does not show events in my calendar that are repeated, for example, once a month or once a year, is there a correction? Well thank you.

Link to comment
Share on other sites

Hi jcichon01,


firstly, many thanks for your script. I think that is a great work.

I have the same problem than SteMo_33, I mean, I execute the scene and the message is "Synchronization completed" but the content of the global variable  is {}, and the resume message is "Added total of: 0 calendar records.", even though I have several events during the hole month.


Could you help me to solve the problem?.


Thank you in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...