# Control Devices when windows are closed

**URL:** <https://community.homey.app/t/control-devices-when-windows-are-closed/116451>\
**Category:** Questions & Help\
**Created:** [September 20, 2024, 10:22pm UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451 "2024-09-20T22:22:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rossome2648](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rossome2648/32/79242_2.png) [@Rossome2648](https://community.homey.app/u/Rossome2648)\
**Post date:** [September 20, 2024, 10:22pm UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/1 "2024-09-20T22:22:55Z")

</div>

Hello Homey Community,

I have successfully set up my air filter (Govee) and thermostat (Ecobee) to turn off when **any** window is opened, and it’s working great! However, I’m facing a challenge when closing the windows.

Here’s how I currently have it configured:

 ![Screenshot 2024-09-20 at 3.14.59 PM](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/4/9420aa0bfe70b39937a52c4cfc872ed91062f3aa.jpeg)

Unfortunately, this setup isn’t functioning as expected. I believe the issue is that not all window sensors are being triggered to “off” because not all windows were opened.

Is there a way to check the status of **all** window sensors, and once **all** windows are closed, automatically turn the thermostat and air filter back on?

If this is possible, it would be amazing to implement!

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [September 21, 2024, 12:45am UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/2 "2024-09-21T00:45:06Z")

</div>

Hello Ross,

You’ve discovered a ‘need to know’ unfortunately.  
It’s a pity the editor does not say _No_ when one wants to connect trigger cards to an ALL function;  
ALL cards are meant for states, not triggers.

> ![1000034465](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/f/8f74a369e20733d217bb1bafda4c4d4c9ddbfea8.jpeg)

Source:

> [@\[FAQ\]\[Advanced Flow\] Infinite canvas. Infinite creativity](https://community.homey.app/t/faq-advanced-flow-infinite-canvas-infinite-creativity/65145):
>
> Something advanced is coming to Homey Pro… For the AMA [Advanced Flow — Ask Me Anything](https://community.homey.app/t/advanced-flow-ask-me-anything/65167) speech_balloon The FAQ from Athom is already on the information page on the bottom. The link should automagically switch to your language (en/nl / etc…) Read the introduction from Athom here: [Advanced Flow](https://homey.app/advanced-flow/) The EXTRA Things you can do in Advanced Flow Have multiple Triggers Have 1 (one) Start (Starting the Flow) Have Delays (0 -999 Seconds, 0-999 min.) All (function to wait for all incoming trigger…

And the ANY function is optional; you can connect multiple (trigger) cards to the “input(s)” of (an) other conditional or action card(s), just by connecting them.

---

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [September 21, 2024, 3:11am UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/3 "2024-09-21T03:11:31Z")

</div>

You could change your flow so, that instead of the all, change it to any. Then add condition cards for each window if the they are all closed, do you action.

As Peter pointed out, multiple trigger cards on an “all” condition, will not work. Triggers are always run when the state happens.

---

<div class="post-metadata">

**Author:** ![Andy\_Henderson](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/andy_henderson/32/80642_2.png) [@Andy\_Henderson](https://community.homey.app/u/Andy_Henderson)\
**Post date:** [September 21, 2024, 6:58am UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/4 "2024-09-21T06:58:52Z")

</div>

If you don’t have an And card to give you a window’s status, use a variable to record the state of each window as it changes. You can then test the state of all of them when any window closes.

---

<div class="post-metadata">

**Author:** ![Rossome2648](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rossome2648/32/79242_2.png) [@Rossome2648](https://community.homey.app/u/Rossome2648)\
**Post date:** [September 21, 2024, 5:55pm UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/5 "2024-09-21T17:55:04Z")

</div>

Ok, that’s good to know! Do you recommend an app that can get the state of devices? My windows are actually Virtual Devices - my alarm system doesn’t integrate with Homey but does Homebridge, so I have that connecting to Apple Home and then the Virtual Devices reflect each window. Is there a way to get the state of the Virtual Device?

Any suggestions are welcome - I’m getting into more advanced flows for my home and I am enjoying it so far! @Andy_Henderson - how can I use a variable to get the state?

---

<div class="post-metadata">

**Author:** ![Rossome2648](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rossome2648/32/79242_2.png) [@Rossome2648](https://community.homey.app/u/Rossome2648)\
**Post date:** [September 21, 2024, 7:38pm UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/6 "2024-09-21T19:38:07Z")

</div>

After messing around with it a little more, I got it to work!

 ![Screenshot 2024-09-21 at 12.37.20 PM](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/f/7f1846e8f92f9b9f78debb3ad9fd52e1f154e8b8.jpeg)  
Thanks for your suggestions - it works wonderfully!

---

<div class="post-metadata">

**Author:** ![Andy\_Henderson](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/andy_henderson/32/80642_2.png) [@Andy\_Henderson](https://community.homey.app/u/Andy_Henderson)\
**Post date:** [September 23, 2024, 11:46am UTC](https://community.homey.app/t/control-devices-when-windows-are-closed/116451/7 "2024-09-23T11:46:40Z")

</div>

> [@Rossome2648](#):
>
> how can I use a variable to get the state

It’s a useful technique in a number of situations. You set a variable to true when a given trigger occurs and to false when another trigger occurs. You can then test the variable in another flow.
