The present invention discusses a system and method for defining an optimal wakeup time with an alarm, which method takes into consideration at least two persons. Sleep monitoring devices, such as health rings or bed sensors, measure parameters of the sleepers, and a server determines sleeping phases from the measurement results. In that regard, skin temperature, heart rate and amount of motion can be tracked with the ring. The analysis combines at least two persons and sets rules so that no-one is preferably woken from a deep sleep phase. The determined alarm time is a given time period before the final alarm deadline. An optimal alarm time is calculated in the server, and the alarm is triggered in a mobile device, through the wearable ring, or by another alarming device or means.