Detect opening/closing windows to turn on/off the air conditioning

Hello,

Starting on HA, I am looking to recover the state and movements of Netatmo’s door and window sensors connected to my indoor cameras.

Once the movements are recovered, I could turn the air conditioning on or off.

I saw the tutorial below, but I can’t know where to integrate the scripts.

Thank you for your help