Metal hydrides for smart window and sensor applications