Aqara FP2 won't trigger automation after midnight

https://www.home-assistant.io/docs/scripts/conditions/#sunsetsunrise-condition

After sunset to midnight condition (what you have):

After sunset to sunrise condition (what you need):

conditions:
  - condition: sun
    after: sunset
    before: sunrise

You should also replace that device trigger with a state trigger, see: Why and how to avoid device_ids in automations and scripts