Unknown entity in automations after HA update

Hello all,

I have a bit of a weird problem.

some time ago I bought a new phone (iPhone).
I of course installed the HA mobile app on it and as such it was registered by HA. I then removed the old iPhone from the mobile app.

There are a whole bunch of automations that are either triggered by my phone or where my phone has a conditional state or where the focus state is used in an automation. For example lights that go on in dim when the focus mode is on.

After setting up the this new phone and after having the the first HA update I noticed that some of the automation revert to the old iPhone Focus state which of course is not there anymore.

The first time I manually adjusted the automations to where it was again correct. and everything seemed to work. However after updating HA again the issue reappeared. I then decided to take a look at the automation.yaml file and changed the correct entity_id there hoping that when I would save that file it would be solved. But it didn’t

I have just updated to all the latest versions and the issue is still present. Should anyone have had the same issue in the past I be very interested to know the solution.

Edit: I did remove the new phone and add again and following that change the automations to reflect the correct entity id’s