Kogan 1.7L Smart Kettle

Tags: #<Tag:0x00007f32682b4f70> #<Tag:0x00007f32682b4d90> #<Tag:0x00007f32682b4b38> #<Tag:0x00007f32682b4980> #<Tag:0x00007f32682b47c8>

Edit: I added a solution that does not require node-red at the bottom of the post, though I’ve not tested it

I recently purchased the Kogan 1.7 Smart Kettle, when it was on sale for AUD $35.

I was able to achieve the following with the custom firmware Tasmota 8.3.1.

  • Control the boiler (2 way, turning on/off on boiler will reflect on HA)
  • Display Temperature
  • Keep warm (2-way control, changing the value in kettle will reflect on HA)

Here’s how it looks like:

Here’s how I did it:

Following this video and using this template, I was able to flash the kettle with the Tasmota firmware with tuya-convert (Raspberry Pi + ESP8266 doner, I also updated to the latest Tasmota, but this wasn’t required.)

After you setup Tasmota, you need to enable option 66 by typing in the console: SetOption66 1

This will make Tasmota forward all Tuya payloads via MQTT in the tele topic. This could be

tele/<topic>/RESULT

by default, or

<topic>/tele/RESULT

if you use auto-discovery.
This is very important, or the kettle -> HA dropdown integration would not work.

However, the value template provided in the guide mismatch what I receive from TuyaReceived.
Some other community members using Tasmota 8.3.1 have reported the same issue


I had to use this instead:

{% if "5" in value_json["TuyaReceived"] %}
    {{ value_json["TuyaReceived"]["5"]["DpIdData"]|int(base=16) }}
{% else %}
    {{ states("sensor.kettle_temp") }}
{% endif %}

where kettle_temp is the id of the entity.

The whole sensor block:

sensor:
  - platform: mqtt
    unique_id: kettle.temp
    name: kettle_temp
    state_topic: "tele/kettle/RESULT"
    availability_topic: "tele/kettle/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    value_template: >
      {% if "5" in value_json["TuyaReceived"] %}
        {{ value_json["TuyaReceived"]["5"]["DpIdData"]|int(base=16) }}
      {% else %}
        {{ states("sensor.kettle_temp") }}
      {% endif %}
    unit_of_measurement: '℃'

This gives me the temperature readings.

As for switching the boiler on & off, it’s the same as any MQTT switch. You can find it in the home assistant’s MQTT Switch documentation.

Here’s my sample definition.

switch:
  - platform: mqtt
    name: kettle
    unique_id: kettle.power
    state_topic: "stat/kettle/POWER"
    command_topic: "cmnd/kettle/POWER"
    availability_topic: "tele/kettle/LWT"
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

Then comes the complicated part, the “Keep Warm” feature. I can’t find a slider that allows me to skip a value, or have “OFF” as one of the labels, and I don’t really want to write a plugin for it, so I opted for a dropdown. Here’s what it looks like:

input_select:
  kettle_keep_warm:
    name: "Keep Warm"
    options:
      - "OFF"
      - "40 ℃"
      - "50 ℃"
      - "60 ℃"
      - "80 ℃"
      - "90 ℃"

This dropdown by itself doesn’t do anything, you can set it up, so when the value change, it will publish an MQTT message to the kettle, and when you receive a message from the kettle, update the dropdown. You can do this in HA scripts/automation, but I’m using node-red here.

If you use Hass.io, you can follow this documentation to setup node-red.
Home Assistant Community Add-on: Node-RED

I use the docker version of home assistant, so I need to manually set it up with the docker version of node-red. If you’re interested in this configuration, comment below and I could write another post about my setup.

Overview of the node-red flow

The first row handles HA dropdown value change -> send MQTT message to Kettle

Settings for the Dropdown Change in HA, type: trigger: state

Settings for the Temperature to TuyaPayload, type: function
image

Code for the Temperature to TuyaPayload

/* 
 * if you prefer not to use a function node, 
 * you should be able to do this with a `change` node
 * with conditions, I'm a developer so the function node is 
 * always the easiest for me.
 */

const mapping = {
    // the string for the keys (string on the left side of the colon) needs to match exactly to what you set in the `input_select.<your_input_name>.options`
    "OFF": "102,0",
    "40 ℃": "102,1",
    "50 ℃": "102,2",
    "60 ℃": "102,3",
    "80 ℃": "102,4",
    "90 ℃": "102,5",
};

return {
    payload: mapping[msg.payload]
};

Settings for the Send MQTT to Kettle, type: mqtt out
image

Then comes the handling of kettle keep warm state change -> update HA dropdown value

Settings for the Received Tuya Payload from Kettle Tele, type: mqtt in
image

Settings for the Keep Warm State Change, type: function

Code for the Keep Warm State Change

// achievable through `change` node too
const mapping = {
    0: "OFF",
    1: "40 ℃",
    2: "50 ℃",
    3: "60 ℃",
    4: "80 ℃",
    5: "90 ℃",
};
let value;

try { // TuyaReceived.DpType4Id102 might not be in payload
    value = msg.payload.TuyaReceived.DpType4Id102;
} catch(e) {
    return; // the message received was not temperature data, terminate flow
}

const label = mapping[value];

if (!label) {
    return; // the return value isn't in the range of 0 - 5, terminate flow
}

return {payload: label};

Settings for the Update Home Assistant Dropdown Value, type: call service
image

JSON payload for the Update Home Assistant Dropdown Value
*Remember to change input_select.kettle_keep_warm to your dropdown’s entity id

{
  "entity_id": "input_select.kettle_keep_warm",
  "option": msg.payload
}

This last one is optional, it sends a notification to your phone (if you have the HA app installed) after it finish boiling the water.

image

The idea here is when the temperature goes above 98 degrees, and the boiler power state goes from ON to OFF, we consider it finished boiling, there might be a Tuya Payload I could tap into to avoid this check, but for now, this works fine.

Settings for the Water boiled, type: trigger: state

Settings for the Notify, type: call service
image

  • JSON for the Notify
{
    "message": "Water is boiling!",
    "title": "Smart Kettle"
}

If you don’t want to use node-red, here’s how I imagine this setup could work

  • For the HA dropdown -> Kettle part, you can use the automation. Community member myle has done some great work here :+1:.

  • For the Kettle -> HA dropdown part, you should be able to set up an MQTT sensor, following documentation. You would need to use the value_template in a similar manner to how you use the temperature sensor, I imagine it to be something like this, though I have not tested this, let me know if it doesn’t work.

{% set mapping = {
    0: "OFF",
    1: "40 ℃",
    2: "50 ℃",
    3: "60 ℃",
    4: "80 ℃",
    5: "90 ℃",
} %}
{% if "DpType4Id102" in value_json["TuyaReceived"] %}
    {% set raw_value = value_json["TuyaReceived"]["DpType4Id102"] %}
    {% if 0 <= raw_value and raw_value <= 5 %}
        {{ mapping[raw_value] }}
    {% else %}
        {{ states("sensor.kettle_keep_warm") }}
    {% endif %}
{% else %}
    {{ states("sensor.kettle_keep_warm") }}
{% endif %}

Then, you can set up automation to set the sensor value to your dropdown.

Hope it helps :smiley:

2 Likes

here what i did

That’s cool, did u get the keep warm data from kettle and update the drop down?

no dont know how to read that data ( it there is any)

If you turn on Tuya payload forward ( SetOption66 1 ) in Tasmota, then all Tuya Payload will be forwarded via MQTT. If you don’t want to use node-red, I imagine you can set this up as an MQTT sensor, using the Jinja2 template to map 0 to off and 1-5 to temperature. Then you can set up automation, when sensor state change, update the dropdown.
The payload will come through tele/<device>/RESULT by default, or <device>/tele/RESULT if you use auto discovery.

My code for Keep Warm State Change above is in JS, the logic should be simple enough to fit in a Jinja2 template.

I can’t seem to get my temperature sensor to work. These are the extracts from the configuration.yaml file.

sensor:
  - platform: mqtt
    name: "Kettle Temperature"
    state_topic: tele/Kettle/RESULT
    value_template: >
        {% if "5" in value_json["TuyaReceived"] %}
            {{ value_json["TuyaReceived"]["5"]["DpIdData"]|int(base=16) }}
        {% else %}
            {{ states("sensor.kettle_temperature") }}
        {% endif %}
    unit_of_measurement: '°C'
    device_class: temperature

and

switch:
  - platform: mqtt
    name: "Kettle Power"
    unique_id: kettle_power
    state_topic: "stat/Kettle/POWER"
    command_topic: "cmnd/Kettle/POWER"
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false
    qos: 0

The switch works fine, but the temperature says unavailable

EDIT: Actually it works, but it is alternating between unavailable and the temp

Any thoughts?

I think you’re missing the availability topic.
You don’t need to define optimistic if you define availability topic.

  - platform: mqtt
    name: "Kettle Power"
    unique_id: kettle_power
    state_topic: "stat/Kettle/POWER"
    command_topic: "cmnd/Kettle/POWER"
    availability_topic: "tele/Kettle/LWT"
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

I updated the post to include my full configuration.

Thanks for this. Can you set the desired temp from HA? Or does it just turn the kettle on?

Yes, with this setup you can set temperature in HA using the dropdown. Or to set it on the kettle, and the kettle can update the dropdown in HA too. It’s a bidirectional integration.

1 Like

Anyone having issues with this lately? I had it working fine but updated my HASS to the latest version and now temp is now longer showing

@jimmyleet, mine was still working fine on .116 although I was suffering a problem with history graphs not updating (therefore a problem with Recorder, I think), looking at 116.1 release notes I think they fixed the problem. Now, on 116.2 and not having issues with the kettle temp, recorder, or graphs.

So either updating fixed it or a simple reboot.

Has anyone recently flashed their kettle? I received mine a week ago, the AP appears but tuyaconvert simply won’t find it.

Also tried the Smarter Home app and I’m having issues with that too. I think the kettle could be faulty.

I think I read on a Facebook group that someone. Couldn’t flash their recently purchased kettle.

I don’t have many tuya devices but I think it’s advised to use the Tuya app rather than the Kogan app for integrating with home assistant. Perhaps try this as a last effort?

Kogan have a bad reputation for accepting returns, unfortunately. Worth a shot. I got a return back to them but it took quite some effort.

Good luck

Maybe use an app to check what channel the kettle’s AP is on, and the config of what you’re using to flash ? I’ve had issues previously with country specific configuration issues for wirelss connections (e.g. one device is on AU codes, the other US, so the US one can’t see the channel 13 2.4Ghz wifi). Hope that makes sense

I flashed my kettle with Tasmota via TuyaConvert initially.
It died one day (after about 2 weeks of use), it wouldn’t connect to WiFi, so I had to open it up (you can use a guitar pick to pry open the handle), desolder the WiFi chip from the board, then flash it via serial.

Thanks all, got it connected via the original Tuya smart app, so the Kettle is fine, it’s also running on Channel 1 as a CN locale AP.

I’ll attempt to flash Tasmota via serial, this is gonna be my first foray into electronics tinkering. Fingers crossed. Does anyone have any guides that they can recommend?

You’ll need to get a USB FTDI adapter.

Tom recorded how he did it via serial here:

I did it slightly differently, instead of trying to short things out to avoid the Tuya board from being powered up, I simply desoldered these 4 points, separate the two boards and only flash my WiFi board.

Thanks Aaron, I’ll separate them like suggested. I have a CH340G, would that work instead of an FTDI adapter?

that should work fine