Thousands of Western Australians were forced to swelter through record heat with no electricity as the grid was smashed by unprecedented demand.