Adding numbers with template sensor

I am automating my bathroom vent fan, I’m planning to compare my house average humidity against the bathroom humidity for an on/off threshold. Problem is my bathroom is very consistently ~10% higher humidity than the rest of the house. So I need to add ~10-15% onto the average for a setpoint for controlling the fan. From my google fu it looks like I need a template sensor, but I’m at a complete loss for how to make this happen after reading through the documentation, am I even on the right track using a template sensor? I’ve done a few templates (binary trend sensor, and 2 switches) before but those are obviously different.

Yes, you’re on the right track. Let us know what entities you have for your sensors to save us having to make too much stuff up.

Well my house average and bathroom humidity sensors are :

sensor.house_humidity_minus_bathroom
sensor.bathroom_temp_humid_humidity
template:
  - binary_sensor:
      - name: Bathroom too humid
        state: >
          {{ states("sensor.bathroom_temp_humid_humidity")|float(0) > states("sensor.house_humidity_minus_bathroom")|float(0) * 1.1 }}

Make sure you only have one top-level template: declaration.

That will be 'on' if the bathroom humidity is more than 10% over the house average. Of course, if the house average is over 91%, it’ll never come on.

1 Like

I think that will work! And I’m not concerned about the house hitting 91%, we very rarely get those conditions and we are adding a heat pump (as soon as the hardware arrives) which will lower the humidity further.