Hey there,
alternative approach: I’ve hacked an Air Wick Freshmatic. The 3D printed cover houses the ESP, which switches the device on and off by acting as a AA battery. The device releases one spray 15 seconds after the power was connected. Assuming this delay is acceptable to you the electrical solution and further HA automation is rather simple. Works perfectly in two bathrooms for the last two years.
Happy to share details and code.