240v input switch for Rangehood

G’day guys, I am sure this is a common question but I havent been able to find an answer just yet. I am looking to run under bench LEDs with wled on a nodemcu. In the middle of this run of LEDs is the rangehood from which I am going to get the power and mount the nodemcu. I would like to set it up so that the rangehood light turns the LEDs on/off and then I will also have a seperate “disco” mode, to be run from HA or the wled app. What is the best way to wire my 240v opto isolator into a spare GPIO and what configuration is necessary. Cheers

Should I be looking along the lines of something like this perhaps