## 3 Materials and Methods
### System of Sensors Network
\begin{table}
\begin{tabular}{c c} \hline \hline
**Metric** & **Typical Values** \\ \hline Heart rate (HR) & 60 to 100 beats per min \\ \hline Breathing frequency (BF) & 12 to 18 breaths per min \\ \hline Temperature (T) & 97.8 \({}^{\circ}\)F to 99.1 \({}^{\circ}\)F (36.5 \({}^{\circ}\)C to 37.3 \({}^{\circ}\)C) \\ \hline Oxygen saturation (OS) & 95–100\% \\ \hline Total sleep time (TST) & between 7 and 8 h \\ \hline REM sleep (REMS) & between 20 and 25\% of total sleep time \\ \hline Deep sleep (DS) & between 10 and 20\% of sleep time \\ \hline Heart Rate Variability (HRV) & Higher HRV indicates a relaxed and less stressed state than a lower HRV \\ \hline Snoring (S) & few or none of sleep time \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Vital sign metrics [50]. light exposure before bedtime, considering using a sleep aid, avoiding mapping during the day, trying a natural sleep remedy like melatonin, making sure your bed is comfortable and supportive. All these recommendations are aimed at developing good sleep habits which are conducive for a good night's sleep. Start all Nodes ON; set request_time; coordinator_nodes starts; Per each node do: hierarchy_i = 0; set default_measurement_i; set LQI_initial; set RSSI_initial; Per each request_time do: set mensurement_i; end d_measurement_i = |default_measurement_i - measurement_i|; if(d_measurement_i > (0.05 * default_measurement_i)) { hierarchy_i++; } if((hierarchy_i > 3) && (abs(LQI_initial - LQI_i) > (0.05 * LQI_i)) && (abs(RSSI_initial - RSSI_i) > (0.05 * RSSI_i)) { node_i under proactive mode; } else { node_i under reactive mode; } if(hierarchy_i == 3) { node_i sends recommendations(group 1); } else if(hierarchy_i >= 2) { node_i sends recommendations(group 2); } else if(hierarchy_i >= 1) { node_i sends recommendations(group 3); } else {  no recommendations; } end ```  
**Algorithm 1** Algorithm pseudocode of the network system. \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Group** & **Types of Recommendations** \\ \hline \multirow{4}{*}{Group 1} & 1. Close windows 2. Use a comfortable mattress and pillows 3. Use a noise machine or earpiags 4. Keep the room at a cool temperature 5. Use a humidifier to improve air quality 6. Keep the room dark and use black-out curtains 7. Keep electronics out of the bedroom \\ \hline \multirow{4}{*}{Group 2} & 1. Practice relaxation techniques before bedtime 2. Keep a consistent sleep schedule 3. Use a weighted blanket 4. Try aroundraberry with essential oils 5. Avoid caffeine and heavy meals before bedtime 6. Use a white noise machine 7. Try a sleep mask \\ \hline \multirow{4}{*}{Group 3} & 1. Establish a bedtime routine 2. Exercise regularly but not close to bedtime 3. Avoid blue light exposure before bedtime 4. Consider using a sleep aid 5. Avoid mapping during the day 6. Try a natural sleep remedy like melatonin 7. Make sure your bed is comfortable and supportive \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Recommendations for sleeping better at home. This Table contains recommendations adapted to the general functioning of an average house in Mexico in an urban area. Each one of the groups is related to characteristics of the house or of the people, which could directly or indirectly impact the way the person sleeps. For example, Group 1 presents recommendations for the house or its composition. Group 2 presents recommendations mainly related to the person, which can be part of their daily life and habits. Moreover, Group 3 has recommendations about the person's bedroom. These recommendations can be helpful for people who are seeking ways to improve their sleep quality, especially for those who are using remote assistance systems for monitoring their sleep patterns. These systems can track and monitor an individual's sleep patterns and provide feedback on areas where improvements can be made. By following these recommendations, individuals can improve their sleep quality and overall well-being.