# \[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:** 10

<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:** [June 25, 2024, 1:21pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/191 "2024-06-25T13:21:30Z")

</div>

As Arie already mentioned, different colors are not possible, but it’s possible to use Emojis: ✅ / ❌ / ⚠

---

<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:** [June 25, 2024, 2:56pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/192 "2024-06-25T14:56:06Z")

</div>

I already do 🟥▪🟧

---

<div class="post-metadata">

**Author:** ![Fred\_ckx](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fred_ckx/32/86217_2.png) [@Fred\_ckx](https://community.homey.app/u/Fred_ckx)\
**Post date:** [July 14, 2024, 7:16pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/193 "2024-07-14T19:16:34Z")

</div>

> [@Arie\_J\_Godschalk](#):
>
> Create a BLL function called `pushAsString` and place this in it’s body

Arie, I already get stuck at the first bullet…

How to create a BLL function?  
Do I have to place the code as text into the card?

Thanks  
Fred

---

<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:** [July 14, 2024, 7:28pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/194 "2024-07-14T19:28:03Z")

</div>

> [@Fred\_ckx](#):
>
> Do I have to place the code as text into the card?

No.

Goto the BLL app settings 😉

---

<div class="post-metadata">

**Author:** ![Fred\_ckx](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fred_ckx/32/86217_2.png) [@Fred\_ckx](https://community.homey.app/u/Fred_ckx)\
**Post date:** [July 14, 2024, 7:32pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/195 "2024-07-14T19:32:48Z")

</div>

OK. I see Functions \> Add function over there. Is that what you mean?

I like the high degree of configurability of this app! You may expect some questions when I start to discover the functionality 😉

---

<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:** [July 14, 2024, 7:34pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/196 "2024-07-14T19:34:16Z")

</div>

> [@Fred\_ckx](#):
>
> Is that what you mean?

Yes! 😀

Edit: i have updated the post you referenced.

---

<div class="post-metadata">

**Author:** ![Fred\_ckx](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fred_ckx/32/86217_2.png) [@Fred\_ckx](https://community.homey.app/u/Fred_ckx)\
**Post date:** [July 14, 2024, 8:11pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/197 "2024-07-14T20:11:30Z")

</div>

I see quite some ways to control the datetime format.

For my project I want to add the time of receipt of an MQTT message to my data. I now do that in a human readable format, but I also want to do it as “epoch” / (micro)seconds since 1/1/70. Does BLL offer a way to do that?

BTW: now the current datetime is automatically generated by the Google Sheets card that I use for exporting my data. I will need to get the current datetime in a different way before I do the conversion to epoch.

EDIT: I found this discussion, this will give me the thing I look for when I let it return unixTimestamp

> [@Need help with homeyscript](https://community.homey.app/t/need-help-with-homeyscript/79813/7):
>
> @robertklep Thanks! A little hacking and googling, this seems to work slight_smile // Get the current Unix timestamp (epoch) in seconds const unixTimestamp = Math.floor(Date.now() / 1000); //console.log(unixTimestamp); //console.log("Encoded string: "+ Buffer.from(unixTimestamp.toString()).toString('Base64')); //console.log("Decoded string: ", decodedString); return Buffer.from(unixTimestamp.toString()).toString('Base64'); Now, back to the search function for the rest of my query …

---

<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:** [July 14, 2024, 9:34pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/198 "2024-07-14T21:34:14Z")

</div>

In BLL, just use `now`.

---

<div class="post-metadata">

**Author:** ![Fred\_ckx](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fred_ckx/32/86217_2.png) [@Fred\_ckx](https://community.homey.app/u/Fred_ckx)\
**Post date:** [July 14, 2024, 9:40pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/199 "2024-07-14T21:40:59Z")

</div>

In which card?

---

<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:** [July 15, 2024, 12:57am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/200 "2024-07-15T00:57:58Z")

</div>

Just try a few?

---

<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:** [July 15, 2024, 6:40am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/201 "2024-07-15T06:40:29Z")

</div>

What do you want?  
The time in a variable or tag?

What do you want to do with the timestamp or tick?

If you want a tag for instance, use the Execute BLL expression as Tag and fill it with `now`.

---

<div class="post-metadata">

**Author:** ![Fred\_ckx](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fred_ckx/32/86217_2.png) [@Fred\_ckx](https://community.homey.app/u/Fred_ckx)\
**Post date:** [July 15, 2024, 8:05am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/202 "2024-07-15T08:05:18Z")

</div>

I want it as variable. Or better: as something that I can export to a Google Sheets workbook. I succeeded now to do this with a BLL card that can execute code.

---

<div class="post-metadata">

**Author:** ![Philippe\_Mucher](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philippe_mucher/32/73654_2.png) [@Philippe\_Mucher](https://community.homey.app/u/Philippe_Mucher)\
**Post date:** [September 11, 2024, 6:54pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/203 "2024-09-11T18:54:50Z")

</div>

Hiyas @Arie_J_Godschalk and others,

can you tell me if there is a BLL string operator for “contains”?  
or possibly even better, is there a repository with all functions and syntax?

---

<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:** [September 11, 2024, 7:13pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/204 "2024-09-11T19:13:40Z")

</div>

Yes, check the app settings. Goto the link for Lodash. There you will find an operator for contains.  
Altho i think `"blabla".contains("b")` might already work or `"blabla".indexOf("b")>-1`

---

<div class="post-metadata">

**Author:** ![Philippe\_Mucher](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philippe_mucher/32/73654_2.png) [@Philippe\_Mucher](https://community.homey.app/u/Philippe_Mucher)\
**Post date:** [September 11, 2024, 8:52pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/205 "2024-09-11T20:52:10Z")

</div>

> [@Arie\_J\_Godschalk](#):
>
> “blabla”.indexOf(“b”)\>-1

Heeey, wonderful, thank you @Arie_J_Godschalk.  
I couldn’t find a contain command but that “indexOf” is working. Here is an example that checks if bot Pref2 and Pref3 are _not_ in text1. For those that need one 🙂  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/d/3d4044847e4ec08ba5caee8601b418b9524d6540.png)  
This is a BLL logic evaluation card, btw.

---

<div class="post-metadata">

**Author:** ![Philippe\_Mucher](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philippe_mucher/32/73654_2.png) [@Philippe\_Mucher](https://community.homey.app/u/Philippe_Mucher)\
**Post date:** [September 12, 2024, 12:19am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/206 "2024-09-12T00:19:47Z")

</div>

Woah, wouldn’t have found that in the Lodash list. Look at this:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/1/417c4f67425a6666191fd00ca91ad7d6ee30ec59.png)  
It’s listed as an array command (that is what I knew it for) - no mention of the string usage. Comparing string contents isn’t that something completely different than returning an array index?

---

<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:** [September 12, 2024, 7:18am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/207 "2024-09-12T07:18:20Z")

</div>

@Philippe_Mucher  
`_.includes('abcd', 'bc'); // => true`

---

<div class="post-metadata">

**Author:** ![Philippe\_Mucher](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philippe_mucher/32/73654_2.png) [@Philippe\_Mucher](https://community.homey.app/u/Philippe_Mucher)\
**Post date:** [September 12, 2024, 11:31am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/208 "2024-09-12T11:31:56Z")

</div>

Ow yeah! Did not see that one. Thank you, @Arie_J_Godschalk !!

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [September 28, 2024, 11:55am UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/209 "2024-09-28T11:55:30Z")

</div>

When someone is going to sleep, Homey provides the name of that specific person in the Name tag (Naam in my Dutch version). This tag contains the full name (first name and surname). I am trying to extract the first name from that tag via an expression in the BLL execute expression card. However I do not seem to get the expression right.

Note that I have very little knowledge of javascript, so I am learning as I go and trying to combine the various pieces of the puzzle.

To get the first name part I assume I need to use the substring method. And the indexOf method to determine the position in the string where the first name ends.

I tried the following, but I get an error:

 ![Flow Card](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/d/8d8d6efbd213e5a22155d2403844cad6cc5d8ca4.png)  
 ![Flow Card Error](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/7/c7115b4a5484931eb6e47937953804db1e019a04.png)

As far as I can tell I have included all the necessary parentheses and I assume the expression itself is not correct. Problably the way I am refering to the tag/get the substring of the tag.

I also tried refering to the tag using:  
`tag(Naam).substring(1, tag(Naam).indexOf(" ")-1)`

But that results in the same error.

I hope someone can point me in the right direction.

---

<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:** [September 28, 2024, 12:25pm UTC](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/210 "2024-09-28T12:25:41Z")

</div>

> [@SunBeech](#):
>
> As far as I can tell I have included all the necessary parentheses and I assume the expression itself is not correct.

You need quotes around the tags.

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

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