The sensors work with the magnetic field of the earth and can be influenced by fire doors or by the motor of blinds blinds. In this case, the enclosed magnet can help.
If you are asked to press the button when setting up or calibrating a sensor to wake it up, press and hold the button for 2 seconds. If you are asked to open the door/window two fingers' width (5cm), open it one hand's or foot's width. This way, the sensor recognises more precisely when the door/window is open and when it is closed. If there are still problems with the sensor after calibration, you can try the following:
There are problems with the "sony xperia" series.
Those don't have a pure Android system, but additionally a lot of Sony-Software on it, which causes compatibility problems specifically during calibration.
In this case, we actually recommend to only perform the configuration with a non-Sony device.