The easiest and safest way to factory reset a device is to flip the physical switch 5 times in a row with a delay of 2 seconds when it is in the off state. You might need to switch off and on the fuse first, so the device can boot up, and then perform the factory reset steps from the physical switch.
You can, as well, switch the power supply of the device ON/OFF 5 times in a row, this will factory reset the device as well.
Another way to factory reset the device is if it has a reset button to long-press it for at least 10 seconds. This will return the device to factory settings.
Shelly battery sensors:
You need to hold the reset button for at least 10S.