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

Well, ill see if i can improve the description
BLL coding can be used within multiple apps within textarguments. A BLL coding is defined by the {[ ]} and within that, there is a BLL expression. :slight_smile:

1 Like

Yes, there is a new flowcard to retrieve properties for Variables, currently only yhe last-set property.

This is SO useful, thank you!!!
Can you please point me in the right direction, I’m trying to calculate the diff (in minutes) for some BL variables that I have. Like temperatures etc. This is why I really wanted the Last Set value.
I’m struggling to calculate (in a easy way) this diff like Set Minutes ($timenow$-Temp_Garage) where garage is Get properties of Temp_Garage->Last changed (datetime).

Can you please help me? :slight_smile:

Many thanks!

Yes:
First off, install the latest version of BLL, because the card you need had a bug in it:

Then you need this:

  • Left you retrieve the properties of a variable, in this case the variable is called asd
  • In the middle card, you calculate the time difference between now and the last changed. This will result in the time difference in milliseconds.
  • The last card (which had a bug in it) you can use to convert that millisecond result into a format you want, minutes in this case, so just write a M and select that one from the dropdown list.

_

  • Ofc, if you need the minutes as a real number, not as a text, you could do it like this:
    Math.round((now - [last-changed-tag] ) / 1000 / 60)

image

2 Likes

@Arie_J_Godschalk With your help it works now. Finally I can check if values are stale or not and decide if they are allowed for calculations like averages etc. I’m so thankful for all your help, you should get a monthly salary from Athom for your fantastic contributions, both in apps and knowledge transfer.

Hartelijk dank and have a fantastic summer! :star_struck: :clap: :trophy:

@Pat_M
Well, feel free to become a Patreon :wink:

1 Like

PayPal’ed! :slight_smile: :beer:

1 Like

@Pat_M

Thank you very much m8!

@Arie_J_Godschalk using your app Better logic Library, is it possible to:

1/ to extract time from text json output “2023-07-03T16:15:12+01:00”, example I need the only HH:mm ?

2/ time difference in minutes such as FutureDateTime(YYYY-mm-ddTHH:mm:ss(timezone) minus CurrentDateTime(YYYY-mm-ddTHH:mm:ss(timezone) ?

Please advise how ? :thinking:

Yes, i’ll use the flowcard Format dat for it, but it can be used in any BLL expression or coding through the date() method:
image

Yes:

If you need it as a number, just wrap parseInt around it:

parseInt(time('M', new Date('2023-07-03T16:15:12+01:00') - now))

The now can be replace with for instance new Date('2023-07-03T15:15:12+00:00')

2 Likes

Wow!:+1: Excellent guide! all the scenario works great! especially ‘Execute time’ and ‘Execute parseInt’ demonstrated the return of text and integer.

1 Like

I’ve tried importing an array of JSON objects for my variables, which a few days ago was working okay and they would save. I’ve tried today to import a new set with an additional few and they do not save. There is no dedicated save all button; however, if I click each imported variable and select edit then save, then they do save.

Diagnostic key: 6e442055-3184-4134-810b-5c1f7ba72bf2

Not sure where to go next with this. I may try uninstalling and starting again. Currently on v3.4.5

Edit: I’ve found a way to trick it to work. Once I import all the variables, I then add an additional dummy variable and it saves all of the others. This is not ideal, but in the absence of a fix, this will work for now.

Edit2: Scrap that. The work around no longer works. This is so random. Looks like I’ll need to go back to the basic Logic variables until this is sorted out.

Please create a support ticket and add the json file so i can test and fix it?

1 Like

Done, thank you!

1 Like

Fyi: this is my last week holidays, i’ll run support next week.

2 Likes

thank you for all the information here. maybe you can help me too?

I have installed the “Better Logic Library” app and would like to output the current time (timeshort) in a push notification plus, for example, 90 minutes. see my post about it here:

Calculate time variable (Homey Community)

what code could you use to do that? how should the variables be set?

thank you very much for the information about it

Hi Sebastian,

I don’t get this follow up question (in this thread), while I showed a ready-to-go, importable flow solution.
I’m curious, did you even care to follow the link?

https://community.homey.app/t/calculate-time-variable/87604/2

thank you for the info
Of course I looked at the link but I don’t really get along with it. there are many functions in it that i don’t need at all. is it possible to shorten this significantly? attach my question simply to add minutes to the current time stamp and output that in a notification? thank you very much

I cannot know that :blush:
Okay, here’s a flow which can calculate with times, maybe this gets you going

Thank you for your support, but unfortunately that doesn’t really help me. how can I easily add 90 minutes to the current timestamp of better logic “timeshort”? what variables do I need for this etc.? in your example only the values are set but not added. can you make me a very short advanced flow? do you have experience there?

@DirkG - Or maybe you know your way around here and could help us here? are you using the app yourself? thank you very much