You can set the state by using the device handler to set a parameter but the easiest way is to remove the device (exclude) from Smartthings then hold the button down for 10 seconds, you will see the LED do a special flash, and at this point it either sets it self in mains or battery mode. You maybe able to do this without the exclude part - did not try that.
To include again you have to either press the button momentarily or press it three times within a second. Three sets of instructions out there.
The best way to see what “mode” it’s in is the LED. if it’s off most of the time then it’s in Battery. If it’s flashing every second then it’s on mains.
If you have yours on Mains (not battery) then I am surprised that you are getting unavailable in smartthings. this only started to happen once I moved to Battery. Is this right? If so then what Device Handler are you using? It maybe that is the problem.