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.