Optomechanical electrometer based on optical mode-localization sensing