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

I can fill it as number when creating it but I can’t set it in a flow… it’s the cost for one KWH to calculate my use of energy!

I would then still calculate everything 100 times higher and divide by 100 when appropriate.

Will try that! Thanks! Maybe it’s only possible in older versions because a saw an example in the ‘washing machine flow’ from @Rocodamelshekima

It didn’t work in the mobile app, but it did work on the Homey Web app!

1 Like

Just a question, how to make a variable timenow in milliseconds? (exactly since 1970)

Try HomeyScript.

1 Like

is it possible to convert a logic variable hour into a(nohter) login variable hour in decimals so for example 13:45 would become 13.75. Not sure how to do that.

Make following mathjs calculation every minute

number(#HH)+number(#mm)/60

and save it into a variable

Hi @peltsi51
I have created this flow, but not sure what I do incorrect, but running in ends in an error; Unexpected end of Expression.

Okey, the forum edit is deleting the dollar signs.

You should write

image

Noticed also that you use some variabletag in the calculation Zonsopkomst? Remove it. The number() function will convert the hour and minute values into number format.

He did forget to mention the curled brackets {{number(#HH)+number(#mm)/60}}

U sure about that?

Yes in normal logic but I’m using better logic app

1 Like

Hi @peltsi51

The ‘Zonopkomst’ tag is the dutch version of SunRise. Which is the actual value I need. So at 00:01 I will run the flow ones, that transforms the SunRise time for that day to a real number.

By the way this works, with the current time, as you instructed. But I need to calculate that from a time in the Sunrise tag.
2021-01-27 09_11_16-Homey van Twan en Patricia

Ahh. Misunderstood your question. Don’t have any idea how to do that.

No problem. But why can’t I use them? I have seen earlier in this topic that tags are used. Or is the problem that the tag I’m using is a text tag?

Is it possible to create new variables to Better logic from homeyscripts?

1 Like

If I am correct only using the BL api.

I think there isn’t any function in the better logic or mathjs that could divide the :-separated string into two variables. So you propably have to use homey script to do that

1 Like

yeah, for now, I will run the calculation of sunrise at the sunrise time, and sunset the same. So for the next day, these times will be fine (more or less) the 1 or 2 minutes difference does not make a real large impact.

2 Likes