A fully backward representation of semilinear PDEs applied to the control of thermostatic loads in power systems