What are all the changes caused by sleeping in a bed?
I have a suggestion for your design problem, rather than the question you asked:
Place a bed surrounded by slabs or other (partially) solid blocks. If you block off all 10 spaces around the bed in this way, then it will function normally for skipping the night, but for respawning the player will spawn at their original spawn point (“Your home bed was missing or obstructed”). Neither slabs nor beds can be broken in adventure mode, so this setup cannot be altered by the player.
(However, it wouldn't be all that surprising if beds were later changed to permit spawning under these conditions, so your proposed command block scheme is possibly more robust against future versions.)
This pictured bed is surrounded by one slab at the foot and stairs elsewhere.
The only difference you'll find is that the weather tends to reset back to clear conditions after sleeping. (This doesn't always happen though.) Your Command Block solution should be fine.
Notable events that happen upon waking include:
- Time change.
- Weather clear.
- When you wake up, you'll be placed in front of your bed, not where you were when you right-clicked the bed.