How do you know if the dose switch is broken? Open up the front door and remove the brew group, like during usual cleaning. In the upper right of the exposed area is the door where the grinds drop into the brew group; you can push open that trap door and feel for the paddle that activates the microswitch. For me it was noticeably stuck after being unused for a day, but then would free up after being forced.
Once the microswitch has been determined the problem, you need a replacement. The Saeco part number is NE05.017 which was determined from this schematic. A few places online selling parts have this, but I ordered directly from Seattle Coffee Gear since I was going to order from them anyway. They stock this part as PRT119C6880 for $7.62 -- just need to call them to order since it's not on the web. They are very helpful!
How to replace the switch? Let's go! First, you'll need a #2 phillips driver with a relatively long handle, a small torx driver (T10 I believe), and a spudger or some similar prodding tool (I'm using a wax carving tool that I normally use to clean the grinder). A flashlight might be handy for the first try.
These instructions are based on what I found in these documents, and hopefully I improved upon them because they are pretty hard to follow:
1. Open up the machine like you were going to clean the grinder, but you only need to remove the bean hopper -- no need to take apart the grinder. This video is great to learn how to clean the grinder and get this far. When moving the machine to dump out the beans from the hopper, be sure to remove the water container first! I suspect that getting water in the four top vent openings (center of the picture below) is what got me into this mess.
2. The machine should now look like the picture above. To remove the top cover, first remove the torx screw [A] and the phillips screw [B].
3. Two more phillips screws to remove at [C] and [D]. (yes, I cleaned it all)
4. That's all the screws to remove the top cover, but now the steam knob is in the way. It can be removed by first turning it ~halfway, then looking at it from below. Use a tool like the spudger to push on the retaining tab through the square at position [E], then pull the knob straight off from the right.
5. Now the cover can be removed and set aside. The microswitch is hiding underneath the solenoid (yellow thing in the center of the picture). To remove the solenoid, first remove the green wire connection [F] by pulling it straight off. Detach white electrical connector [G] so that the solenoid can clear the circuit board. Now press on tab [H] and pull the solenoid straight out (toward left). Be careful when pulling on these connections not to damage any wires and find something safe to brace your hand against -- I was initially pushing against the circuit board but it was flexing so I found something else. And don't lose the return spring which lives on the solenoid shaft.
6. Now the switch is visible in the center of the picture mounted in a small plastic bracket. The spudger can be used to pop it out of position. First need to free the black wires clamped in the lower right of the bracket. Then disconnect the leads and swap switches. Reverse the procedure to put it all back together.
Now the switch is fixed! Enjoy an espresso!
Bonus troubleshooting info: If your machine is leaking dirty water onto the countertop, it could be that the drain into the drip tray is blocked. This happened to me so I followed the pictures and instructions here to clear the clog.