Scenes: multiple triggering conditions (AND/OR)

I would like to be able to activate a scene based on several mandatory criteria.

For example:

  1. If it is between 23:00 and 00:30 and my front door opens,
  2. Then turn on the entrance light in case of motion.

Another example:

  1. If sensor X and sensor Y
  2. Then action Z

For now, the triggers are in parallel, in « or » mode. They cannot be combined to continue.

The ‹ continue only if › function, combined with ‹ retrieve the last device state ›, allows you to do this…

See here: Récupérer le dernier état | Gladys Assistant

That’s true, we can manage with it. But I find that it adds complexity and lacks flexibility.

For example, if you want to add a condition to an already somewhat long scene, you have to delete everything and rewrite it.

With an « and » option, you can add a condition right at the beginning.

And this case has already happened to me several times.

And in the following case it doesn’t work:

  1. If the front door opens
  2. If it’s between 23:00 and 01:00

Absolutely agree, it’s not extremely intuitive

You need to add a dummy device, like for heating (no time interval management):

  1. If the door opens
  2. Retrieve the last state ‹ dummy device ›
  3. Continue only if ‹ dummy device › =1
  4. The door opens

In parallel, your ‹ dummy device › changes state depending on the time, thanks to two scenes

  1. If it’s 23:00, ‹ dummy device › =1
  2. If it’s 01:00, ‹ dummy device › =0

That’s a good point, I hadn’t thought of doing that. How do you create the dummy device?

In any case, this feature request does have some interest :sweat_smile:

Indeed, I think it will go through a « continue only if », but I think this feature is interesting because it is not possible to make time comparisons for now :slight_smile:

The story of fake devices seems a bit hacky, it should be possible to do this natively easily!

I saw the PR with the scene deactivation, can we modify it with an activation within a time slot instead?

You simply add an MQTT device.
This idea was proposed by M. Scènes, @Terdious, and explained here: Gestion chauffage - #19 par Terdious

For me who has several scenes that do the same thing but at different times (turning on/off outlets), it would also be interesting to have the OR function. This would allow me to avoid duplicating my scenes.

If you say there is a way to work around this via dummy devices, I will look into it.

I agree with you on that!
As soon as we talk about « bypassing » it’s clear that something needs to be done in Gladys :joy:

I agree too. We need to add this natively :slight_smile:

Good evening,
Great idea to add the « and » in the trigger.
To go a bit further, I suggest using parentheses to optimize the number of scenes. For example:
Trigger = (sensorA OR sensorB) AND (sensorC OR sensorD)

In fact, it’s already possible in the conditions:

  • Multiple conditions in a single step, equivalent to « AND » (default behavior)
  • A condition in which you click the explicit « OR » button, then it’s « OR ».

But I agree with you that it’s not clear enough in the UI. A description or a « tooltip » would be needed.

Yes, exactly, but this means programming the « trigger » in an « action », which is confusing.
If the philosophy of Gladys is that anyone can automate, any combinatorial variable should be able to be composed in the trigger!

I think we can close this feature request, all the examples you gave in the request are now possible :slight_smile:

Is it okay with you if I close this request?

Yes, I think we can close it, I can finally turn on the light in my kitchen when I get back from walking my dog :wink:

Where some may not understand is that the « AND » condition to trigger a scene will be done in a dedicated test and not on the scene launch conditions.

  • Example: to say « if movement » and « door opening », you will need to configure these two events at the beginning of the scene and then use « continue only if » to know if the scene is executed or not.

Okay, I’m closing the topic.