Google calendar: Show the next 5 entries

Hi,
before I change to openHAB I use a own solution, there I use wget -command to download the whole entries from the calendar, and in next step I search for the next (5) upcoming dates to display them … (dirty solution…)

Is there a bether solution available to get the next 5 enries from the Google calendar (and display them in 5 lines i.e.: : <Event (uo to 30 chars)>) , or have I to use my dirty solution again (sending 5 lines with mqtt …) :wink:

You might be able to do this with the gCal or CalDAV bindings. I don’t use either but both will work with Google Calendar.

If not your dirty solution will probably be easiest.

Hi @Topsurfer
I would love to see your dirty solution, please

OK …

Two scripts, the first (get_goca.sh) get the data from google and store into a file,
The second script (goca_build_html.sh) will select the 5 actuall entries and write these lines into a html-file …build_goca_html.sh.txt (1.1 KB)
get_goca.sh.txt (1.5 KB)

Just tested on new Raspberry which is running the oH, still working :wink:
But not implemeted in anything, just started on the shell!

Output (-v) (html removed):

  • 27.11.2018, 19:00: Sperrmüll rauss
    29.11.2018, 19:30: Zahnarzt
    29.11.2018, -=:=-: Sperrülll
    01.12.2018, -=:=-: Fegro Verlosung
    02.12.2018, 18:00: EM Auslosung

How will the output looks like if using the gCal or CalDAV bindings?
Has anyone a screenshot what is poosible with them ?

1 Like

Nice I have your script partly working, I am fetching and getting goca_sorted , goca_unsorted, goca_tmp.tmp but they appear to be the same where message.html is empty, goca_lines gives

> <span style="color: #;">GOCASTARTDATE</span><br>
> <span style="color: #;">19.02.2019, 22:00: gcal new test
> </span><br>

but good to get this far, thanks

I have had gCal binding working previously , its stopped currently ( unsure why ) It can when working receive commands from the send line defined in the calendar entry description eg send gBin ON , Where gBin is the Item with new state ON

where as your script pulls from the summary I am guessing

I am missing your SetGlobalVaribles .sh depending how that effects these

Hi,
there was an error on my side, because the html output I has not tested realy, because to build html from a textlines is (at the end) a “simple” loop over the existing sorted calendar file (here: Goca_Sorted).

But now I test and (hopefully) fix it.
And don’t forget: It’s a quick and dirty programing / shell-script!

The “setGlobalVariables.sh” is no longer needed, before openHAB I declare there some colors, fontsizes etc.

build_goca_html.sh_v2.txt (1.7 KB)

The output looks now like this, but simple to modify …:

goca-html

much better, i was tweeking the script to get it to spot known items for calendar control of items with some tolerance of Case and syntax variation, I am getting stuck with
the internal format of date time compared to google calendar