WARNING: This page is about a different car, the 2021 Subaru Ascent. However, it is still accessible from the selected car via links, so may be relevant.
Disconnect the connector and ground terminal.
Courtesy of SUBARU OF AMERICA, INC.
Remove the battery sensor.
CAUTION:
The end of the bolt (a) of the battery sensor is crimped. Therefore, do not loosen the nut (b) to the crimped portion.