ShareShortcuts

Sleep History Log iOS13

chefchip1965
Fork โ€œSleep History Log iOS13โ€

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so chefchip1965 gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. โ€œAdded a step that uses Apple Intelligence to personalise the text.โ€
Downloads
68K
Saved
0
Actions
185
Category
Productivity
Version
1.1
Language
EN

Preview

๐Ÿ˜ด History Log

u/chefchip1965

This shortcut takes the sleep history from the health app and generates a detail log which shows when you begin sleeping and when you awake, the number of hours slept and flags your preset goals.

๐Ÿ’š = target goal, >6

๐Ÿงก = acceptable goal =6

โค = too little, <6

It shows the monthly averages for bedtime, wake time and hours slept. Duration slept, max min and average.

An arrow in the last sleep day shows if you slept more or less than the night before.

The goals are on the hour. You can change them for your personal needs

It is currently set up to work with Sleep++

This should work when your sleep tracker will let you output duration in the following format - hh:mm

You need to change the get health samples if you don't use Sleep++ if the data does not show right to output the data.

What's New

Version 1.1

Fixed bug

Version History
1.1 Jul 4, 2019

Fixed bug

1.0 Jun 28, 2019

First release

What it does

185 actions
  1. Comment
    ๐Ÿ˜ด History Log u/chefchip1965 This shortcut takes the sleep history from the health app and generates a detail log which shows when you begin sleeping and when you awake, the number of hours slept and flags your preset goals. ๐Ÿ’š = target goal, >6 ๐Ÿงกโ€ฆ
  2. Format Date
  3. Set Variable
    Yesterday
  4. Format Date
  5. Set Variable
    Today
  6. Format Date
  7. Repeat
  8. Find Health Samples
  9. Add to Variable
  10. Nothing
  11. Find Health Samples
  12. Add to Variable
  13. Adjust Date
  14. Set Variable
    Yesterday
  15. Adjust Date
  16. Set Variable
    Today
  17. Comment
    Goals are entered below in the # of seconds, below is 7, 6, and 5 hours in seconds
  18. Dictionary
  19. Set Variable
    Goals
  20. Comment
    The dd below generates the current day of the month so the log displays sleep for the entire month.
  21. Set Variable
    Today
  22. Date
  23. Set Variable
    Yesterday
  24. Nothing
  25. Format Date
  26. Comment
    Change the settings in this action to deliver the results needed for processing.
  27. Count
  28. Set Variable
    Datacount
  29. Repeat with Each
  30. Get Details of Health Sample
  31. Comment
    Convert time to seconds
  32. Calculate Statistics
  33. Add to Variable
  34. Comment
    Find maximum duration
  35. Calculate Statistics
  36. Comment
    Convert to time format
  37. Date
  38. Adjust Date
  39. Format Date
  40. Set Variable
    Maxduration
  41. Comment
    Find minimum sleep duration
  42. Calculate Statistics
  43. Comment
    Convert to time format
  44. Date
  45. Adjust Date
  46. Format Date
  47. Set Variable
    Minduration
  48. Comment
    Find average sleep duration
  49. Calculate Statistics
  50. Comment
    Convert to time format
  51. Date
  52. Adjust Date
  53. Format Date
  54. Set Variable
    Avgduration
  55. Comment
    /Start calculate if all nighters happened. It compares the number of days of sleep data recorded to the latest day recorded. If the difference is 0 then no all nighters.
  56. Count
  57. Date
  58. Adjust Date
  59. Format Date
  60. Calculate
  61. Set Variable
    Allnighters
  62. Comment
    /End calculate if all nighters happened
  63. Repeat with Each
  64. Get Details of Health Sample
  65. Adjust Date
  66. Format Date
  67. Set Variable
    Day
  68. Get Details of Health Sample
  69. Format Date
  70. Set Variable
    Bedtime
  71. Add to Variable
  72. Get Details of Health Sample
  73. Format Date
  74. Set Variable
    Waketime
  75. Add to Variable
  76. Get Details of Health Sample
  77. Calculate Statistics
  78. Set Variable
    Todayduration
  79. Date
  80. Adjust Date
  81. Format Date
  82. Set Variable
    Duration
  83. Nothing
  84. If
  85. Calculate
  86. Get Details of Health Sample
  87. Get Item from List
  88. Calculate Statistics
  89. If
  90. Text
  91. If
  92. Text
  93. Set Variable
    Trend
  94. If
  95. If
  96. Text
  97. Set Variable
    Trend
  98. If
  99. Nothing
  100. If
  101. Add to Variable
  102. Text
  103. If
  104. If
  105. Add to Variable
  106. Text
  107. If
  108. Add to Variable
  109. Text
  110. Set Variable
    Sleepgoal
  111. Comment
    Identify max and min duration nights
  112. If
  113. Text
  114. If
  115. If
  116. Text
  117. If
  118. Text
  119. Set Variable
    Duration
  120. Text
  121. Add to Variable
  122. Comment
    Calculate counts for goals
  123. Count
  124. Count
  125. Count
  126. Nothing
  127. Comment
    Calculate average wake time
  128. Repeat with Each
  129. Split Text
  130. Get Item from List
  131. Split Text
  132. Get Item from List
  133. Add to Variable
  134. Get Item from List
  135. Add to Variable
  136. Comment
    Calculate wake time averages
  137. Calculate Statistics
  138. Round Number
  139. Calculate Statistics
  140. Round Number
  141. Text
  142. Set Variable
    Avgwaketime
  143. Comment
    Calculate average bedtime. This is a bit tricky because you have to take into account that you may go to bed after midnight. In order to take care of that straight math will not work. The way I did it was to treat the clock as a linear line and sepaโ€ฆ
  144. Repeat with Each
  145. Split Text
  146. Get Item from List
  147. If
  148. Split Text
  149. Get Item from List
  150. Split Text
  151. Get Item from List
  152. If
  153. Calculate
  154. Add to Variable
  155. If
  156. If
  157. Get Item from List
  158. Split Text
  159. Get Item from List
  160. Add to Variable
  161. Nothing
  162. Comment
    Average converted linear hours list
  163. Repeat with Each
  164. Split Text
  165. Get Item from List
  166. Split Text
  167. Get Item from List
  168. Add to Variable
  169. Comment
    Calculate bedtime average
  170. Calculate Statistics
  171. Round Number
  172. If
  173. Calculate
  174. Set Variable
    Avgbedtimehour
  175. Text
  176. If
  177. Set Variable
    Avgbedtimehour
  178. Text
  179. Set Variable
    A
  180. Calculate Statistics
  181. Round Number
  182. Set Variable
    Avgbedtimeminutes
  183. Text
  184. Set Variable
    Avgbedtime
  185. Show Alert
    Sleep History Log

Ratings & Reviews

Write a Review
โ€“
out of 5
โ˜…โ˜…โ˜…โ˜…โ˜…
โ˜…โ˜…โ˜…โ˜…
โ˜…โ˜…โ˜…
โ˜…โ˜…
โ˜…
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by chefchip1965

See All

You Might Also Like

See All
Advertisement