Motion Sensor not online after swapping battery

I swapped the battery on a Motion sensor but it’s staying offline.
Or, very confusing, it’s now saying it’s offline in the iPhone app and online in the “My Devices” tab online.
But it’s not working at all.

I really don’t expect to have to undefine everything and redefine just because I swapped a battery …

Yes, you’re right, normally swapping the battery should just work. What kind of motion sensor do you have? Depending on what kind you have will allow me to give you the right suggestions on what to do next. Usually a simple reset the motion sensor should get it working again. Occasionally, you might have to reboot the hub.

This may also be of some help:

I just went through this. Depending on the year of the sensor, you can’t use just any battery. The documentation actually specifies this, but who would ever imagine one brand of 2450 battery would work while another fails?
I ordered Panasonic batteries. They just arrived three hours ago. I followed the reset process recommended here:

Be aware that you can stop when step 4 has been completed. It won’t find the existing detector as a ‘new’ component; it will merely re-enable the existing device to work correctly in your system.

I got it working, but there is clearly a bug, or flaky code.

I reset the unit multiple times.
I reset the hub.
The thing triggering it to attach again was when I started the “add device” procedure on the app, which didn’t find any new device but triggered some piece of code to run and realize the device was back.