Kogan Kettle how to get to a target temperature?

I’ve got the Kogan Smart Kettle. Following instructions found here I quickly managed to integrate the core functionality with HA (flashed Tasmota, using MQTT). I can turn it on/off and have the water temperature as a sensor.

Now I have one usage scenario that I don’t know how to script: heating water to a given temperature as exactly as possible. Background: it is winter here and I want to fill a hot water bottle with water of 80 degrees.

Problem: the temperature sensor is laggy. It takes time to measure and more importantly: if I turn off the kettle at a given temperature the energy already stored in the heating element of the kettle will further raise the water temperature.

This script approximates a solution:

kogan_kettle_heat_to_80:
  alias: Kogan Kettle Heat to 80
  mode: single
  sequence:
  - data: {}
    entity_id: light.kogankettle_kogankettle
    service: light.turn_on
  - wait_template: '{{states( ''sensor.kogan_kettle_temperature'') | int >= 75 }}'
  - data: {}
    entity_id: light.kogankettle_kogankettle
    service: light.turn_off

With a given water volume and target temperature I can manually anticipate events, in this example: target is 80, but I turn off the kettle when I measure 75. Works well with about 1l of water.

Goal: make the script flexible so it works with different water volumes and temperatures. Idea: if I could measure how much the temperature rises over say 5 seconds I could use that information to estimate volume present and calculate based on that information when to turn off the heating element. How can that be implemented in code?

1 Like

The specific heat capacity of water is 4.2K Joules per kilogram (litre) per degree Celsius, i.e. it takes 4,200 J to raise the temperature of 1 kg of water by 1°C.

1 Watt = 1 Joule per second

You know the power of the kettle.

So from that you can work out the time required to heat any volume of water to 80°C. Then you just have to try it in practise and add an efficiency factor.

e.g.

m = mass of water to be heated in kg (or litres)
T = temperature rise required (above cold water T or ambient T).
P = power of kettle in watts
t = time required in seconds
n = efficiency factor (0 to 1)

t = ( n * T * m * 4200 ) / P

As the only thing you don’t know is n, assume it is 1 and calculate the theoretical time. Then run a few tests and calculate n as theoretical time divided by actual time measured in practice.

The overshoot from the energy required to heat the thermal mass of the element could also be included as a separate calculation, or just by adjusting n.

More here: https://www.bbc.co.uk/bitesize/guides/z2gjtv4/revision/5

Actually, what I can’t lock in is ‘m’. I want to be able to run my script to heat any quantity of water that happens to be in the kettle to 80 degrees. Or even more flexibly to a temperature I can define as an input. The physics isn’t the problem here though. What I don’t know is how I can script a sequence like:

  1. turn on kettle
  2. wait a few seconds for heating element to warm up
  3. measure how many degrees the water temperature rises in say 5 seconds
  4. based on the value found in 3) calculate a turn off temperature that will be used to turn off the kettle when reached. Intention: after adding in all the lags I end up with water at the actual target temperature, which will be higher than the turn-off temperature.
  5. use that calculated value to turn off the kettle

1,2 and 5 are easy, I just don’t know how I can script 3 and 4. I’m happy to arrive at the formula used in calculating 4 by trial and error.

What I don’t know is how to carry over information between the steps and how to have steps that just perform calculations. In any regular programming language I would just use temporary variables, is there something like that available for scripts in HA or do I need to learn how to create a python script for that?

You can use input_numbers for that.
Can you not remotely active the “keep warm” function?

Thanks Jeroen, very helpful!

The keep warm is the easiest solution. I had never tried it before because I misread the user manual. I thought it would always boil first before then keeping warm.

I also tried the other way to learn using input_numbers for other scenarios. Storing temperatures in input_numbers worked fine. What I didn’t get to work was to use an input_number in a wait template, see below. It just never triggered. Any idea why?

- wait_template: 
     "{{(states( 'sensor.kogan_kettle_temperature') | int) >= 
        (states('input_number.kogan_kettle_off_temp') | int)  }}"

Hi Peter,

I must admit this is the first time I’ve read about the wait_template. I’m a new HA user as well.
Do you know “Developer Tools - Template”? It’s a great way to verify templates, by breaking them down line by line.

Yep, I’ve tested the code in “Developer Tools - Template”. It correctly returns True/False.

If I specify a fixed number like I did in the original code up top, the wait_template works. Just not when I compare to the input_number. Tried with " and ', tried squeezing it all into 1 line to rule out indentation problems. Hmmm.

What does the template verificator give if you only put in {{states('input_number.kogan_kettle_off_temp')}}?

77.0
with the | int that becomes: 77

With a sensor value of 23 the whole statement I used results in: “False”
That changes to “True” when I boil the kettle.

Never mind, it’s a bit academic now that I know the warming function delivers what I need.

1 Like