I believe that the following modifications to your original circuit would work, although I haven't actually tried it. In your original circuit, as others have pointed out, the pot is just changing the current through the optocoupler but it will be either on or off and you will not be adjusting a voltage point where it turns on or off. Also there is no safe current limit to the optocoupler so it is very possible to burn out the LEDs in the optocoupler. Also note that if the clamping diodes are regular diodes they will probably clamp at 0.6 volts but the LEDs require maybe 2 volts to turn on. A couple of back to back zeners in series across the pot might work but these diodes probably aren't necessary if the current limiting resistor limits the current to a safe value.
If you connect the 3rd pin on the pot to neutral, the pot will now become a true voltage divider which is what I believe you want. Now to protect the optocoupler when the pot is set to max, choose a series resistor that will limit the max current through the LEDs to a safe value. As a guess I would think it would be 1500+ ohms but that depends on the LEDs, the value of the pot, and whether the input voltage is measured as RMS or peak.