Calculation with variables

I setup up a rule which does not work realy.

var Number nWallbox = (0 - 6000)

var Number nStaerke = ((-nWallbox) / ( 229 * 1.616587 * 1.732051 ))

logInfo("Auto laden", "Stromstärke: " + nStaerke)

Wallbox_Staerke.postUpdate(nStaerke)

I always get the following request in the log file

2024-05-01 14:20:21.868 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘pv.rules’, using it anyway:

The value of the local variable nStaerke is not used

The value of the local variable nStaerke is not used

Besides the fact that the calculations don’t make much sense (0 - 6000 instead of just -6000 and then why -nWallbox when you can just use 6000) a warning like that where it’s saying that you have a variable that is not being used but is clearly being used it is an indication that you may not have a closing paren or } or ] somewhere else in the file.

If the above is your full .rules file, you need to go back to the rules documentation and review the proper syntax for creating a rule in a .rules file. That’s not a rule and when you put code outside of a rule in a .rules file like that there are restrictions such as global variables cannot see each other.

And maybe you use blockly for that which is much easier for things like that. What do you actually want to achieve?

I solved it. Thank you.

Maybe you share for everyone else how you solved it?