Maybe i am hacking this post, if so please let me know.
I do have the sensor for each valve sensor.foobar_battery_percent.
The problem Is that this value does not update.
Last update was 2 days ago (when i restarted).
In the meantime one of the batteries died and was replaced. But there is no sign of such event: home assistant happily reports 75%.
The attribute used in the template above is not available anymore and has been replaced by battery sensors. So there is no need for the templates anymore. The integration handles that for you.