A fluid dispenser comprising: a pump mechanism that dispenses fluid when activated; a light sensor that detects light in or around the fluid dispenser ; and a controller that controls a function of one or more electronic components of the fluid dispenser based on detection data received from the light sensor ; wherein the fluid dispenser has a movable component that moves when the pump mechanism is activated; said fluid dispenser being characterized in that the fluid dispenser comprises a light emitter that emits light; wherein the light sensor detects movement of the movable component by detecting changes in an amount of the light emitted by the light emitter that is reflected from the movable component towards the light sensor ; wherein the controller determines whether the pump mechanism has been activated based the detection data received from the light sensor ; wherein the controller controls the function of at least one of the one or more electronic components based on at least one of: the determination as to whether the pump mechanism has been activated; and a length of time that has passed since the pump mechanism was last activated; wherein the at least one of the one or more electronic components comprises a pump position sensor that senses a property of the fluid dispenser that is indicative of a position of the pump mechanism ; and wherein the controller controls the function of the pump position sensor based on the determination as to whether the pump mechanism has been activated. a pump mechanism that dispenses fluid when activated; a light sensor that detects light in or around the fluid dispenser ; and a controller that controls a function of one or more electronic components of the fluid dispenser based on detection data received from the light sensor ; wherein the fluid dispenser has a movable component that moves when the pump mechanism is activated; said fluid dispenser being characterized in that the fluid dispenser comprises a light emitter that emits light; wherein the light sensor detects movement of the movable component by detecting changes in an amount of the light emitted by the light emitter that is reflected from the movable component towards the light sensor ; wherein the controller determines whether the pump mechanism has been activated based the detection data received from the light sensor ; wherein the controller controls the function of at least one of the one or more electronic components based on at least one of: the determination as to whether the pump mechanism has been activated; and a length of time that has passed since the pump mechanism was last activated; wherein the at least one of the one or more electronic components comprises a pump position sensor that senses a property of the fluid dispenser that is indicative of a position of the pump mechanism ; and wherein the controller controls the function of the pump position sensor based on the determination as to whether the pump mechanism has been activated. the determination as to whether the pump mechanism has been activated; and a length of time that has passed since the pump mechanism was last activated; wherein the at least one of the one or more electronic components comprises a pump position sensor that senses a property of the fluid dispenser that is indicative of a position of the pump mechanism ; and wherein the controller controls the function of the pump position sensor based on the determination as to whether the pump mechanism has been activated. <EOS>