Our indesit dishwasher had been flashing lights two and four and would stop prematurely mid cycle during washing.
I checked the heating element and found the resistance to be ok and then took the front cover off and found the problem. The temperature sensor should be held to the metal body of the door in a clip with some thermal paste between the two. What would seem to happen is that when the dishwasher gets hot, the thermal paste acts as a lubricant. When the door is opened quickly I assume it produces enough centrifugal force to cause the sensor to slide out of its clip. Thus the dishwasher will now try to heat to a silly temperature and will trip out before getting there due to the heating element getting too hot.
Video showing fix for lights 2 and 4 flashing on the dishwasher:
Another problem solved with the following video showing a solution for lights 1 and 3 flashing on the dishwasher...
The fix took about 10-15mins. Simply slide the temperature sensor back into place and wrap a cable tie around it to prevent it happening again. Thank goodness we didn't have to buy a new machine. This happened only a couple of weeks after the 1year warranty ran out! We had been out to look at new dishwashers but I thought I'd give it one last try before getting a new one. Thank goodness I did!
Ensure the mains supply has been isolated properly before opening the cover also ensure you are qualified before attempting this.
Step 1: Unscrew the six screws that hold the front panel onto the door and lift out the panel.
Step 2: If the problem is the same as ours, you will find a temperature sensor flapping around inside.
Step 3: Locate the clip with the thermal paste behind it where the sensor had slid out, you can even see the slide mark on the above photo.
Step 4: Slide in the sensor again, ensuring the back gives good contact with the door. Use a cable tie to secure it.