The Code of Jewish Law says: “A person who will suffer does not have to sleep in the Sukkah despite the fact that the Torah says: ‘you must dwell inside Sukkot for seven days’”.
Our sages explain that we may only leave the Sukkah if doing so will remove us from the source of discomfort or pain. But if leaving the Sukkah does not remove us from the uncomfortable situation, then we are not exempt from dwelling in the Sukkah.
The author of Chavat Yair writes that if a baby in a bassinet needs to be rocked in order to be pacified, the one who’s taking care of him is exempt from sleeping in the Sukkah.
Based on this, Rav Ovadiah Yosef zt”l wrote in Chazon Ovadiah that if a person’s wife is weak and they have children who need to be cared for at night, and by being in the Sukkah he won’t have a way of knowing when to get up for them, in such a case, he is exempt from sleeping in the Sukkah