Ghost Thermostat:Cant retain Target temp and state, reverts to defaulted values i cant seem to locate

You need to store the output from the stat, and then feed all values back in, even if you only what to change one of them, as the template doesn't remember the settings I don't think. So any missing values will likely switch to default.

i.e. As I showed in previous post, so put a function before the stat something like this -

var data = {
    'ambient_temperature': global.get("nest1_ambient_temperature") ,
    'target_temperature': global.get("nest1_target_temperature") ,
    'mode': global.get("heating_current_mode") || 'off',
    'away': global.get("nest1_away") || 'false'
}
msg.payload = data;