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

<div class="post-metadata">

**Author:** ![victoroos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/victoroos/32/8344_2.png) [@victoroos](https://community.homey.app/u/victoroos)\
**Post date:** [February 27, 2020, 8:44am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/65 "2020-02-27T08:44:04Z")

</div>

Hi all

Is there a way to make a "if difference between A and B is more than _insertvalue_ ?

I’m setting up two temp sensors for my house and want to try some stuff.

vkr  
victor 🙂

---

<div class="post-metadata">

**Author:** ![viix](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viix](https://community.homey.app/u/viix)\
**Post date:** [February 27, 2020, 8:54am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/66 "2020-02-27T08:54:21Z")

</div>

Use the MathJS card.  
Might need to add the OR to check 2 calculation if one gives you a negative value  
((A-B)\>insertvalue) or ((B-A)\>insertvalue)

---

<div class="post-metadata">

**Author:** ![victoroos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/victoroos/32/8344_2.png) [@victoroos](https://community.homey.app/u/victoroos)\
**Post date:** [February 27, 2020, 9:47am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/67 "2020-02-27T09:47:32Z")

</div>

what do you mean with "check for negative?  
I don’t quite get it. insert value will make the variable this or? how would it work?

---

<div class="post-metadata">

**Author:** ![viix](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viix](https://community.homey.app/u/viix)\
**Post date:** [February 27, 2020, 2:29pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/68 "2020-02-27T14:29:35Z")

</div>

You would like to check if the difference between your two sensors are a certain value correct?  
You can use the `mathjs expression is true` card in the AND slot.

The example I gave may give a negative value if the first sensor gives a lower value than the second sensor in the equation. Ie a 19c and 26c temp reading will be -7 and 7 in the respective equation.  
If your _insertvalue_ is 5, the -7 result will still be true when it checks if the result is \<5 and that’s not desired. So the correct equation should be  
`(((A-B)>*insertvalue*) and (a-b)>0)) or (((B-A)>*insertvalue*) and (b-a)>0))`

The _insertvalue_ can be a number you type in or a global tag.

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 28, 2020, 8:38pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/69 "2020-03-28T20:38:12Z")

</div>

Hi!

I have problems with Better Logic and have not been able to get help.  
I enclose pictures of the error message and the flow. It is a total of 3 flows.  
When I try to share the flow. I only get an error message. As you can see, it applies to all three flows. I also attach a picture from Better Logic.  
I do not know and have not been able to get an answer if there is a fault with Homey or Better Logic.  
The flows work as they should!

 ![Better_Logic](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/3/c3d86b0f50e5701d98d4d6ca2ed2d363f3b03723.jpeg)

 ![Motorvärmare_01_01](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/e/fe9b1e5a2b6363a1971bb013381e318b1fe0c52b.jpeg) ![Motorvärmare_01_02](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/a/1a757655972f9e55f0600c75087bfc9bc7837fad.jpeg) ![Motorvärmare_01_03](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/4/c480ef9eaacb114e1423f2038ef5f4df5a6492a8.jpeg) ![Motorvärmare_01_04](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/e/7e56fa41de7ffc9e748c15a4a3372b03c8f19904.jpeg)

 ![Motorvärmare_02_01](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/a/da376bdfbc5b7136a4e79bb4ff7014cb42dfaa0e.jpeg) ![Motorvärmare_02_02](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/3/236226d5a0516bd635d62672b75dfbd31702659e.jpeg) ![Motorvärmare_02_03](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/2/c231b720bce21a757744a5cf0f1199f01a40a5ba.jpeg) ![Motorvärmare_02_04](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/8/784a3a9770f7070efe061ac1e6407afc7c9333a8.jpeg)

 ![Motorvärmare_03_01](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/516cb88935033396dffe8884e90305f45257e90c.jpeg) ![Motorvärmare_03_02](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/e/4eba6d5ceb4fde6460cce8e9c569e39dd24e9e09.jpeg) ![Motorvärmare_03_03](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/6/f68835b2d5388029415b3d9d21ff384452de5a46.jpeg) ![Motorvärmare_03_04](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/6/06f3d9454248d97f871357022e21204986092df4.jpeg)

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 29, 2020, 6:21am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/70 "2020-03-29T06:21:13Z")

</div>

I think that Homey doesn’t like the spaces in your variable names. If that doesn’t solve the problem, also try removing all accents from characters.

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 29, 2020, 1:34pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/71 "2020-03-29T13:34:12Z")

</div>

robertklep  
I have other flows with swedish letters and space in the name without problems!  
But now I have tet to write the flows without swedish letters and space. And you can see it is the same!  
That answer I get from the Homey support was they think its any messes with the code of the better logic app?  
That is why I write here either for help or for anyone who knows the code for better logic to see if there is anything wrong

 ![Screenshot_20200329-152709](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/e/8e139287f31aaecfbf648d2489789c99a91d5211.jpeg)

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 29, 2020, 2:15pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/72 "2020-03-29T14:15:42Z")

</div>

~~When exactly do you get that error? When you test the flow, or when you just open the flow in the editor?~~

Ah, I can reproduce the problem when you try to share the flow. You should ask Athom’s support where app developers can find any guidelines to prevent these issues (hint: there aren’t any! I have to conclude that this a bug in Athom’s “share” code).

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 29, 2020, 6:42pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/73 "2020-03-29T18:42:27Z")

</div>

Below you can see the answer from Homey support

Hi Hans,

Thank you for reaching out to us. Unfortunately, Better Logic is an app that is developed by a Community Developer, and I cannot offer detailed support on this. Having stated this, looking at the error message and screenshot, I suspect that there is a . somewhere in one of the variables used in this flow, which messes with the code of the Better Logic app.

Please check this, and if it is the case, try to contact the Developer of the Better Logic app, as I cannot help you any further than this when it comes to this app.

I trust that this answers your question, even though I might not be able to help you to a point that actually solves your issue. I’m closing your ticket as I cannot help you beyond this point.

If you need additional support regarding Homey, please feel free to re-open your ticket by answering this email (or add the question in your other ticket).

I wish you a great day and a lot of fun with Homey!

Best Regards,

Boaz

The Athom support team.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 29, 2020, 7:08pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/74 "2020-03-29T19:08:15Z")

</div>

Have you explained clearly to them that this problem occurs when you try to share the flow? It’s _not_ an error that occurs in the Better Logic app, it’s an error that occurs in Homey’s “Share Flow” system.

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 29, 2020, 7:11pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/75 "2020-03-29T19:11:10Z")

</div>

You can see what I wrote below. For me, it’s crystal clear. 🙂

Hi!

I have problems with Better Logic and have not been able to get help in the group.  
I enclose pictures of the error message and the flow. It is a total of 3 flows.  
When I try to share the flow. I only get an error message. As you can see, it applies to all three flows. I also attach a picture from Better Logic.  
I do not know and have not been able to get an answer if there is a fault with Homey or Better Logic.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 29, 2020, 7:12pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/76 "2020-03-29T19:12:20Z")

</div>

Yes, Boaz makes assumptions without actually reading your question or testing it himself 🙄

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 29, 2020, 7:28pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/77 "2020-03-29T19:28:00Z")

</div>

What do you think I should do now?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 29, 2020, 7:35pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/78 "2020-03-29T19:35:20Z")

</div>

You can try and explain to him yet again that it happens when you try to share a flow, and that it’s not an application error but a Homey system error.

Literal text that you could use:

"  
Boaz,

The error happens when I try to share any flow that uses a Better Logic token. The error is not generated by the Better Logic application (whose code doesn’t even contain the particular error message that I’m getting) but somewhere the Homey infrastructure (in fact, it looks very much like a MongoDB error, which _definitely_ isn’t part of Better Logic, but very likely part of Homey’s “Share” backend system).

Others can reproduce the problem as well.  
"

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 29, 2020, 7:38pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/79 "2020-03-29T19:38:34Z")

</div>

Thank You very much!

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 29, 2020, 7:40pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/80 "2020-03-29T19:40:49Z")

</div>

If you can send images as part of your support request, I wrote a proof of concept that will trigger the same error as with Better Logic:

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

This is the code I used to reproduce:

```auto
new Homey.FlowToken('foo.bar', { type : 'string', title: 'foo bar token' }).register();

```

**EDIT** : also happens when you don’t use periods in the flow token id:

```auto
new Homey.FlowToken('foobar', { type : 'string', title: 'foo bar token' }).register()

```

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

So something is fundamentally broken in Homey’s backend system.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 30, 2020, 6:49am UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/81 "2020-03-30T06:49:55Z")

</div>

It has been brought to the attention of Athom’s development team, and they will fix it 👍🏻

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 30, 2020, 7:04pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/82 "2020-03-30T19:04:30Z")

</div>

How nice!  
Did you contact them too?  
I saw this morning that you wrote your test code. I sent it to Boaz, this morning.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 30, 2020, 7:07pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/83 "2020-03-30T19:07:43Z")

</div>

I contacted them through Slack, they confirmed the issue and said that it will be solved. No timeline on when, though, but I assume soon.

---

<div class="post-metadata">

**Author:** ![Hans-Jochen\_Nissen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hans-jochen_nissen/32/9752_2.png) [@Hans-Jochen\_Nissen](https://community.homey.app/u/Hans-Jochen_Nissen)\
**Post date:** [March 30, 2020, 7:08pm UTC](https://community.homey.app/t/app-pro-better-logic-library-just-some-better-logic-variable-and-library-management/5568/84 "2020-03-30T19:08:58Z")

</div>

That’s nice!

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

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