How do i create routine if light switch tripped twice

i tried to figure out on my own but got stuck.
i trying to learn it in automation and node red

what i have is a garage lights and a center garage light… center garage light is running a shelly1

and the garage lights is running a shelly 1pm as it for a 3 way switch

what id like is

flip the light switch on only the garage lights Shelly 1pm comes on
flip the light switch on off on like .5 second inbetween then it also turns on the shelly1 (garage light center)

how do i do that? i have figure how in node red and automation how if light switch comes on it turns on both lights but id like it to stay off the center one till a second trip of the light

and then when you shut off they both shut off,. can it be done?