230VAC line voltage sensing using MCU pin
This is simplified version of your schematics, that should work equal.







simulate this circuit &ndash; Schematic created using CircuitLab

For example SFH628A-4 has a CTR ratio of 250 at 0.5mA IF current. The absolute maximum allowed forward current is 50mA. The insulation resistance is 5.3kV. So at 5.3kV spike, the current trough diode would be 5300/440= 12mA, which is far from absoulte rating.