Program thermostat based on alarm state

I have a Trane thermostat and a AD2USB hooked up to my Vera 2. What I would like to do is when my alarm goes into an away state the thermstat turns to a specific tempature, which I already figured out how to do using a scene called away. What I can’t figure out is how do I get the thermostat to return to it’s last tempature setting when I arrive home and disable the alarm? I have 4 scenes setup based on time of day right now for the thermostat so I think that complicates things?