If I'm playing on the computer and not watching the time, this is a quick reminder to head for bed since I have to work the next morning. The routine is currently set using a Google Pixel 2 phone and the Google assistant (I have three speakers in the house). I'm sure it can be adapted to the other speaker assistants (Alexa, for example) with minimum work
Profile bedtime routine
Entry settings
Wifi connected (selected both my home wifi)
from 6:20pm to 6:45pm (easily changed to whatever time you want)
Sunday - Thursday (I work Monday - Friday with weekends off, so I don't want this playing on my day off)
Entrance task
A1: Media volume 25 (in case I turned the volume down while playing a game)
A2: Notification volume 1 (I don't like notifications dinging at me while I sleep)
A3: Ringer volume 7 (work sometimes calls at night or family might call in an emergency)
A4: Wait 2 seconds
A5: Perform Task
Name: Say time (we'll cover this in a couple of minutes)
A6: Say Text: Bedtime routine will play in 10 minutes.
A7: Wait 8 minutes
A8: Say Text: Bedtime routine will play in 2 minutes.
A9: Wait 1 minute
A10: Say Text: Bedtime routine will play in 1 minute.
A11: Wait 1 minute
A12: Say Text: Hey, Google
A13: Wait 1 second
A14: Say Text: Bedtime
End task
(Note, I have a bedtime routine set up on the Google home speakers to set volume on each speaker to a reasonable level, tell me the forecast for tomorrow, calendar events I have for tomorrow and then play sleep sounds. The speakers shut off automatically after 1 hour with the sleep sounds,)
*Disclaimer: I did not create this say time task, I copied it from the https://grokbase.com/t/gg/tasker/145ar13a3e/change-24-hour-to-12-hour-time website and scrolled down to the first comment (Brandon Horwath). This reads the time in 12 hour format.
If you get the value into a variable, here's how tasker could do it. (Don't really know java either)
A1: Variable Set [ Name:%time To:%TIME Do Maths:Off Append:Off ]
A2: Variable Split [ Name:%time Splitter:. Delete Base:Off ]
A3: If [ %time1 < 12 ]
A4: Variable Set [ Name:%time3 To:am Do Maths:Off Append:Off ]
A5: Else
A6: Variable Set [ Name:%time3 To:pm Do Maths:Off Append:Off ]
A7: End If
A8: Variable Subtract [ Name:%time1 Value:12 ] If [ %time1 > 12.59 ]
A9: Flash [ Text:%time1:%time2 %time3 Long:Off ]
*NOTE: The only change I made to this routine was A9. Instead of flashing the time on the screen, I have it:
Say Text: The current time is %time1:%time2 %time3
This works out perfect…so no matter when the bedtime routine starts, it will read me the correct time.
Say the time link: https://taskernet.com/shares/?user=AS35m8nZFc%2F%2FgsG3EBUQ4wtKG9K5LPUsCmXZiRIuqfP1KMXA6rqtauPyZ%2FXmRobMiLEE4i8%3D&id=Task%3ASay+time
Bedtime routine: https://taskernet.com/shares/?user=AS35m8nZFc%2F%2FgsG3EBUQ4wtKG9K5LPUsCmXZiRIuqfP1KMXA6rqtauPyZ%2FXmRobMiLEE4i8%3D&id=Task%3ABedtime+routine