Use rapid temperature delta to trigger automation?

Here’s a scenario. I have motion controlled lights in the bathroom that come on when you enter and stay on so long as there’s motion, dim after a minute of no motion and turn off 3 minutes later.

The problem is that the Hue motion sensor can’t see the shower stall so if you’re showering. Well it gets dark.

The Hue motion sensor also has a thermometer in it and I can get the temp in the bathroom. As you can see below, you can clearly tell when someone showers as the temp rises above nominal very quickly since the sensor is near the ceiling.
bathroomtemp
Is there a way to say something to the effect of:

If temp rises above then do something?

I believe variance as calculated by the statistics sensor should be able to identify those spikes. You could also look at the trend sensor to identify when the temperature is rising vs. falling if that’s important to you.

1 Like

Perhaps, use a binary sensor as a condition in an automation.

- platform: template
  sensors:
      hue_motion_temp_above_nominal:
        friendly_name: "Bathroom Above Nominal"
        value_template: '{{ states.sensor.hue_motion_temp.state | float > 20 }}'

Then if that binary_sensor is ‘True’, e.g. above 20, prevent the automation from turning off the light.

Hey all!

Thanks for pointing me in the right direction. My original post was somewhat muddled due to formatting. Here’s what I did to help others out with comparing the values of two sensors.

The first thing I did was to setup the statistics sensor:

- platform: statistics
     entity_id: sensor.bathroom_temp
         name: Bathroom Temp
         sampling_size: 400
         max_age:
             minutes: 300

In the above example, it’ll take the last 400 readings no longer than 5 hours of history.

Then I made an additional binary sensor to give a true or false if someone was showering.

- platform: template
      sensors:
          showering:
              value_template: '{{ (states.sensor.bathroom_temp.state | float) > ((states.sensor.bathroom_temp_mean.state | float)+1) }}'
              friendly_name: 'Someone Showering'

Now I get a True/False, that I can use as either a trigger for turning the lights on full brightness and as a condition preventing the off-with-no-motion automations.

YMMV but I’ve found that the temp will break threshold in about 2 minutes (before my auto-off due to no motion) and takes about 10 minutes to shut off after a hot and steamy shower.

Hope that helps someone!

3 Likes