# Flows with exit status or functional blocks

**URL:** https://community.homey.app/t/flows-with-exit-status-or-functional-blocks/92059
**Category:** Flows
**Created:** [October 17, 2023, 2:03pm UTC](https://community.homey.app/t/flows-with-exit-status-or-functional-blocks/92059 "2023-10-17T14:03:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tiwas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiwas/32/10066_2.png) [@Tiwas](https://community.homey.app/u/Tiwas)
#### Post date: [October 17, 2023, 2:03pm UTC](https://community.homey.app/t/flows-with-exit-status-or-functional-blocks/92059/1 "2023-10-17T14:03:38Z")

</div>

Is there any way to create functional blocks of code for use in flows?

I have the following block already:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/6/860645c178e63f4ad35ea74df46d03e56f6443f1.png)

I’m going to add four more of these sensors to turn my airconditioner on/off, which will make it even worse. For some of them, I can create a group, but for the ones I need more advanced testing (like for my bedroom - if the window is open, but the door is closed, the aircon can run / if the window is closed, but the door is open, the aircon can run / if both of them are open, the aircon can not run). I’m also going to create other zones with more than one “layer” to test.

And this function block is going to be reused for other functions as well - both for aircon, floor heating etc.

So…would it be possible for me to collect these in some way? Is it possible to test for exit status? Is it possible to call another flow with the name of a variable to modify (I cannot use a set variable in the flow, as I won’t be able to control parallell execution)? Any other way (except for scripting)?

Thanks!

---

<div class="post-metadata">

### Author: ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)
#### Post date: [October 17, 2023, 6:36pm UTC](https://community.homey.app/t/flows-with-exit-status-or-functional-blocks/92059/2 "2023-10-17T18:36:29Z")

</div>

Use Advanced Triggers app to create a “function” to group units.  
This flow can return state/status.

---

<div class="post-metadata">

### Author: ![Tiwas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiwas/32/10066_2.png) [@Tiwas](https://community.homey.app/u/Tiwas)
#### Post date: [October 17, 2023, 6:49pm UTC](https://community.homey.app/t/flows-with-exit-status-or-functional-blocks/92059/3 "2023-10-17T18:49:49Z")

</div>

Thanks! Will try that tomorrow 🙂
