Here is the solution.
The car is a 2004 R170 SLK 200.
(a) Courtesy light inside car did not go out when door was shut. Had to operate the switch on/off using the switch
(b) Light inside boot/trunk did not come on when boot lid was opened.
(c) When the roof operating button is held back,it flashes red and the hydraulic pump can be heard to run but nothing at all happens.
Boot lock/microswitch assembly found to be sticking.
Open boot lid and you will see a plastic panel which covers the inner locking assembly.
The panel is held in place by three plastic rivets. The panel also has two plastic tags left and right which slot inside the metal bodywork to left and right and there is a locator lug on the rear of the plastic panel.
The rivets are of the two part,pry out type.
Carefully,and using a thin bladed implement such as a pen knife,raise the inner rivet pin by sliding the blade under its edge. Pull rivet pin out.
Repeat for all other rivets and lift cover away.
This now reveals the boot lock and microswitch assembly. The yellow tube carries compressed air to operate the central locking mechanism on the boot lock. To the right on the pic is the microswitch assembly into which the three wires are passing. To the left is the vertical metal rod which links to the boot catch and operating handle. Using some spray lube such as WD40,spray the linkages and operate the boot locking mechanism and handle a few times.
When you shut the boot you should now find that the courtesy light goes out and that the roof will now operate.
The microswitch in this assembly has a number of functions,
It operates the boot light
It forms part of the vario roof control system in that it signals that the boot is shut since the vario roof can only operate when the boot is shut.
Lady Penelope & Parker UK