# Calculate with variables and values

**URL:** <https://community.homey.app/t/calculate-with-variables-and-values/92876>\
**Category:** Questions & Help\
**Created:** [October 26, 2023, 12:32pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876 "2023-10-26T12:32:15Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![kai.wagner.83](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kai.wagner.83/32/19579_2.png) [@kai.wagner.83](https://community.homey.app/u/kai.wagner.83)\
**Post date:** [October 26, 2023, 12:32pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/1 "2023-10-26T12:32:15Z")

</div>

Hello,  
having some issue of understanding and need some help.  
Here I want to describe what I want to do:  
Get value from device a, get another value from device b.  
Compare values and if difference is more than 5 do any action in the flow.

Any idea how to do that?

Kind Regards  
Kai

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [October 26, 2023, 12:38pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/2 "2023-10-26T12:38:10Z")

</div>

Look for logic cards. See [Switch floorheating pump on Evohome trigger](https://community.homey.app/t/switch-floorheating-pump-on-evohome-trigger/92789/1)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [October 26, 2023, 1:22pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/3 "2023-10-26T13:22:38Z")

</div>

Only with build-in logic flow cards:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/7/e71be17fc5857d486dea264a67268974bd613216.png)  
A numeric variable is needed. Here _ **BeispielVariable** _.

* * *

If you need the result only for this flow, then you can use the app [Temporary Variables](https://homey.app/en-us/app/com.spkes.temporaryVariables/Temporary-Variables/) and build-in logic flow cards:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/5/459655a9a0594f04629addd37362e5281814eac7.png)  
No numeric variable is needed.

I guess there will be also a more professional calculation way, but it works. 😉

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [October 26, 2023, 1:38pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/4 "2023-10-26T13:38:58Z")

</div>

On HP2023 also with normal flow:  
(Picture below has changed after some comments below)

 ![IMG_2869](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/d/5d41e709b90f9c4b5895b714d33a0ec5ac0319f7.jpeg)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [October 26, 2023, 2:04pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/5 "2023-10-26T14:04:50Z")

</div>

This is not the way how it works. Or I misunderstand what @kai.wagner.83 needs.

**Example**  
The current value/temperature of _ **Ingestelde temperatuur** _ is 20 °C.  
The current value/temperature of _ **Temperatuur** _ is 24 °C.  
By adding 5 °C to _ **Ingestelde temperatuur** _ (= 25 °C), the temperature is greater than of _ **Temperatuur** _ (24 °C), but the difference are just 4 °C.

And this is what Kai wrote:

> [@kai.wagner.83](#):
>
> Compare values and if **difference** is more than 5 do any action in the flow.

Hope it’s understandable what I mean. But maybe Kai will explain in more detail what exactly he needs.

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [October 26, 2023, 2:06pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/6 "2023-10-26T14:06:46Z")

</div>

I think both solutions give a jump start for Kai to experiment and to find out what he wants 😁 and how to make the formula:

a-b \> 5  
a \> b+5  
a-5\>b  
Etcetera….

---

<div class="post-metadata">

**Author:** ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)\
**Post date:** [October 26, 2023, 2:25pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/7 "2023-10-26T14:25:28Z")

</div>

> [@Rmb](#):
>
> On HP2023 also with normal flow:

Pls, don’t calculate every hour /minute / second… there is no need to it is the worst trigger they implemented…

Homey is build to:

1. trigger if something changes (Temperature1 or Temperature2)
2. something else that makes you need it. (Any other trigger, in an advanced flow when you need the result)

but why calculate something 1440 times a day while you probably only need it a couple of times, in my opinion that’s just a bad habit…

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [October 26, 2023, 2:38pm UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/8 "2023-10-26T14:38:50Z")

</div>

I agree.  
The short answer to the guestion asked by Kai is “use logic card number 7”. But as I don’t know Kai’s knowledge, I give a complete simple flow, to add some context.  
In this specific case I better had the flow starting with “when this flow has started”.  
In the case where this example comes from, you finally need two triggers, change of actual temp and change of set temperature. You can do it in two normal flows or by one advanced flow. What ever the requester wants and is used to. But that is beyond the question being asked here. But I think I leave some points to find out by the requester, so he/she will learn. And not just copying ready to run solutions.

---

<div class="post-metadata">

**Author:** ![kai.wagner.83](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kai.wagner.83/32/19579_2.png) [@kai.wagner.83](https://community.homey.app/u/kai.wagner.83)\
**Post date:** [October 27, 2023, 4:27am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/9 "2023-10-27T04:27:14Z")

</div>

Let me explain my intention:

I have got some tado radiator thermostats and some partly netatmo and some switchbot Meter Plus temperature sensors.  
So I want to do the following:  
If temperature on netatmo sensor is changing and the temperature shown of the netatmo sensor is more than 0,5 degree higher the tado thermostat should decrese its temperature.  
So I want to keep the temperature near the temperature I decided to have in a room.  
Same if it is getting more than 0,5 degree colder than set on the tado.

Maybe you can help me better now or understand what I need here 🙂

Thanks for your help so far

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [October 27, 2023, 6:58am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/10 "2023-10-27T06:58:11Z")

</div>

Maybe you can share your flow so we can advise?

---

<div class="post-metadata">

**Author:** ![kai.wagner.83](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kai.wagner.83/32/19579_2.png) [@kai.wagner.83](https://community.homey.app/u/kai.wagner.83)\
**Post date:** [October 27, 2023, 7:09am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/11 "2023-10-27T07:09:24Z")

</div>

In the mean time I tried to build that on my own with help of some screenshot from @DirkG

Looking like that:

 ![Screenshot 2023-10-27 090710](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/f/0f17ec8fe18b94bd536f08fd3a302b8eca3ff3b0.png)

What is your opinion about that?

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [October 27, 2023, 7:42am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/12 "2023-10-27T07:42:20Z")

</div>

Wow, that is much more than I expected.  
I think you’re on the right road, and I am not so good in reading flows. However you might add another trigger. Because the flow below shall be triggered as well as the actual temperature has changed as well as when the set temperature has changed.

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [October 27, 2023, 8:46am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/13 "2023-10-27T08:46:55Z")

</div>

I guess it will work. The only thing I would change is to use a timer app like Chronograph instead of the build-in delays. Because:  
– It’s not possible to stop or adjust the build-in delays (maybe not needed in this flow)  
– The Chronograph timers will continue after a restart (for what reason ever) of Homey, the build-in delays not

I use the build-in delays just for short periods, max. 1-2 minutes. But it depends also on the background of the flow, e.g. watering of the plants.  
Example in your flow, if Homey “dies” after _ **Ausschalten** _, the heating will be turned off until one of the other flows set the heating again to _ **Intelligenten Zeitplan fortsetzen** _, because the 60 min. build-in delay will be interrupted:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/4/540d477956c1c043057f9dea70af53a144ffcd06.jpeg)

---

<div class="post-metadata">

**Author:** ![Mark\_Broadhurst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mark_broadhurst/32/80103_2.png) [@Mark\_Broadhurst](https://community.homey.app/u/Mark_Broadhurst)\
**Post date:** [April 28, 2024, 2:20am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/14 "2024-04-28T02:20:46Z")

</div>

I am just trying to pass the current temperature to a variable and then to a notification but it so difficult to get any tips from the flows shown when they are not in English… any tips on how to achieve this?

---

<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:** [April 28, 2024, 2:53am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/15 "2024-04-28T02:53:40Z")

</div>

Hello Mark, welcome.

You can do this for example:  
First create a text variable, I called it  
‘Weather temperature’

 ![Screenshot from 2024-04-28 04-43-57](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/7/d7458d2a81ae84f3fdf3280859828d51943df2b0.png)

![Screenshot from 2024-04-28 04-43-33](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/0/f09a1343e43bcebcd6cd530ee9dc9d1f271deb01.png)

The blue [Temperature] tag in the cards it’s in, is from Homey ‘onboard’ weather, you can select it like this:  
Inside the (timeline) card, click the ‘tag’ icon on the right hand side  
Then you can pick the Temperature tag:  
 ![Screenshot from 2024-04-28 04-49-57](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/d/7d7fbd3ce904278cb34d597ef30be7bd8576abce.png)

.  
Also don’t forget to search the knowledge base, there’s lots of info available:

> **[Using Homey Logic in Flows](https://support.homey.app/hc/en-us/articles/4410240765586-Using-Homey-Logic-in-Flows)**
>
> You’ve probably seen Homey Logic. Once you get the hang of it, it's a great tool for any smart home. By creating your own Variables and using these in your Flows as Tags, you can often accomplish c...

---

<div class="post-metadata">

**Author:** ![Mark\_Broadhurst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mark_broadhurst/32/80103_2.png) [@Mark\_Broadhurst](https://community.homey.app/u/Mark_Broadhurst)\
**Post date:** [April 28, 2024, 3:34am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/16 "2024-04-28T03:34:22Z")

</div>

Peter,

Thank you so much for your assistance.

However I am having great difficulty in following…

1. Only one of the screen shots is active.
2. The 'Then - Calculate… card requires numeric arguments but you recommended creating a text variable.

Sorry for the trouble…

Regards,  
Mark Broadhurst.

---

<div class="post-metadata">

**Author:** ![Mark\_Broadhurst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mark_broadhurst/32/80103_2.png) [@Mark\_Broadhurst](https://community.homey.app/u/Mark_Broadhurst)\
**Post date:** [April 28, 2024, 5:57am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/17 "2024-04-28T05:57:18Z")

</div>

Also… I’v been searching for hours for the internal (i.e. ‘onboard’) weather… I cannot find it anywhere…

Please help…

Regards,  
Mark Broadhurst.

---

<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:** [April 29, 2024, 1:16am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/18 "2024-04-29T01:16:25Z")

</div>

My pleasure, Mark.

Awwww my bad, for some unknown reason 🤭  
I wrote “text variable”, but it should have read “numeric variable”.

BTW you can determine the var type by their color.  
Blue: num  
Green: text  
Orange: bool

.

> [@Mark\_Broadhurst](#):
>
> searching for hours for the internal (i.e. ‘onboard’) weather… I cannot find it anywhere…

A screenvid says more than screenshots/words  
 ![GIF_20240429_031443_878](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/e/feef340a4540553c434d64ffa700105170a8b67a.gif)

---

<div class="post-metadata">

**Author:** ![Mark\_Broadhurst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mark_broadhurst/32/80103_2.png) [@Mark\_Broadhurst](https://community.homey.app/u/Mark_Broadhurst)\
**Post date:** [April 29, 2024, 1:40am UTC](https://community.homey.app/t/calculate-with-variables-and-values/92876/19 "2024-04-29T01:40:39Z")

</div>

Thank you for the information… I finally stumbled through (with the help of your single screen shot) and now have it working.

I have previously setup my whole smart house using Hubitat but I am now in the process of converting everything to Homey Pro… a sometimes challenging task.

Thanks again!
