# \[APP\]\[Pro\] Better Logic Library - For Users

**URL:** <https://community.homey.app/t/app-pro-better-logic-library-for-users/71876>\
**Category:** Apps\
**Tags:** app, tools, homey-pro, logic, bll\
**Created:** [November 7, 2022, 10:13pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876 "2022-11-07T22:13:40Z")\
**Posts on this page:** 20\
**Page:** 7

<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:** [December 16, 2023, 7:02pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/125 "2023-12-16T19:02:51Z")

</div>

> [@Rrrr](#):
>
> The last one is: {[\_.last([“1”, “2”]) ]}.

Use:  
`'The last one is: ' + _.last(["1", "2"])`

(An expression)

---

<div class="post-metadata">

**Author:** ![Rrrr](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rrrr/32/629_2.png) [@Rrrr](https://community.homey.app/u/Rrrr)\
**Post date:** [December 16, 2023, 8:36pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/126 "2023-12-16T20:36:02Z")

</div>

> [@Arie\_J\_Godschalk](#):
>
> Use:  
> `'The last one is: ' + _.last(["1", "2"])`
> 
> (An expression)

Nice one!

Unfortunately, a variable is passed as a whole to ‘Execute as tag’ and it would mean a lot of work/worry to ensure the content in the variable follows the above syntax.

(In my specific case, the variable is a logging message from ‘When a log is generated’ card in Simple Log. See my other request [here](https://bitbucket.org/QlusterIT/nl.qluster-it.simplelog/issues/36/bll-logic-in-the-input-field-message-of))

The big benefit of the ‘Execute as tag’ card is the real-time result in a tag. It would be much more convenient if the ‘Execute as tag’ card would accept the same syntax as the card ‘Set variable to text’.

---

<div class="post-metadata">

**Author:** ![Rrrr](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rrrr/32/629_2.png) [@Rrrr](https://community.homey.app/u/Rrrr)\
**Post date:** [December 18, 2023, 6:56pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/127 "2023-12-18T18:56:18Z")

</div>

@Arie_J_Godschalk  
What is the BLL expression for this:

- Replace every \_ (underscore) with \_
- Replace every \* (star) with \*

If there is no direct BLL expression, perhaps the syntax for a BLL function?  
Something like this (I know this does not work, but should be something similar)?

Imaginary BLL function code:

```auto
function(){
  list<char> v(100);
  for_each(v.begin(), v.end(), _ = \\_);
  return ReplaceCharacter(str);
}

```

---

<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:** [December 29, 2023, 11:28am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/128 "2023-12-29T11:28:17Z")

</div>

> [@Rrrr](#):
>
> The big benefit of the ‘Execute as tag’ card is the real-time result in a tag. It would be much more convenient if the ‘Execute as tag’ card would accept the same syntax as the card ‘Set variable to text’.

I have just added a new flowcard in the new version (live right now):  
Execute Text as Tag.

You can use this to Execute/return a text which can contain BLL Codings `{[]}`.

> [@Rrrr](#):
>
> If there is no direct BLL expression, perhaps the syntax for a BLL function?

Most easy way would be (in BLL coding):  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/9/398b38a5b2f292033d5814db9e2b4680023e48f4.png)

```auto
{["as_d_asdasd".replaceAll("_", "\\_")]}

```

---

<div class="post-metadata">

**Author:** ![Rrrr](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rrrr/32/629_2.png) [@Rrrr](https://community.homey.app/u/Rrrr)\
**Post date:** [December 29, 2023, 1:04pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/129 "2023-12-29T13:04:57Z")

</div>

🙏 Its working great, thank you! You are spoiling us. 😀

---

<div class="post-metadata">

**Author:** ![Gerhard\_Sommer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gerhard_sommer/32/98476_2.png) [@Gerhard\_Sommer](https://community.homey.app/u/Gerhard_Sommer)\
**Post date:** [January 20, 2024, 6:20pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/130 "2024-01-20T18:20:46Z")

</div>

Hi,

is it possible to use BLL variables I created in the App in a function that I create? If so, what is the syntax? I could not find any example. I tried it with $ before the name and before and after the name and with just the variable name, but always get an error.

Kind Regards,  
Gerhard

---

<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:** [January 20, 2024, 8:11pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/131 "2024-01-20T20:11:27Z")

</div>

@Gerhard_Sommer No actually, but its a great idea!  
Would you mind creating a ticket for it? Thanks!

---

<div class="post-metadata">

**Author:** ![Alexander\_Simin](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/alexander_simin/32/79236_2.png) [@Alexander\_Simin](https://community.homey.app/u/Alexander_Simin)\
**Post date:** [January 31, 2024, 8:02pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/132 "2024-01-31T20:02:26Z")

</div>

Hey, maybe a stupid question - I’m trying to create a big list of BLL variables and import them back to homey, but import button doesn’t seem to work… What am I doing wrong?  
Thanks,

---

<div class="post-metadata">

**Author:** ![Peter\_Bittner](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_bittner/32/16698_2.png) [@Peter\_Bittner](https://community.homey.app/u/Peter_Bittner)\
**Post date:** [March 18, 2024, 3:11am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/133 "2024-03-18T03:11:47Z")

</div>

@Arie_J_Godschalk I have just started using BLL.  
Initially I want to do something simple. At the moment all my variables are Homey Logic variables. I imagine I will need to create a BLL text variable for the result but with BLL can I transform a Homey Logic number variable into the BLL text variable? I simply want to convert a number (32.98) to text (33%) rounded up or down.  
Is this possible or do I need to also populate thew number into a BLL number variable.  
If you could provide an example that would be appreciated.

---

<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 18, 2024, 11:51am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/134 "2024-03-18T11:51:16Z")

</div>

Hi Peter,

> [@Peter\_Bittner](#):
>
> I simply want to convert a number (32.98) to text (33%) rounded up or down.

This is possible with Homey logic vars:

 ![Screenshot from 2024-03-18 12-49-13](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/a/3aff7b247bc74ab06ec67fb44684ba8b316d67ad.png)

 ![Screenshot from 2024-03-18 12-49-28](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/1/01565541273cc5ca7928d75112b5b52a449ee844.png)

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [March 18, 2024, 12:01pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/135 "2024-03-18T12:01:32Z")

</div>

I don’t think setting it to a variable is necessary at all, you can calculate in any _text input_, so should be possible in that flow card too:  
`MyStringVar = {{ round(VARIABLE).toString() }}`  
Not sure why we want it to be a string value though, just a number should work too:  
`MyVar = {{ round(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:** [March 18, 2024, 12:32pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/136 "2024-03-18T12:32:31Z")

</div>

I guessed he wanted the value xx% in a variable. You can’t store the % sign in a numvar  
That’s why I did it in a stringvar, Remco.

---

<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 18, 2024, 12:35pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/137 "2024-03-18T12:35:00Z")

</div>

> [@Peter\_Bittner](#):
>
> If you could provide an example that would be appreciated.

Sure, but do you want to use BLL for this, or did you thought default homey variables couldnt do this?

If you WANT to use BLL for specific reasons, let me know and ill show an example.

---

<div class="post-metadata">

**Author:** ![Peter\_Bittner](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_bittner/32/16698_2.png) [@Peter\_Bittner](https://community.homey.app/u/Peter_Bittner)\
**Post date:** [March 18, 2024, 7:12pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/138 "2024-03-18T19:12:34Z")

</div>

No, that’s great Arie, thanks.

---

<div class="post-metadata">

**Author:** ![Peter\_Bittner](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_bittner/32/16698_2.png) [@Peter\_Bittner](https://community.homey.app/u/Peter_Bittner)\
**Post date:** [March 19, 2024, 4:51am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/139 "2024-03-19T04:51:04Z")

</div>

Peter, it looks like I need a function such as round() for this to work. What function do I use if I don’t want the number to be rounded but set to 2 decimal places, or rounded to 2 decimal places?  
Where do I find what functions can be used? Is it any valid Node.js function?

---

<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 19, 2024, 3:17pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/140 "2024-03-19T15:17:29Z")

</div>

Hi Peter,

Here’s some examples!

 ![Screenshot_20240319-161336_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/7/17f39490ad38fab034186e90490bb80a1e3709b8.jpeg)

At [https://mathjs.org/](https://mathjs.org/) you can find all possibilities, but I’m not sure each and every one is valid for use @ Homey

---

<div class="post-metadata">

**Author:** ![Peter\_Bittner](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_bittner/32/16698_2.png) [@Peter\_Bittner](https://community.homey.app/u/Peter_Bittner)\
**Post date:** [March 19, 2024, 6:02pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/141 "2024-03-19T18:02:04Z")

</div>

Thanks again Peter

---

<div class="post-metadata">

**Author:** ![Patrick\_Van\_Deursen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/patrick_van_deursen/32/56539_2.png) [@Patrick\_Van\_Deursen](https://community.homey.app/u/Patrick_Van_Deursen)\
**Post date:** [March 29, 2024, 2:49pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/142 "2024-03-29T14:49:32Z")

</div>

I want to subtract to times set in different flows

I tried, but this does not work. Example flow below. in reality the two time flows would be triggered by different events, and I want to use the time difference between these two events as input to a different flow:

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/c/1cf0df356e747c2a8d15312593dee9ad96f271c7.png)

preferable even subtract the two different time variables

Time difference can run over days, and I want to have the difference in minutes

---

<div class="post-metadata">

**Author:** ![Rrrr](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rrrr/32/629_2.png) [@Rrrr](https://community.homey.app/u/Rrrr)\
**Post date:** [March 30, 2024, 12:20pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/143 "2024-03-30T12:20:25Z")

</div>

My Telegram issues with not passing certain characters were solved by migrating to the other Telegram app by Julian Sohl

---

<div class="post-metadata">

**Author:** ![Patrick\_Van\_Deursen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/patrick_van_deursen/32/56539_2.png) [@Patrick\_Van\_Deursen](https://community.homey.app/u/Patrick_Van_Deursen)\
**Post date:** [March 30, 2024, 1:02pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/144 "2024-03-30T13:02:24Z")

</div>

found it!

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/4/d4e160bdfe8895032970dd9f54ab14e8e7f6bbcd.png)

This calculates the difference between the two times in minutes  
Note that the logic cards needs to be set to text, not variable!

[Previous page](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876.md?page=6)

[Next page](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876.md?page=8)
