Need help for identifying a temperature spike

Hello,
I am trying to make my oil diffuser (aromatic oil type) smart. I added a thermistor on it and the idea is to turn off the diffuser when the water runs dry. I did a trend sensor but it is not working as intended.

Basically I want to identify the right hand side spike (the one circled in blue) in the attached picture. There will be two temperature rises

  1. When the diffuser turns on and the water temperature changes from room temperature to a higher level
  2. When it runs dry, we observe a sharp increase in temperature. This is what I am interested in

Could someone point me to a logic or mathematics to work out this sharp increase in Home Assistant.
Thank you

spike

This is the trend sensor code I used (which does not work for me)

diffuser_dry:
      friendly_name: Diffuser Water
      entity_id: sensor.ntc_temperature_2
      device_class: moisture
      sample_duration: 600
      min_gradient: 0.003

How about just using a numeric state trigger?

  trigger:
    platform: numeric_state
    entity_id: sensor.ntc_temperature_2
    above: 30

Or does the oil/water mix steady heating/boiling temperature change significantly with different oils and/or water mixes or room temperature?

If this is a problem, just add a condition to your original trend sensor automation that the power has to be on for just over the time for the heat to stabilise.

Thanks @tom_l but this won’t work during the summer months. Right now the room temperature is hovering around 20C during summers it would go as high as 35C without aircon running. Then there will be differences in ambient temperature when fan is running and when aircon or heating is on depending on the weather.
This could only work, if I manually keep changing the threshold every few months.

Yeah I just thought of that and edited my post before seeing your reply.

Let me give that a try, thanks. Of course, I am still open to more ideas.

Can you expand the sensor graph to fill the full with of the screen (click on the graph title) and post a screenshot of this?

I didn’t know that graph expands like this. Wow! learnt something very interesting today. Thanks

The slopes are clearly different:

bc492378386f1ac0d6b9b15a5f67d733874ca8d8

It’s just a matter of getting your parameters right to recognise this increased heating rate when dry. I think you have way too many samples (10 minutes worth) but your min gradient is about right (I calculate 0.002 °C/s for the first slope and 0.005 °C/s for the last slope).

Try:

diffuser_dry:
  friendly_name: Diffuser Water
  entity_id: sensor.ntc_temperature_2
  device_class: moisture
  max_samples: 4
  min_gradient: 0.0035

Note that once you turn off the power this sensor will no longer be on (due to the negative cooling slope) however you should still be able to use this binary sensor turning on to trigger the power off automation.

1 Like

I will try this today and report. Thanks.

Check the developer tools states menu and see if the trend binary sensor attributes actually shows the gradient value. This may not be available as an attribute, I’m not sure.

If it is, watch it as you heat and as it gets dry to get the best min gradient.

If not, it is available here (dont forget to drop the number of samples of the stats sensor to 4 to make it equivalent though):

1 Like