Electrochromic and photoelectrochromic switching devices based on aryl amine redox chemistry