Timer reset in js rule

if (tvautomatedofftimer !== null) tvautomatedofftimer.cancel();

I think jsscripting has the ?. syntax too but I’m not familiar with it.