Nuki Smart Lock 2.0 - support all available API actions (i.e. add lock/unlock)

The problem is the trigger. Your templates won’t be evaluated until there is a trigger. In what your propose, you still have only the callback event, so the values will still only be calculated only when a callback arrives.
You could try the solution proposed here: Enhance Trigger-based Template Sensors
Or add a state trigger based on your sensor.nuki_door_state entity (if this is the correct entity). This latter solution will also make this trigger template updates every time your polled sensor updates
Then for your ifs, you should test on the trigger.platform / event_type, I think.