Alert rule compare the value of two sensors

Hi, I have an enviroment monitoring device that has a Sensor for ambient temperature and Dew Point / Humidity. How could I create a rule that would compare these two sensors, and alert if they are within 3 degrees celcius of each other.

I haven’t made any real progress on this. Here is what i have so far

SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND devices.device_id = 80 AND (sensors.sensor_type = "Temperature" AND sensors.sensor_descr = "Ambient Temperature") AND (sensors.sensor_type = "Temperature" AND sensors.sensor_descr = "Dew Point")