The red wire will likely be a secondary very hot wire. Over a smart switch, the purple wire normally connects on the switch leg to control a light or other load. In just an electrical box, a purple wire could be a traveler, a switch leg or the next warm https://smartswitchesforhome64281.ampedpages.com/the-best-side-of-safe-electrical-wiring-61691193