# Trigger: combining two variables

**URL:** <https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569>\
**Category:** Demande de fonctionnalités\
**Created:** [November 30, 2023, 8:54pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569 "2023-11-30T20:54:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabic](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/f/a698b9/32.png) [@Fabic](https://community.gladysassistant.com/u/Fabic)\
**Post date:** [November 30, 2023, 8:54pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569/1 "2023-11-30T20:54:41Z")

</div>

Hello,

I couldn’t find this feature request, but if it already exists you can delete this message.

I suggest being able to combine two (or more) variables at the trigger level:  
If condition1=true AND condition2=true then action1 then action2 …

As I understand the application, this seems almost essential and would probably reduce the need for Node-RED flows.

Here’s an example:  
Trigger =\> If temperature\<18°C AND Night  
Action =\> Turn on heating

The second possibility, but perhaps less clean, would be to be able to create «&nbsp;devices&nbsp;» or «&nbsp;virtual variables&nbsp;» that would take the value «&nbsp;true&nbsp;» if the 2 (or more) conditions were met.

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [November 30, 2023, 9:25pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569/2 "2023-11-30T21:25:36Z")

</div>

Hi!  
You need to take one followed by a ‹&nbsp;continue only if&nbsp;› condition for the other.  
For the heating, I had made a tutorial:

> [@\[Tutoriel\] \[MAJ\] Thermostat "fait maison" et intégration/programmation dans Gladys](https://community.gladysassistant.com/t/tutoriel-maj-thermostat-fait-maison-et-integration-programmation-dans-gladys/6519):
>
> [MAJ 20-11-23] Ajout de l’utilisation de l’appareil «&nbsp;Thermostat&nbsp;» sur le tableau de bord pour gérer la température de consigne. Bonjour à tous ! Je propose de vous partager mon thermostat, système de gestion de la chaudière, entièrement fait «&nbsp;main&nbsp;». (Oui, je sais, ça manque d’un coup de peinture wink mais la tablette précédente, tombée en rade était plus grande et cachait ce chancre !) Tout d’abord, il faut savoir ce qu’est un thermostat et ce n’est pas bien comp…

The programming part is for you 😉

---

<div class="post-metadata">

**Author:** ![Fabic](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/f/a698b9/32.png) [@Fabic](https://community.gladysassistant.com/u/Fabic)\
**Post date:** [November 30, 2023, 9:50pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569/3 "2023-11-30T21:50:06Z")

</div>

@GBoulvin, not bad, I hadn’t seen that we could take the problem that way.

However, even if it’s doable today, I think we can gain clarity and reduce the number of scenes with an AND in the triggers rather than launching the scenes every x amount of time.

It seems logical to fire a trigger if and only if all conditions are met.

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [November 30, 2023, 10:07pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569/4 "2023-11-30T22:07:40Z")

</div>

In Gladys’ logic that doesn’t really make much sense…  
An event must be the trigger, so even if you want to have several conditions met, you must set 1 event as the trigger (ex: change in temperature), and then you test your 3 conditions in the scene, either in parallel or one after the other, as you wish.

To take your example, it would look like this:

TRIGGER :  
change of state of a device: temperature

ACTION 1 :  
get temperature state  
get brightness state

ACTION 2 :  
continue only if temperature \< 18°  
continue only if brightness = 0

ACTION 3 :  
the actions you want to run

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [November 30, 2023, 10:09pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569/5 "2023-11-30T22:09:39Z")

</div>

Debate as old as Gladys ^^  
@pierre-gilles has already talked about it on another topic, and he sticks to his choice regarding triggers.  
You’ll need to do as @GBoulvin advised you and use multiple scenes ^^

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [November 30, 2023, 10:17pm UTC](https://community.gladysassistant.com/t/declencheur-combiner-deux-variables/8569/6 "2023-11-30T22:17:16Z")

</div>

On other solutions you can say that an event is composed of several devices and trigger on that event.  
For example you put your door-opening devices, motion sensors into a security event.  
And the scenes are triggered by the security event.  
Here Gladys does essentially the same thing except that we add the devices as scene triggers.

But in no case can a trigger be conditioned by another 🙂

[quote=«&nbsp;guim31, post:4, topic:8569&nbsp;»]
