[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