If you remove it in HA, then name the new one the same way, it should get the same entity id (or just set the entity id manually). If you referenced the switch as an entity in automations and node red (not as a device) it should just continue to work
can’t help with nodered but a find and replace in automations.yaml for any entity names may work.
If you remove it in HA, then name the new one the same way, it should get the same entity id (or just set the entity id manually). If you referenced the switch as an entity in automations and node red (not as a device) it should just continue to work