Telegram + 9x gpio-multi-function-lights + P.I.R + dash all working ;) but need help with a function

thanx, i went back on the posts, and found nothing related to my problem although interesting
if you think i have something to do with these posts, or doing a school project, then no.

https://discourse.nodered.org/t/home-security-alarm/7936?u=lost66
&&
https://discourse.nodered.org/t/security-alarm-turn-on-light-and-buzzer/8134?u=lost66

what i think i need, is a function node between the gpio node and smartswitch node, that will replace the three buttons, but must have a switch on the dash to disable

so if i am not mistaken,

when switched on and when p.i.r is triggered, the node must send:
the topics: set = 1, timeout = 30 and state = 1. if enabled but, not time out if light is already on

thanx again