Device-to-device/machine-to-machine wifi IoT system -- pushing message/action to a connected device
If I were you, I would use MQTT messaging protocol. It is simple and easy to use. But it requires a broker (server) machine to work. I recommend reading this article about MQTT. Also it is really easy to add more sensor to the system.

Your system should be like this if you use MQTT:


Device #1, #2: "publishers", they are in deep-sleep for the most of the time (WiFi devices are really power hungry, they can consume about 200mA during data transmission). They only wake up on sensor state change and then publish their states (let's call them "ON1", "ON2", "OFF1", "OFF2") to a topic (let's call it "Status").
Device #3: "subscriber", it subscribes to "Status" topic and checks if the last two message were "ON1" and "ON2". Messages arrive "immediately" when using MQTT protocol, so creating a callback function on receiving a message will be fast enough to achive 2-3 second respond time (in fact it will be much more faster).
MQTT broker, for example a Raspberry Pi or an online one like this, used to host topic(s).


Note that if you are using a LAN, not an online, broker, it also can work as Device #3 ("subscriber").