Kogan 1.7L Smart Glass Kettle running Tasmota

My journey into integrating a kettle into openHAB for someone else - @spicerackk

This is not intended for the beginner but give it a go.

Prerequisite

  • Mqtt Binding
  • Mqtt Broker / mosquitto
  • RegEx Transformation
  • JsonPath Transformation
  • JavaScript Transformation

Put tasmota onto kettle using TUYA-CONVERT

Setup tasmota to connect to wifi
Connect to the webpage for kettle and setup module
Configuration - Configure Other

Template

{"NAME":"Kogan Kettle","GPIO":[255,107,255,108,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":54}

Then Configure MQTT with the topic kettle.

In Tasmota console change Setoption4 1 SetOption66 1

Test kettle is working on the tasmota webpage.

Test I can see messages in mqtt from tasmota kettle. I did this using mqtt explorer

A message from kettle for change in temperature

{"TuyaReceived":
{"Data":"55AA00070008050200040000003F58","Cmnd":7,"CmndData":"050200040000003F",
"DpId":5,"DpIdType":2,"DpIdData":"0000003F"}}

Right the kettle has Power, warm mode and reports temperature.
Blackadder Info - Someone already figured all this out.

Yay now we can look at the openHAB to MQTT

I use VScode to edit config files to add things to openHAB but adding in the UI will also work the same.

Things file - Docs


Bridge mqtt:broker:myMQTTBroker [ host ="192.168.1.128", secure =false, username ="open", password ="wide" , clientID ="dentist" ]
{
 
    Thing topic Kettle "Kettle in Kitchen" @ "Kitchen" [ availabilityTopic ="tele/kettle/LWT", payloadAvailable ="Online", payloadNotAvailable ="Offline"] {
    Channels:
        Type switch : PowerSwitch  [ stateTopic ="stat/kettle/POWER", commandTopic ="cmnd/kettle/POWER", on="ON", off="OFF"]
        Type string : WarmMode [ commandTopic ="cmnd/kettle/TuyaSend4"]
        Type number : temperature "Temperature [%.0f °C]" [ stateTopic ="tele/kettle/TUYARECEIVED", transformationPattern ="REGEX:(.*DpId\":5.*)∩JSONPATH:$.TuyaReceived.DpIdData∩JS:HEXtoDEC.js"  ]
      }

}

If you are putting this into the ui ∩ is not N

Items

Switch   KettleInKitchenPowerSwitch                             {channel="mqtt:topic:myMQTTBroker:Kettle:PowerSwitch"}
String   KettleInKitchenWarmMode                                {channel="mqtt:topic:myMQTTBroker:Kettle:WarmMode"}
Number   KettleInKitchenTemperature   "Temperature [%.0f °c]"   {channel="mqtt:topic:myMQTTBroker:Kettle:temperature"}

Kettle.sitemap

sitemap Kettle label="Kitchen" {

Frame label="Kettle" {
 		
	 Switch item=KettleInKitchenPowerSwitch label="Kettle []" icon="kettle" mappings=[ON="On", OFF="Off"]
     Text   item=KettleInKitchenTemperature icon="temperature_hot"
     Switch item=KettleInKitchenWarmMode label="[]" icon="none" mappings=["102,0"="OFF","102,1"="40c","102,2"="50c","102,3"="60c","102,4"="80c","102,5"="90c"]

}
}

Now because the kettle is sending the temperature in hex and I would like it in deg c it needs to be transformed, so I created a file in the transform folder.

HEXtoDEC.js

(function(i) {
  if (i == 'NULL') { return i; }
  if ((i == '-') || (i == 'UNDEF')) { return 'Undefined'; }
  return (parseInt(i,16));
})(input)

Done kettle all working.

Additional comments

transformationPattern =
"REGEX:(.*DpId\":5.*)∩JSONPATH:$.TuyaReceived.DpIdData∩JS:HEXtoDEC.js" ]
      

REGEX:(.DpId":5.) Filter out all messages we don’t want
JSONPATH:$.TuyaReceived.DpIdData Only look at the temp data in hex
JS:HEXtoDEC.js Convert HEX to DEC

If you want to put warm mode into a rule you would do it like.

// Warm to 60°c
KettleInKitchenWarmMode.sendCommand("102,3") 
3 Likes

Thanks for the awesome thread! How’d you manage to flash your kettle? I’ve tried tuya-convert but it just won’t detect the kettle. I’ve flashed numerous other Kogan devices without any issues.

I’m worried it’s a bricked kettle, the Smarter Home app can’t seem to detect it either, even though the Kettle AP is appearing.

You can’t flash the new tuya firmware using tuya convert. Its a cat and mouse game, the cat is winning.

Open the handle and remove the ESP8266 module and you will need to flash it using a soldering iron

Update…

Just started with OH 4 and found issue with regex filter “REGEX:(.DpId":5.)∩”
I don’t think it is returning NULL when not found so is passing whole string to next transformation.

Found it easier to do temperature calculations in tasmota rule.

Thing setup yeah its in TEXT still
Broker is setup in UI and has the name mqtt:broker:openhab

// Tasmota setup enter into console on tasmota
// setoption 4 1
// setoption 66 1 
// rule1 ON TuyaReceived#DpType2Id5 DO Publish stat/%topic%/TEMPERATURE %value% ENDON

  Thing mqtt:topic:Kettle "Kettle in Kitchen" (mqtt:broker:openhab) @ "Kitchen" [ availabilityTopic ="tele/Kettle/LWT", payloadAvailable ="Online", payloadNotAvailable ="Offline"] {
  Channels:
      Type switch : PowerSwitch  [ stateTopic ="stat/Kettle/POWER", commandTopic ="cmnd/Kettle/POWER", on="ON", off="OFF"]
      Type string : WarmMode [ commandTopic ="cmnd/Kettle/TuyaSend4"]
      Type number : temperature "Temperature [%.0f °C]" [ stateTopic ="stat/Kettle/TEMPERATURE" ]
        }

Items are setup using the create equipment from things.