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.
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?
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 thelast 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)
@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!
@Pat_M
Well, feel free to become a Patreon
PayPalāed!
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 ?
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:
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')
Wow! Excellent guide! all the scenario works great! especially āExecute timeā and āExecute parseIntā demonstrated the return of text and integer.
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?
Done, thank you!
Fyi: this is my last week holidays, iāll run support next week.
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
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