Login About Gallery
How Much Did I Sleep Last Night?
COMMENT
Read the HealthKit database to find out how much you slept last night. You can modify the shortcut to customize Siri's response based on how much time you slept.
DOCUMENTS
Get text from
Shortcut Input
SCRIPTING
Count
Items
in
Text
NUMBER
VARIABLES
Set variable
Asleep Minutes
to
Number
HEALTH
Find
All Health Samples
where
All the following are true
Type
is
Sleep
Start Date
is in the last
1
days
End Date
is today
Value
is
Asleep
Sort by
None
Limit
SCRIPTING
Repeat with each item in
Health Samples
HEALTH
Get
End Date
from
Repeat Item
CALENDAR
Get time between
Repeat Item
and
End Date
in
Minutes
MATHS
Time Between Dates
+
Asleep Minutes
Options Under Construction
VARIABLES
Set variable
Asleep Minutes
to
Calculation Result
End Repeat
MATHS
Asleep Minutes
รท
60.0
Options Under Construction
MATHS
Round
Calculation Result
to
Tenths
Mode
Normal
SCRIPTING
If
Rounded Number
is less than
5.0
TEXT
You should try and get more sleep.
VARIABLES
Set variable
Comment
to
Text
Otherwise
SCRIPTING
If
Rounded Number
is greater than
6.0
TEXT
Nicely done.
VARIABLES
Set variable
Comment
to
Text
Otherwise
End If
End If
VARIABLES
SCRIPTING
If
Count
is
0
SCRIPTING
Show
You slept
Rounded Number
hours last night.
Comment
Otherwise
TEXT
You slept
Rounded Number
hours last night.
Comment
End If

Showcuts

Magic Vars

Screenshot

Submitted Anonymously a month ago

Visit iCloud (iOS)

Copy iCloud Link

Scan QR Code

0