# \[APP\]\[Pro\] Better Logic Library - Just some better logic, variable and library management

**URL:** <https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568>\
**Category:** Apps\
**Tags:** app, tools, homey-pro, bll\
**Created:** [December 16, 2018, 10:29pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568 "2018-12-16T22:29:57Z")\
**Posts on this page:** 20\
**Page:** 27

<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:** [October 10, 2025, 11:09am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/534 "2025-10-10T11:09:48Z")

</div>

That’s a good one too, but doesn’t the `{{ [formatted result] / 60 }}` calculation need a round to zero digits function?  
like `{{ round( [formatted result] / 60 ) }}`

By the way, apart from your calculation, in case of sun events however, it’s not needed: the sun event time is available as local tag:

 ![Screenshot_20251010_130152_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/6/7668e8d3c9d224357fd7b210b315773e495109fb.jpeg)

and as app tag:

 ![Screenshot_20251010_130031_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/d/bd5b2aa7d525563f7b45e5be2eeee3f992b6c865.jpeg)

---

<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:** [October 10, 2025, 11:13am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/535 "2025-10-10T11:13:13Z")

</div>

aah, good point. solved that problem way too complex, trying to find out if there is a 0 or not:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/8/b8022a9a9ba5c7571f4198f0224e641dca3afd69.png)

---

<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:** [October 10, 2025, 11:45am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/536 "2025-10-10T11:45:32Z")

</div>

Indeed different ways to get there 😀.

Some thoughts:

- Your first and second BLL card require a date value as input (so the numerical representation of the date/time stamp in milliseconds). I assume the Zonnenstanden-app provides this tag accordingly. I don’t think it will work if you feed it with a text based formatted time (so formatted as HH:mm, which was the case in the Tesla question)
- What I find interesting is that the third (Logic) card apparently allows you to divide a text based value (Formatted result, in green) by 60. Normally you can only calculate with actual numbers (tags are blue). The same goes for the addition calculation. Maybe Homey converts the tag to a numeric value, as it only contains numbers, but this is something to consider.

---

<div class="post-metadata">

**Author:** ![Marcel\_R](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_r/32/47933_2.png) [@Marcel\_R](https://community.homey.app/u/Marcel_R)\
**Post date:** [October 11, 2025, 4:21pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/537 "2025-10-11T16:21:51Z")

</div>

I tried to implement (test variable, as Tesla variable is ‘null’ when it’s not driving), but get an error:

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

How to solve?

---

<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:** [October 11, 2025, 5:35pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/538 "2025-10-11T17:35:18Z")

</div>

What happens if you change the first letter to lowercase: `parseInt` ?

---

<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:** [October 11, 2025, 5:35pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/539 "2025-10-11T17:35:50Z")

</div>

> [@Marcel\_R](#):
>
> How to solve?

Use a small p for parseInt.

Javascript is case-sensitive.

---

<div class="post-metadata">

**Author:** ![Marcel\_R](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_r/32/47933_2.png) [@Marcel\_R](https://community.homey.app/u/Marcel_R)\
**Post date:** [October 11, 2025, 6:25pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/540 "2025-10-11T18:25:44Z")

</div>

Thanks, solved!

---

<div class="post-metadata">

**Author:** ![Marcel\_R](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_r/32/47933_2.png) [@Marcel\_R](https://community.homey.app/u/Marcel_R)\
**Post date:** [October 11, 2025, 6:28pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/541 "2025-10-11T18:28:16Z")

</div>

Thanks, solved! Didn’t know about case sensitivity.

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [November 5, 2025, 9:36am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/542 "2025-11-05T09:36:51Z")

</div>

Hi Arie,  
unfortunately some bll functions will occasionally not work. Reboot of the app will fix it until next occurrence. Sadly this will control my floor heating

 ![Bildschirmfoto 2025-11-05 um 10.36.12](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/4/344da41fd0aec72cf080f61c170a8d4dc918d44b.png)

Lot of thanks for having a look into it.

Thanks

---

<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:** [November 23, 2025, 10:35am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/544 "2025-11-23T10:35:36Z")

</div>

Could you explain: not working?

Wat is not working? Or you getting errors? Invalid values?

---

<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:** [November 23, 2025, 10:39am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/545 "2025-11-23T10:39:15Z")

</div>

> [@SunBeech](#):
>
> Maybe Homey converts the tag to a numeric value, as it only contains numbers, but this is something to consider.

Just FYI: when you use {{ and }}, the text and tokens are just directly parsed into the textfield (not only logic cards, but any flowcard using a textfield).

So, if the token/tag contains a number within a text-token, it is still inserted without quotes or anything, thus, in javascript, it is considered a number and can be directly used for calculations.

Just don’t put quotes around the tokens 😉

---

<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:** [November 23, 2025, 12:15pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/546 "2025-11-23T12:15:37Z")

</div>

Thanks Arie for the clarification. Learned something new! I think it’s my lack of JavaScript knowledge 😊. I am used the having to specifically define the data type of variables and not being able to combine variables with non-matching data types (like strings and integers in numeric calculations).

---

<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:** [November 23, 2025, 11:12pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/547 "2025-11-23T23:12:01Z")

</div>

> [@owuerker](#):
>
> ![Bildschirmfoto 2025-11-05 um 10.36.12](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/4/344da41fd0aec72cf080f61c170a8d4dc918d44b.png)

I’m trying to get my head around the functionality of your screenshot:  
The first card returns the temperature without decimals, the `devide` part is superfluous when you multiply the result with the same value again.

The second card returns the “temperature without decimals” as temperature with 2 decimals.

What do you expect to change with the value from the temperature tag?  
Just out of curiosity 😉

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [November 24, 2025, 3:23pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/548 "2025-11-24T15:23:23Z")

</div>

Thanks for taking the time.  
My floor heating system (Controme Smart Heating OS) is taking external temperature only if they are valid, based on the following rule:

> **[API](https://support.controme.com/api/#Setzenvon_Set-Temperaturen)**
>
> Heizungssteuerung API 
> 
> Mit der Controme API können mit einfachen http-Befehlen Informationen abgerufen und Einstellungen vorgenommen werden. So lassen sich Temperaturen und Systemstati abfragen und auch einzelne Werte setzen.
> 
> Die Kommunikation...

Due to internal filters, Smart-Heat-OS only accepts temperatures (or humidity levels) that are divisible by 0.125. In addition, the API is limited to two decimal places, i.e., when transferring values with three decimal places, please remove the last digit (e.g., 22.0, 22.12, 22.5, 22.62, 22.75, etc.)  
So the purpose of the flow is to get every temperature from my externals sensors as near as possible so that the Controme api will accept it by value and format.

Addition: Even if there is a value without decimals sometime the API is not accepting it without 2 decimals (,00). Strange thing…

---

<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:** [November 25, 2025, 3:53am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/549 "2025-11-25T03:53:45Z")

</div>

I think I hear you.  
So the API needs 2.00 as value and doesn’t always respond to a value 2?  
That’s very well possible, but in the end it should accept integers (no decimals) imho.

`round(12.12345 ,2)` rounds to 12.12  
but  
`round(12 ,2)` rounds to 12, not to 12.00

So you add the 2 zeros with this card in that case?

 ![Screenshot_20251125_045506_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/2/4211a1d943f917c0dfc14d2c9270f432d2867efa.jpeg)

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [November 25, 2025, 3:17pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/550 "2025-11-25T15:17:56Z")

</div>

Yes this is the purpose of the 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:** [November 25, 2025, 9:50pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/551 "2025-11-25T21:50:25Z")

</div>

Thanks! While you have a hunch about a not stable operation:  
Are you aware of the “error output” of adv flow cards? These even provide for an [Error] tag, which you can use in notification cards  
The divide function can be replaced by `/` by the way

```auto
round( divide( 
[Temperature] ,0.125 ) * 0.125 ,2)

```

turns into:

```auto
round( ( [Temperature] / 0.125 ) * 0.125 ,2)

```

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [November 26, 2025, 4:20pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/552 "2025-11-26T16:20:17Z")

</div>

I think I’ve got it.  
Each temperature is converted to a multiple of 0.125. Then it is truncated after the second decimal and always passed to the API with two decimal places, even if it is a whole number.  
The external room temperatures now seems to be as near as possible with the given API of my Controme.

 ![Bildschirmfoto 2025-11-26 um 17.14.53](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/6/a607a2788e590267995806ecd057007f6c5e1808.png)

Strange API 😉

Thanks all for your help  
I think the unstable issue was the memory leaks issue in the last firmwares, so BLL stops working.  
Currently it seems stable 🙂

---

<div class="post-metadata">

**Author:** ![Antohagg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/antohagg/32/48013_2.png) [@Antohagg](https://community.homey.app/u/Antohagg)\
**Post date:** [November 29, 2025, 7:54pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/553 "2025-11-29T19:54:46Z")

</div>

Maybe its me that is doing something wrong, but when I update a varible with a BLL Expression, the value within the app gets updated when viewing from inside the app setting, but the same variable that I access from a flow does not update.

After executing the flow, the vaiable mqtt gets updated to 2 when viewing from inside the app, but still shows as when viewing from the flow variable list.

 ![IMG_0865](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/7/77427988d6d0dbf2adf859a78eaa2b6fd2a3502e.png)

 ![IMG_0867](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/10a2c1187b80d1fff510b9d64ad444fb79cb9e95.png)

 ![IMG_0866](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/8/58736e21d5d5f8ffe6bf39f2ce2247e361bec130.png)

---

<div class="post-metadata">

**Author:** ![Antohagg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/antohagg/32/48013_2.png) [@Antohagg](https://community.homey.app/u/Antohagg)\
**Post date:** [November 29, 2025, 9:23pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/554 "2025-11-29T21:23:32Z")

</div>

Think i found the issue, I need tp stringify the results, this now work as intended.

 ![IMG_0868](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/4/54d1327ff4a025e4105c882abc4d135977d171a6.png)

[Previous page](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568.md?page=26)

[Next page](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568.md?page=28)
