Automation triggered by difference in two sensors


I have a small Theater Room that stays quite comfortable when it’s just the wife and I and we leave the door open. However, when the grandkids are all here and the door is shut, it gets too warm. I have installed an low noise exhaust fan and duct to the to adjacent Great Room. It’s controlled by a Z-wave switch. Right now I just turn it on when the kids are using the room.

I’d like to automate it using data from a couple of Yolink sensors I already have. One is in the Great Room and the other is in the Theater Room and both are currently available within Home Assistant.

I see how to set up the fan so that it will turn on when it rises above a certain set point and turn it off when it falls below. The problem with this is the set point changes with season. What I’d like to do is turn it on if the Theatre room rises more than say 2 degrees above the Great Room.

Is this possible? If so, can someone point me in the right direction.


A simple approach might be to create a template binary sensor that turns on when one room is 2 degrees warmer than the other, then use that as a trigger for your automation.

Unless you really need an additional sensor for use somewhere else then skip the template sensor and just use a template trigger directly in the automation and use the same template that you would have used in the sensor as the value of the trigger.

  - platform: template
    value_template: "{{ states('sensor.your_first_sensor') | float(0) > states('sensor.your_second_sensor') | float(0) + 2 }}"