If the Mi Door and Window Sensor 2 is not powered on all the time, please refer to the following steps:
1. Make sure the battery in the sensor is properly inserted and has enough power. If it's low, replace it with a new one;
2. If it's battery-powered, ensure the contacts are clean and making good contact. If powered by an adapter, ensure it's securely connected to a power source;
3. Try removing and reinserting the battery or adapter to restart the sensor;
4. Ensure there are no nearby sources of interference affecting the sensor's power or communication;
5. Check for firmware updates in the Mi Home app and install any available updates;
6. Reset the sensor to factory settings and reconfigure it by verify the sensor's settings in the Mi Home app and ensure they're configured correctly;
7. If the issue persists, contact your local after-sales for further assistance regarding this issue.