All single line templates require quotes. Your template is returning an int so it should work.
The template looks correct and should work. My only concern is the fact that your equation can produce a result higher than 255. Brightness only allows values from 0 to 255.
If your sensor has a value between 0 and 10, it will break the brightness attribute.
0 produces a result of 400, and 9.9 produces a result of 256 and 10 produces 255. You should account for that.
Well they are but… interpolation from a string to a float could cause a value to be 9.90000000000001. Python should handle it but it could cause an issue.
It’s more for safety than anything. I doubt you’d run into the floating point issue. I think HA is pretty good about removing epsilon error when converting from string to floats.
It works exactly as I wanted. Though after sunset it gets dark really quickly. The lux value can go from the low teens straight to below 10. So the brightness never actually gets set to 255 but it’s close enough so as to not make any difference. Also I will be replacing the zwave lux sensor with a nodemcu and I’ll be able to get more frequent updates.