Using the agenda/calendar in scenes

Citation
No problems, there was nothing negative in my message!! :stuck_out_tongue:

No worries, it’s just my first real PR so I wanted to make sure I did things right to not break everything :wink:

@Romuald_Pochet For information, for calendar sharing, we are considering two types of calendars with @bertrandda:

  • « Shared Â» calendar accessible to all users of the Gladys instance and in the scenes
  • « Private Â» calendar displayed only in the « Calendar Â» view for the user who configured it.

So for you, you will need to make a request to retrieve all « shared Â» calendars in the scenes.

The discussion is available here:

For your information, I just merged the calendar sharing, so work on the scenes can resume :sunglasses:

Hello everyone!

As this feature is quite requested, and as I just merged a PR that unlocks this behavior, I worked on a small functional specification so that we can at least agree on the desired functionality (that’s the hardest part :p).

Functional specification for the scene trigger

I propose a trigger in the scenes that could be configured as follows:

Features:

  • Ability to trigger a scene if any event from a calendar occurs in XX minutes/hours/days. Possibility to select one or more calendars. The calendar must be a shared calendar, as scenes are shared within an instance.
  • Ability to add a condition on the event title. Ex: is exactly « music lesson Â», contains « pool Â», contains « work Â», contains « school Â», starts with « Class Â», ends with « volley Â».
  • The trigger runs in advance relative to the start or end date of the event: 10 minutes before, 1 hour before, 1 day before. The finest granularity is the minute. It is possible to set 0 minutes to be notified at the start/end time of the event.

Functional specification for the condition in the scenes

For the conditional part in the scenes, the idea is to be able to continue or interrupt a scene if an event in one/more given calendar meets a condition and is ongoing.

Example:

  • If a movement is detected
  • There is an event in the calendar that is ongoing that says I am at work
  • Then send me a message

Proposal:

What do you think?

For information, I have started the developments, for now only on the scene trigger.

The backend part is almost finished, I’m working on the frontend now.

@bertrandda I had to change a bit the GET /calendar request, in short I needed an option to retrieve only the shared calendars (and not my private ones), so I added 3 cases:

  • No parameters provided → all calendars I can see (private to me + shared)
  • shared = true → Only shared calendars
  • shared = false → Only my private calendars

I thought about updating the frontend code.

It was necessary because now in the scenes only the shared calendars are accessible.

The PR on Github is here:

https://github.com/GladysAssistant/Gladys/pull/1443

The complete view with all options:

Do you also take into account holidays, etc.?
Or do you only manage certain filters on email titles?

I’m not managing any of this!

The purpose of this feature is to give the user the ability to trigger scenes based on upcoming events / those that are about to end in their calendars, after that it’s up to the user to connect their own calendars.

The calendar content is personal to each user, I just provide the tools to create the scenes :slight_smile:

If you want to connect a calendar with vacations, holidays, the day you go swimming, your kids’ school, everything is possible!

Are we in agreement that there is no built-in calendar in Gladys, it’s just synchronization with a third-party service?

I would use it well for heating periods in a dedicated calendar


Oh, I see.
That’s not a bad idea, it saves you from having to get a library that calculates public holidays based on a given country.
It’s another way of looking at things, like it prevents library errors.

Exactly, we consider that we are not here to code a complete calendar client (it would be a lot of work, and it’s not really our job)

The idea is that users keep their classic calendar client, continue to fill in events on their phone/computer as they already do, and then we just synchronize with it.

You can create a specific calendar anywhere for your heating periods and it will do the job :slight_smile:

Exactly :slight_smile:

For example, for public holidays, by default my calendar has a « public holidays Â» calendar I think, and Gladys synchronizes it. You just need to connect to this calendar, not put a filter on the name to catch all events, and there you go, you manage public holidays in Gladys.

Great job, this will be useful to many people.

Once again @AlexTrovato was right from the start :laughing: Add internal calendar sharing by bertrandda · Pull Request #1337 · GladysAssistant/Gladys · GitHub

Hello everyone!

I’ve made great progress today, and I’ve merged into master the first part of this development: triggering a scene based on an event that is happening or about to end.

Concretely, what is possible to do

  • « Send me a message 15 minutes before going to the gym Â»
  • « Wake me up 1 hour before a work event Â»
  • « If the event â€č Disneyland â€ș starts in 1 hour AND the house is not empty Â» → Flash in the living room to warn us that we need to leave!
  • « Start the heating when there is an event that starts and is called â€č heating â€ș, and stop the heating when there is an event that ends and is called â€č heating â€ș Â»

These are just a few examples, but of course the possibilities are endless!

What does it look like?

What is powerful is that it is possible to retrieve in the actions the event that triggered the scene! :sunglasses: and this gives:

I can already see @lmilcent telling me: « but wait? are we going to be able to use the sensor values of the triggers in there?? Â» Maybe in the future yes!! :smiley:

Video demonstration

I recorded a video that shows an example :slight_smile:

https://streamable.com/bfkp2u

How to test?

I made a Docker build on the :dev tag as usual.

The Docker image is as follows:

gladysassistant/gladys:dev

I welcome any feedback, if you have time to test this weekend that would be great :slight_smile:

For the second part of the development, it will be later, I will keep you informed of the progress!

:rofl::rofl:

This is great, I love these messages: « hey look at the new super powerful feature I just made Â» :heart_eyes:

Thanks so much for the work!!

Well, for the heating example, first of all, it has to be supported by Gladys :sweat_smile:

I didn’t dare to say it, but I think it’s a feature that is being developed in secret to surprise the community :wink:

I don’t want to dash your hopes @spenceur but that’s not the case :joy:

Heating is a big topic, and 90% of the work is defining what we want to do. Right now, we’re still at level 0, nothing has been done yet.

You’re tough, I’d say 5% already (see the feature request and the start of reflection) :innocent:

I’m trying to test the feature this weekend!

And did you add the â€č flash for
 â€ș or â€č flash until â€ș function? :smiley:

Turn on the light + wait 1sec + turn off the light, that should do it, right? :slight_smile:

Couldn’t we have a condition that if there is an event in calendar x, then an action is taken?

This would allow me to do this:
If there is an event on a public holiday in the holiday calendar, then we notify the head of linote that he can go back to bed