Restore HVAC and switch config - power price spike

I am trying to shutdown all major appliances upon a power price spike. I can identify the spikes and close of spikes.

I am shutting down a bunch of aircons and switches when the event triggers, but when power price recedes, restore the appliance back to their original setting.

Any ideas to easily do this without programming half the world?