Setting from enemy back to neutral or friend or ally is not so easy. You will have to make sure that all combat is stopped against the player first. I had a similar setup with my mod, where the town turns hostile to the player if he enters their defence perimeter, but quickly forgets and forgives once he leaves it. I used the following code after a good deal of frustration. Some of that is likely superfluous now, but as it works I haven't gone back and tidied it up.
ModFactionReaction HightownFaction playerFaction 100playerRef.StopCombatAlarmOnActorsetAlly HightownFaction playerFactionsetEnemy HightownFaction playerFaction 1 1
Likely that first line is not necessary...