A device, comprising: a detector configured to detect an alternating current, AC, charging current for a charger charging a battery of an electrical device; a switch configured to connect and disconnect an AC output configured to be connected to the charger; characterised by a controller configured to: detect an AC voltage; determine an angular difference between the AC voltage and the AC current, based on the angular difference determine a power factor; based on the power factor, the AC voltage and the AC charging current, determine an active AC power; based on the active AC power, determine a DC charging current of the charger and determine DC charging current values in relation to the DC charging current; detect a maximum value of the DC charging current values based on a peak value of the active AC power; after detecting the maximum current value, detect a threshold DC current value of the DC charging current values in relation to the detected maximum current value; after detecting the threshold DC current value, detect a change of subsequent values of the DC charging current values, and based on the change, detect whether the change is below a threshold; after detecting the change is below the threshold, control the switch for disconnecting the AC output. a detector configured to detect an alternating current, AC, charging current for a charger charging a battery of an electrical device; a switch configured to connect and disconnect an AC output configured to be connected to the charger; characterised by a controller configured to: detect an AC voltage; determine an angular difference between the AC voltage and the AC current, based on the angular difference determine a power factor; based on the power factor, the AC voltage and the AC charging current, determine an active AC power; based on the active AC power, determine a DC charging current of the charger and determine DC charging current values in relation to the DC charging current; detect a maximum value of the DC charging current values based on a peak value of the active AC power; after detecting the maximum current value, detect a threshold DC current value of the DC charging current values in relation to the detected maximum current value; after detecting the threshold DC current value, detect a change of subsequent values of the DC charging current values, and based on the change, detect whether the change is below a threshold; after detecting the change is below the threshold, control the switch for disconnecting the AC output. detect an AC voltage; determine an angular difference between the AC voltage and the AC current, based on the angular difference determine a power factor; based on the power factor, the AC voltage and the AC charging current, determine an active AC power; based on the active AC power, determine a DC charging current of the charger and determine DC charging current values in relation to the DC charging current; detect a maximum value of the DC charging current values based on a peak value of the active AC power; after detecting the maximum current value, detect a threshold DC current value of the DC charging current values in relation to the detected maximum current value; after detecting the threshold DC current value, detect a change of subsequent values of the DC charging current values, and based on the change, detect whether the change is below a threshold; after detecting the change is below the threshold, control the switch for disconnecting the AC output.