I think that’s exactly the reason for the trigger. The state was unknown/unavailable during restart, then it got initialized with a value of 0,which is below 3 → trigger.
Did the trigger hapoen at around the same time as you restarted HA?
I tried to emulate problematic situation in automation was not triggered, so your code seems to work. Thank you
Will check out for couple of days to make sure that it works