ShareShortcuts
Fork “Sleep History”

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
71K
Saved
2
Actions
228
Category
API
Version
1.16
Language
EN

Preview

😴 History Log

u/chefchip1965

This shortcut takes the sleep history from the health app and generate 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

These 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 to output the data.

What's New

Version 1.16

Shows graphic if you slept more or less than the night before

Version History
1.16 May 7, 2019

Shows graphic if you slept more or less than the night before

1.15 May 3, 2019

Fixed a few bugs

1.14 Apr 20, 2019

Added sleep comparison for the previous night. An arrow to the left of the first heart in the detail

1.13 Apr 18, 2019

Added max and min sleep

1.12 Apr 11, 2019

Minor tweak

1.11 Apr 9, 2019

Updated all nighter calculation

1.10 Apr 9, 2019

Because of the way health sampling forces you to use the start date all the time and with sleep you may go to bed after midnight I had to make a change in the way you retrieve the data samples

1.9 Apr 4, 2019

Missed bug

1.8 Apr 4, 2019

Had to rethink the calculations for bedtime and wake time averages

1.7 Apr 2, 2019

Fixed all all nighters count issue

1.6 Mar 28, 2019

Another stupid widget formatting bug

1.5 Mar 28, 2019

Formatting bug in widgets fixed

1.4 Mar 28, 2019

Added days slept and days missed

1.3 Mar 28, 2019

Updated average sleep duration to account for days where you pulled an all nighter

1.2 Mar 24, 2019

Added average bedtime & Awake time

1.1 Mar 22, 2019

Minor bug fix

1.0 Mar 21, 2019

First release

What it does

228 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. Dictionary
  3. Set Variable
    Goals
  4. Comment
    The dd below generates the current day of the month so the log displays sleep for the entire month.
  5. Date
  6. Format Date
  7. Set Variable
    Tomorrow
  8. Date
  9. Format Date
  10. Adjust Date
  11. Set Variable
    Today
  12. Format Date
  13. Comment
    Change the settings in this action to deliver the results needed for processing.
  14. Repeat
  15. Find Health Samples
  16. Add to Variable
  17. Nothing
  18. Find Health Samples
  19. Add to Variable
  20. Get Variable
  21. Adjust Date
  22. Set Variable
    Today
  23. Get Variable
  24. Adjust Date
  25. Set Variable
    Tomorrow
  26. Get Variable
  27. Repeat with Each
  28. Get Details of Health Sample
  29. Split Text
  30. Get Item from List
  31. Calculate
  32. Get Variable
  33. Get Item from List
  34. Calculate
  35. Calculate
  36. Get Variable
  37. Get Item from List
  38. Calculate
  39. Calculate Statistics
  40. Date
  41. Adjust Date
  42. Format Date
  43. Set Variable
    Maxduration
  44. Get Variable
  45. Calculate Statistics
  46. Date
  47. Adjust Date
  48. Format Date
  49. Set Variable
    Minduration
  50. 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.
  51. Get Variable
  52. Count
  53. Date
  54. Adjust Date
  55. Format Date
  56. Calculate
  57. Comment
    /End calculate if all nighters happened
  58. Get Variable
  59. Count
  60. Get Variable
  61. Get Details of Health Sample
  62. Repeat with Each
  63. Count
  64. If
  65. Get Variable
  66. Get Details of Health Sample
  67. Get Item from List
  68. Set Variable
    Sleeptime
  69. Add to Variable
  70. Get Variable
  71. Get Details of Health Sample
  72. Get Item from List
  73. Set Variable
    Awaketime
  74. Adjust Date
  75. Format Date
  76. Get Variable
  77. Add to Variable
  78. Get Variable
  79. Split Text
  80. Get Item from List
  81. If
  82. Text
  83. Set Variable
    Flag
  84. If
  85. Get Variable
  86. If
  87. Text
  88. Set Variable
    Flag
  89. If
  90. Get Variable
  91. If
  92. Text
  93. Set Variable
    Flag
  94. If
  95. Get Variable
  96. If
  97. Add to Variable
  98. If
  99. Get Variable
  100. If
  101. Add to Variable
  102. If
  103. Get Variable
  104. If
  105. Add to Variable
  106. If
  107. Get Variable
  108. If
  109. Get Variable
  110. Get Item from List
  111. Get Variable
  112. Calculate
  113. Calculate
  114. Add to Variable
  115. Get Variable
  116. If
  117. Get Variable
  118. Get Item from List
  119. Split Text
  120. Get Item from List
  121. Calculate
  122. Get Variable
  123. Get Item from List
  124. Calculate
  125. Calculate
  126. Get Variable
  127. Get Item from List
  128. Calculate
  129. Get Variable
  130. Split Text
  131. Get Item from List
  132. Calculate
  133. Get Variable
  134. Get Item from List
  135. Calculate
  136. Calculate
  137. Get Variable
  138. Get Item from List
  139. Calculate
  140. If
  141. Text
  142. If
  143. Text
  144. If
  145. Text
  146. If
  147. Text
  148. Add to Variable
  149. If
  150. Text
  151. Set Variable
    Flag
  152. Get Variable
  153. Count
  154. Comment
    /Start add a zero to the sleep list for all all nighters or missing data
  155. Repeat
  156. Text
  157. Add to Variable
  158. Comment
    /End add a zero to the sleep list for all all nighters
  159. Comment
    /Start duration average calculation
  160. Get Variable
  161. Calculate Statistics
  162. Date
  163. Adjust Date
  164. Format Date
  165. Set Variable
    Avgduration
  166. Comment
    /End duration average calculation
  167. Comment
    /Start count calculations for flag colors
  168. Get Variable
  169. Count
  170. Get Variable
  171. Count
  172. Get Variable
  173. Count
  174. Comment
    /End count calculations for flag colors
  175. Comment
    /Start gather bedtime data gathering
  176. Get Variable
  177. Repeat with Each
  178. Get Variable
  179. Format Date
  180. Split Text
  181. Get Item from List
  182. If
  183. Comment
    /Start math correction to find correct position of the clock hand if bedtime is after Midnight. This treats the clock a linear line so the average work out to the correct clock hand position.
  184. Calculate
  185. Calculate
  186. If
  187. Calculate
  188. Get Variable
  189. Get Item from List
  190. Calculate
  191. Add to Variable
  192. Comment
    /End bedtime data gathering
  193. Comment
    /Start bedtime average calculation
  194. Get Variable
  195. Calculate Statistics
  196. Format Number
  197. Date
  198. Adjust Date
  199. Format Date
  200. Comment
    /End bedtime average

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