A method for controlling an operating state of a magnetic sensor, comprising: detecting an external magnetic field; generating a magnetic induction signal (1405, 1905, 2005), indicative of at least one characteristic associated with the detected external magnetic field; determining whether a predetermined condition is satisfied or not based on a voltage measured in the magnetic sensor; controlling, when the predetermined condition is satisfied, the magnetic sensor to operate in at least one of a first state and a second state based at least in part on the magnetic induction signal (1405, 1905, 2005); and controlling, when the predetermined condition is not satisfied, the magnetic sensor to operate in a third state, wherein in the first state, a load current flows in a first direction from the magnetic sensor to outside of the magnetic sensor, and in the second state, a load current flows in a second direction opposite of the first direction from outside of the magnetic sensor into the magnetic sensor, characterized in that the step of controlling the magnetic sensor to operate in at least one of the first and second state comprises: determining a first polarity of the external magnetic field based on the magnetic induction signal (1405, 1905, 2005); determining a second polarity of an external AC power supply that is coupled with the magnetic sensor to provide power; controlling the magnetic sensor to operate in the first state if the first polarity is a first magnetic polarity and the second polarity is a first AC polarity; controlling the magnetic sensor to operate in the second state if the first polarity is a second magnetic polarity opposite of the first magnetic polarity and the second polarity is a second AC polarity opposite of the first AC polarity. detecting an external magnetic field; generating a magnetic induction signal (1405, 1905, 2005), indicative of at least one characteristic associated with the detected external magnetic field; determining whether a predetermined condition is satisfied or not based on a voltage measured in the magnetic sensor; controlling, when the predetermined condition is satisfied, the magnetic sensor to operate in at least one of a first state and a second state based at least in part on the magnetic induction signal (1405, 1905, 2005); and controlling, when the predetermined condition is not satisfied, the magnetic sensor to operate in a third state, wherein in the first state, a load current flows in a first direction from the magnetic sensor to outside of the magnetic sensor, and in the second state, a load current flows in a second direction opposite of the first direction from outside of the magnetic sensor into the magnetic sensor, characterized in that the step of controlling the magnetic sensor to operate in at least one of the first and second state comprises: determining a first polarity of the external magnetic field based on the magnetic induction signal (1405, 1905, 2005); determining a second polarity of an external AC power supply that is coupled with the magnetic sensor to provide power; controlling the magnetic sensor to operate in the first state if the first polarity is a first magnetic polarity and the second polarity is a first AC polarity; controlling the magnetic sensor to operate in the second state if the first polarity is a second magnetic polarity opposite of the first magnetic polarity and the second polarity is a second AC polarity opposite of the first AC polarity. determining a first polarity of the external magnetic field based on the magnetic induction signal (1405, 1905, 2005); determining a second polarity of an external AC power supply that is coupled with the magnetic sensor to provide power; controlling the magnetic sensor to operate in the first state if the first polarity is a first magnetic polarity and the second polarity is a first AC polarity; controlling the magnetic sensor to operate in the second state if the first polarity is a second magnetic polarity opposite of the first magnetic polarity and the second polarity is a second AC polarity opposite of the first AC polarity.