Hi. I’m wondering if the following automation could work with HomeKit:

in our bathroom, we have a device that mechanically flips our existing switch for our bathroom fan connected to HomeKit through Homebridge, along with a combination temperature, motion, and humidity sensor from ONVIS. I’d like to get one contact sensor for each of the two bathroom windows and a combination temperature/humidity sensor that is rated for use outside mounted directly below the windows.

I would like the automation to take only the humidity sensor in the bathroom into account as to if to turn the fan in the bathroom on or off when both of the windows are closed. However, when at least one of the windows is open, I would like the automation to take into account the sensor outside, and only turn the fan on if the sensor outside is reading a humidity of 65% or more and the sensor inside is reading a humidity that is 10% higher or more than the humidity being red outside. I then would like the fan to be turned off via the automation when the humidity inside and outside match each other if the humidity outside is reading at 65% or above, and if the humidity outside is lower than that, I would like the fan to turn off when the humidity inside is reading at 65% or below.

Is this something possible to do directly within in-home kit?