# Getting Started - Logic variables

**URL:** <https://community.homey.app/t/getting-started-logic-variables/20132>\
**Category:** Tutorials\
**Created:** [November 2, 2019, 12:54pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132 "2019-11-02T12:54:10Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 17, 2021, 1:18pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/41 "2021-03-17T13:18:37Z")

</div>

I am building a ArrayAdapter for this precicly in HOOP.

---

<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:** [March 17, 2021, 7:48pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/42 "2021-03-17T19:48:57Z")

</div>

Sounds good @Arie_J_Godschalk, but what is HOOP?

---

<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:** [March 17, 2021, 7:59pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/43 "2021-03-17T19:59:38Z")

</div>

@zakraket Glad 2 hear you discovered the magic yourself.  
I also didn’t get it at first🙃, but the THEN action card explains what do do

> ![Screenshot_20210317-205400_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/8/b8a8227fac95df6c672aacd4d76016075b7628e3.jpeg)

And how nice! The new testversion let’s you also calc trends live! No flows needed. Handy for troubleshooting  
[https://homey.app/nl-nl/app/ch.philippewechsler.trends/Insight-Trends/test/](https://homey.app/nl-nl/app/ch.philippewechsler.trends/Insight-Trends/test/)

> Tag “Average” value:
> 
> ![Screenshot_20210317-204552_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/e/7e38fb25cd3671e1d47ac117b49ea697ce3f9b42.jpeg)

Here r my 2 example flows:  
[https://homey.app/f/1QPM1x](https://homey.app/f/1QPM1x)  
[https://homey.app/f/IK1N1x](https://homey.app/f/IK1N1x)

> ![Screenshot_20210317-210827_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/d/cd7c525b6a0a56c9d2ba126be277b40066935356.jpeg)

As u can see, you can use calculated tag(s) for further use.  
Or did you mean someting else to re-use the tagvalue with:

> {“When you use calulate Trend in the AND section you can’t use the outcome in the THEN  
> f.e. IF trigger AND calculate Trend average \> 0 then set Var to Average  
> Outcome is not available as a tag, which might be a shame.”}

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 17, 2021, 8:04pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/44 "2021-03-17T20:04:16Z")

</div>

[H.O.O.P. (Hope) - Homey Object Oriented Programming - Apps - Homey Community Forum (athom.com)](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709)

---

<div class="post-metadata">

**Author:** ![zakraket](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/zakraket/32/17470_2.png) [@zakraket](https://community.homey.app/u/zakraket)\
**Post date:** [March 17, 2021, 8:24pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/45 "2021-03-17T20:24:08Z")

</div>

Yes, I’ve been playing with it for a few things now.

I have one flow that calculates several trends  
IF every minute  
AND…  
THEN  
calculate trend temperature  
calculate trend humidity  
calculate trend sunpower (from solarpanels)  
etc

Now I can create separate flows for each calculated trigger  
IF temperature trend calculated THEN f.e. put in var (for later use)  
IF humidity trend calculated AND value\<x THEN f.e. push to user

But I think the use of  
IF trigger AND calculated Trend \< value THEN something  
is limiting since the AND calculated trend is not available later on. It would be better if it was put into a tag (but maybe that’s just too difficult to build or whatever)

At least I now have real trendvalues to work with instead of values that go up and down and are not suitable for proper decisions.

In your example you don’t need the Start Flow 2 in flow 1 🙂

---

<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:** [March 17, 2021, 8:36pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/46 "2021-03-17T20:36:39Z")

</div>

So nice to hear this works for you!

I’ve created a logic NUM var:

 ![Screenshot_20210317-212711_Homey~01](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/105fb261946019eff685caa885b39e6932eced5c.jpeg)

With this flow I store the calculated value to the ‘Insights\_Average\_Saved’ var:  
[https://homey.app/f/FqRV1x](https://homey.app/f/FqRV1x)

> Outputted values:
> 
> ![Screenshot_20210317-213101_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/6/1612e413541366c4fb2781a469db329018069811.jpeg)

> [@zakraket](#):
>
> In your example you don’t need the Start Flow 2 in flow 1 🙂

**Edit** I see now​:laughing: Flow 2 gets triggered when the calculation has finished. Didn’t get that at first 🙃  
(Orig: While I’m just testing, it seemed handy for me to start flow 2 with flow 1, and then get my calculated value as in “real life”)

---

<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:** [March 17, 2021, 8:42pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/47 "2021-03-17T20:42:15Z")

</div>

Very very interesting Arie. I never got it why flows can’t be set up Macrodroid-wise, but u r going the right direction with H.O.O.P.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 17, 2021, 8:44pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/48 "2021-03-17T20:44:16Z")

</div>

Thanks, almost ready for release to HCS. Its been tested and fixed, and allready has more then i currently have written on the topics.

---

<div class="post-metadata">

**Author:** ![zakraket](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/zakraket/32/17470_2.png) [@zakraket](https://community.homey.app/u/zakraket)\
**Post date:** [March 17, 2021, 8:48pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/49 "2021-03-17T20:48:57Z")

</div>

yes, but it requires an extra flow. I have also set it up this way. But never mind, at least it works!

Btw what’s this screenshot? Is this the app? I don’t have this  
 ![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/f/afcaf7e5371ceba68bbde942a2da2b20ca39ed3e.jpeg)

---

<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:** [March 17, 2021, 8:56pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/50 "2021-03-17T20:56:07Z")

</div>

> [@zakraket](#):
>
> Btw what’s this screenshot? Is this the app? I don’t have this

As I wrote: The new testversion (of the app) let’s you also calc trends live, no flows needed. Handy for troubleshooting.  
Go to More\>Apps\>Insights Trends and hit “Configure app”  
Link to testversion:  
[https://homey.app/nl-nl/app/ch.philippewechsler.trends/Insight-Trends/test/](https://homey.app/nl-nl/app/ch.philippewechsler.trends/Insight-Trends/test/)

---

<div class="post-metadata">

**Author:** ![zakraket](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/zakraket/32/17470_2.png) [@zakraket](https://community.homey.app/u/zakraket)\
**Post date:** [March 17, 2021, 9:08pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/51 "2021-03-17T21:08:18Z")

</div>

Sorry, missed this between the screenshots , tnx

---

<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:** [March 17, 2021, 10:11pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/52 "2021-03-17T22:11:03Z")

</div>

I wasn’t gonna call you names, yet 😉 😉 😉

---

<div class="post-metadata">

**Author:** ![Simon\_Skotheimsvik](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/simon_skotheimsvik/32/34205_2.png) [@Simon\_Skotheimsvik](https://community.homey.app/u/Simon_Skotheimsvik)\
**Post date:** [April 28, 2021, 9:59pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/53 "2021-04-28T21:59:16Z")

</div>

How did you figure out the day in order to put the day name in a variable?

---

<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, 2021, 12:33am UTC](https://community.homey.app/t/getting-started-logic-variables/20132/54 "2021-04-29T00:33:07Z")

</div>

I’m not sure to what you’re referring to. Can you quote that pls?

---

<div class="post-metadata">

**Author:** ![Simon\_Skotheimsvik](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/simon_skotheimsvik/32/34205_2.png) [@Simon\_Skotheimsvik](https://community.homey.app/u/Simon_Skotheimsvik)\
**Post date:** [April 29, 2021, 4:45am UTC](https://community.homey.app/t/getting-started-logic-variables/20132/55 "2021-04-29T04:45:56Z")

</div>

> [@Neuron44](#):
>
> I created new variables which store the day and month in Dutch, rather than English. It’s nice that Homey can tell me it’s 2-11-2019 today, but it’s even better when he says it’s ‘zaterdag 2 november’. And yes, Homey can pronounce the text which you stored in a variable, no problemo! So I simply let Homey change the variable for the day every night and the variable for the month every first of the month, around midnight.

How did you calculate which day it is in order to put the name of the day in that text variable?

---

<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, 2021, 1:48pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/56 "2021-04-29T13:48:20Z")

</div>

While I was curious, and like to find out things, I came up with this.  
It should run until Homey dies.  
Maybe I missed something, or things can be done in other ways, pls let me know!

**How to display (or to use with speech) name of today and this month**

A. Create 2 variables, type Text

1. NaamVanDag (name of day), no text need to be entered.
2. NaamVanMaand (name of month) & enter the name of the current Month

B. Create 7 flows, one for each weekday  
Mon:

Tue:

Wed:

And so forth

C. Create 12 flows, one for each month  
Jan:

Feb:

Mar:

And so forth

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [April 29, 2021, 2:13pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/57 "2021-04-29T14:13:52Z")

</div>

> [@Peter\_Kawa](#):
>
> can be done in other ways

some/most can be done in HomeyScript:

```
//MyCreateDay-Tag.js

let SysInfo = await Homey.system.getInfo();
var weekDay = SysInfo.dateHuman.slice(0,(SysInfo.dateHuman.indexOf(' ')));
await tag("WeekDay", weekDay ); //creating new HomeyScriptTag 'WeekDay'
console.log("Weekdag", weekDay);
return(true);

```

---

<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, 2021, 2:22pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/58 "2021-04-29T14:22:40Z")

</div>

Thanks! I don’t have enough knowledge to write a script like that.  
Most of the time I can read what a script should do.  
So if I’m correct this script creates tag named Weekday and then this script updates the value of it with the name of the weekday.  
Does it create the same tag each day? Or is this skipped if it already exists?

But, well, this saves a lot of flows 😉 😉

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [April 29, 2021, 3:21pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/59 "2021-04-29T15:21:17Z")

</div>

This script runs ones when called, so it has to be run every day.(can be run in the AND column)  
HomeyScript is fun to experiment with, just try, I’m also a beginner but many guys here can assist you, when you get stucked. There are many examples provided with HomeyScript, play with them and be amazed.

---

<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, 2021, 3:48pm UTC](https://community.homey.app/t/getting-started-logic-variables/20132/60 "2021-04-29T15:48:05Z")

</div>

Thanks, yes I understood, and alr created a flow for that 😉 Playing with the script examples right now.  
So ofcourse I want the month tag also, but, no way it returns something else but weekday

Inside the Playground

```auto
Homey.system.getInfo();

```

returns

```auto
"dateHuman": string "donderdag 29ste april 2021 17:31:41"

```

I can’t even let the homeyscript return that, and I want to pick the 3rd word of the string in some way I was thinking.

[Previous page](https://community.homey.app/t/getting-started-logic-variables/20132.md?page=2)

[Next page](https://community.homey.app/t/getting-started-logic-variables/20132.md?page=4)
