Automation refused to work until I 'moved' it?

So I have an automation that’s been working flawlessly for about a year. It is watching for the change in state of an Xiaomi door/window sensor. It then fires off an MQTT publish when the sensor goes from off, to on.

I’ve recently had to manually upgrade my hass instance and have moved all my automations over to the new system. I just did this by copying and pasting the config YAML file. So far as I can tell, this is the only automation that had got ‘stuck’.

I initially thought the zigbee sensor wasn’t being detected properly, but I checked in the entity register and I can see the state toggling as I open/shut the door.

Back to the automation, If I manually click ‘execute’, the automation works as normal and the action MQTT is fired.

I tried making a slight change to the automation and then reloading them. No difference.

Given that I have a 98% identical automation for another door/window sensor that still works, I began to despair.

I cut and pasted the automation and moved it to the very bottom of the list of automations, saved and reloaded automations another time.

This time, the automation now works?!

I do not understand this. Especially as all the while the automation was there to see in the entity register, it’s not like the server was unaware of its existence.

Anyone experienced anything like this???