This will send a 3-tick pulse when you sleep in a bed or when you use a command to change it to day (if it is night).
The length of the redstone dust is required. The length of redstone from the daylight sensor to the comparator and the repeater is so that it will be ready to activate by the time the sun is setting, rather than after it has already set. The length of redstone from the comparator to the output (glowstone lamp) is so that it will only activate when it changes to day quickly, rather than when the sun rises normally.
Now make it somehow give nightmares during thunderstorms
I like your suggestion so here is the thunderstorm sleep detector. Sorry about how long it took. But it does have a small issue, it won't activate if you get into the bed before the sun is halfway behind the horizon.
With a few tweaks it now activates only when you go to sleep during a thunderstorm (unless you get to sleep before the sun sets)
The length of the redstone dust is required. The length of redstone from the daylight sensor to the comparator and the repeater is so that it will be ready to activate by the time the sun is setting, rather than after it has already set. The length of redstone from the comparator to the output (glowstone lamp) is so that it will only activate when it changes to day quickly, rather than when the sun rises normally.
Now make it somehow give nightmares during thunderstorms
I like your suggestion so here is the thunderstorm sleep detector. Sorry about how long it took. But it does have a small issue, it won't activate if you get into the bed before the sun is halfway behind the horizon.
With a few tweaks it now activates only when you go to sleep during a thunderstorm (unless you get to sleep before the sun sets)