Please could someone tell me why this automation doesn’t work

If you formatted your automation, we could probably see.

See point 11