There was never a war with the machines. The machines were always working to preserve humanity in the best way they could. (Humans fucked up the ecosystem by being humans.)
That's why the first #matrix was a paradise. The machines only invented "the war" to keep the humans from killing themselves in paradise.