New York works to beat heat while curbing rising energy demand