This seems easy but no. I can trigger a flow when the power changes. Then use a logic funtion to do the calculation for the dim factor and put it in a tag (variabele).

I use (3600 / current power) * 100 where 3600 is the max power of the energie socket (16A). The only logic function to calculate something puts it in a text tag. But the dim function needs a integer. Can’t find a function to calulate something and put it in a integer tag. How to do that?

There is a THEN logic card “Calculate number variable as value”.

The better logic app has much more functionality. It also allows you to round numbers to a specified number of digits.

Hi @MaNi ,

the standard logic calulation needs the formular in string format, but the result is a number.

But you need to start and end the formular with double braces **{{** and **}}**.

Probably @FKey is right and you better use something like *BetterLogic* or *CustomLogic*

But it should work well with standard logic

The regular calculate logic flow card has been able to that for a long time already too, no need for better logics for such things.

`{{ round(5.423123, 2) }}`

gives `5.42`

just fine.

EDIT:

Or for the OP in the regular logic card:

`{{ round(3600 / current power, 2) }}`

Beware of the dim function being in decimal percentage so 0% - 100% = 0.00 - 1.00

Aha, I see that the advanced flow has much more items then the normal. I was making flows on my tablet and there are no advanced flow there.

Wil give it a go with the browser

So you did not find the card?

the problem was something completly else. I used Round instead of round. And it stumbled on the capital R.

Another day another lession

This was your question, wasn’t it?

So why didn’t you tell us your problem? I checked again. You gave us a formula, but there was no **round()** in that formula. Yes you wrote *integer*, but *integer* instead of *text* .

It is easier to help, when one knows the real issue.

I did not use a round in the initial formula.

I used (3600 / current power) * 100

That gave me a value higher then 1 so the ring was always 100%

I thought the logic formula I used was not the right one for the job and was looking for something better.

@Caseda gave me the hint that it worked between 0 and 1 and not 0 to 100 as I thought. That explained that the ring was always on.

So I used his formula but used a capital R by Round. It was still not working.

Eventually when I made it all lower case it worked.

So everyone contributed to the solution and you were right, it works with standard logic. The problem was not the formula and later the problem became the capital R.

U now use this and it works like a charm.

And calling a Variabele ‘number/nummer’ by the Homey team made me *think* it was a Integer. But is was a float

Ok, maybe next time you show your cards and flow from the beginning, for better understanding your problem