Dynamic Battery Sensor Icon Depending on State

The icon of the battery level sensor provided by the Mobile App integration indicates charging state too:

image

image

Does HA have a built-in way to mimic this in user-defined battery level sensors, without using a template for the icon? Defining a sensor with device class battery gives visual level automatically, but not the charging state.

Not that I am aware of. However the custom battery state card can do this if you have an entity or attribute that follows the charging state: