This is a nice approach too. I was trying to keep as close as possible to the original approach to best illustrate possible improvements.
But maybe you should adjust the filters in your example because of the now required default. For expample the float filter should now be something like float(0). If you do not, the templates will produce errors on startup.
I would also consider adding an availability template to the sensor.