runely / calendar-homey

Gives Homey flow cards to trigger on your calendar events
GNU General Public License v3.0
13 stars 9 forks source link

How to get all events that start within a certain time frame - at once? #545

Closed EsbenRasmussen closed 12 months ago

EsbenRasmussen commented 1 year ago

Hi Rune

It turns out the app is still unstable at times for me - however, it works like 2 thirds of the time it is turned on.

As a workaround and to prevent any instabilities to affect the rest of my processes on my Homey Pro 23, I have made a flow, which turns the app on at 1 in the night and then runs until 7 in the morning after which the flow disables the app (and the calendar flow using the app). see screenshot

In my flow I fetch events that start in 12 hours - and add the event title to a variable called "Esben: Todays events".

Skærmbillede 2023-11-04 103920

I do this for all in our family and when any one of us gets home, I have our Sonos speaker welcome that person and read aloud what is in that persons daily todo-list.

This works ok.

However, I would love to minimize the period, where the icalCalendar app is running and was wondering, it there is any way it would be possible to create a flow, which would let me do this:

At 1 in the night I enable the app and the calendar flow. In the calendar flow I fetch all events listed in the time period between 8 in the morning and 9 in the evening and for each event I get access to "do-stuff" with the title, description, calendar name etc. Then at 2 in the night or when the flow above is done, I turn off the app and the flow.

I realize this might require using some homey-script on my side, but I would be willing to work with that - if the option was there.

Do you know if it would be possible to achieve this?

runely commented 1 year ago

I'm sorry, but I can't replicate this unstabilities. Neither have I received any reports of this after the last couple of releases.

In development I have implemented two new action cards and setup a HomeyScript:

Action card 1: Retrieve a JSON representation of imported calendars Action card 2: Get an event given by a calendar and an event index HomeyScript: Use these action cards to retrieve the calendars and loop through the events

Will these action cards do what you want?

image

image

image

EsbenRasmussen commented 1 year ago

Yeah, I could try to work with that. I am not a programmer, but with the help of Stackoverflow and ChatGPT I am sure I can figure out how to work with the json-object. 👍😊

Not sure how much more complicated this would make your Awesome app, but an idea for a more non-programmer friendly approach could be:

Move the config of the app into the device object.

Let the user install several calendar devices. In each calendar device you can specifiy which calendar to fetch and how many days ahead to fetch. In addition you can specify to only fetch events within a certain time of the day (like between 8 In the morning and 9 In the evening).

Then you could offer a calendar device variable which is "amount of events".

The user could then create an iteration using logic cards and the variable and request a specific event based on the ID.

runely commented 1 year ago

Moving the config into separate calendar devices is a total rewrite of the app. And i don't see any huge advantages to having them in separate devices, other than the possibility to set separate sync schedules for each calendar.

With calendar config in separate devices you would have to have one trigger per calendar devices to get something triggered. The benefit of having the config in one place (like now) is that the same trigger will trigger for any of the calendars.

The two action cards i have created in development, alongside the HomeyScript will do pretty much what you want (besides setting separate sync schedules per calendar)

runely commented 12 months ago

These changes will be released in v2.4.0 which is in review by Athom and released to App Store when accepted