# Making functions with flows?

**URL:** <https://community.homey.app/t/making-functions-with-flows/131739>\
**Category:** Questions & Help\
**Created:** [February 27, 2025, 9:10pm UTC](https://community.homey.app/t/making-functions-with-flows/131739 "2025-02-27T21:10:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Litego](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/litego/32/121579_2.png) [@Litego](https://community.homey.app/u/Litego)\
**Post date:** [February 27, 2025, 9:10pm UTC](https://community.homey.app/t/making-functions-with-flows/131739/1 "2025-02-27T21:10:47Z")

</div>

So I have a bunch of different functions that act the same way but has to be applied to a bunch of different devices. Currently I build and test the function in one flow, then when I am happy with it I copy it to all the devices. Problem with that is first of all it’s a lot of work copying and pasting, as I have to manually go over and change all the variables and devices to the new flow, bound to make mistakes. And if I have to make changes to the function (which happens a lot) I have to make the same change multiple times.

I would like to just call a function that sets all the local variables to the global variables and devices. This way if I need to make a change I only have to do it once. And when I add a new device I just have to set the variables one time.

I know (assume\*) it can be done through HomeyScript, but I don’t know how to script and was hoping it is possible through flows somehow, maybe with som apps?

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [February 27, 2025, 9:17pm UTC](https://community.homey.app/t/making-functions-with-flows/131739/2 "2025-02-27T21:17:27Z")

</div>

You can use the “[flow exchanger](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/3)”  
You can also use it to share to yourself 🙂

1 create the exchange file  
2 create nthe required new variables  
3 load the exchage files  
4 during the load indicatie which variable needs to be replaced by which new one

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [February 27, 2025, 9:22pm UTC](https://community.homey.app/t/making-functions-with-flows/131739/3 "2025-02-27T21:22:08Z")

</div>

What can also be usefull in this case: create “scenes”, a seperate flow that sets the devices  
(See my thread [“how to structure your flows”](https://community.homey.app/t/how-to-structure-your-flows/25109)

Thhat wayyou only need to replace the “scene” flow with another.

---

<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:** [February 28, 2025, 6:43am UTC](https://community.homey.app/t/making-functions-with-flows/131739/4 "2025-02-28T06:43:35Z")

</div>

Checkout the “Advanced triggers” app.  
I use it for checking temperature.

I have created a text variable holding a JSON string: {“devivice1”:“state1”,“device2”:“state2”…}.  
The flow is triggered by a “Advanced trigger” card, with the device name and the state (normal/high/low).  
Then I use “JSON handler” app to find (or create) the device and take action depending on state.

 ![TempCheck1](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/a/6ad1b3343c74de986020ffeb44fcc9e20ba2528a.png)

 ![TempCheck2](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/d/8db1dfa6ece03c58e859317834fee506bb77fcaa.png)

I could have sent the current temperature, min-temp, max-temp and normal-temp but as I uses “becomes greater/less” I already new if it was too low/high.
