Home automation device comprising: - at least one movement detector for detecting movement of a wing (30, 31) rotatable about an axis relative to a frame fixed in a terrestrial reference system, said movement detector comprising: • a housing adapted to be securable to the wing, • an accelerometer fixed to the housing and adapted to provide signals, named acceleration signals, representative of the acceleration of the housing along at least one fixed direction of the housing relative to the frame, • a magnetometer fixed to the housing and adapted to provide signals, named orientation signals, representative of the instantaneous orientation of at least one fixed direction of the housing relative to an Earth's local magnetic field, - a processing unit for processing the signals provided by the accelerometer and by the magnetometer, - the processing unit comprises at least one memory and is adapted to store therein predetermined data, named reference orientation data, representative of an orientation value, named reference orientation, of the housing relative to the Earth's local magnetic field, characterised in that: - the processing unit is adapted to be able to identify a predetermined event, named reference event, at least from the acceleration signals, - the processing unit is adapted, on detection of a reference event, to replace the reference orientation data with data representative of the instantaneous orientation of the housing. - at least one movement detector for detecting movement of a wing (30, 31) rotatable about an axis relative to a frame fixed in a terrestrial reference system, said movement detector comprising: • a housing adapted to be securable to the wing, • an accelerometer fixed to the housing and adapted to provide signals, named acceleration signals, representative of the acceleration of the housing along at least one fixed direction of the housing relative to the frame, • a magnetometer fixed to the housing and adapted to provide signals, named orientation signals, representative of the instantaneous orientation of at least one fixed direction of the housing relative to an Earth's local magnetic field, • a housing adapted to be securable to the wing, • an accelerometer fixed to the housing and adapted to provide signals, named acceleration signals, representative of the acceleration of the housing along at least one fixed direction of the housing relative to the frame, • a magnetometer fixed to the housing and adapted to provide signals, named orientation signals, representative of the instantaneous orientation of at least one fixed direction of the housing relative to an Earth's local magnetic field, - a processing unit for processing the signals provided by the accelerometer and by the magnetometer, - the processing unit comprises at least one memory and is adapted to store therein predetermined data, named reference orientation data, representative of an orientation value, named reference orientation, of the housing relative to the Earth's local magnetic field, - the processing unit is adapted to be able to identify a predetermined event, named reference event, at least from the acceleration signals, - the processing unit is adapted, on detection of a reference event, to replace the reference orientation data with data representative of the instantaneous orientation of the housing.