Integrate Kogan SmarterHome products into HA

I went down this same path using Kogan branded Tuya smart plugs & flashing with Tasmota. I found that if you use the latest version of Tasmota (6.5.0) there are more options in the ‘Configuration Module’ drop-down. Went through a bunch of them and found that the Gosund SP1 module does the trick.

Everything appears to work great including all the power monitoring. Only thing that does not work is the button on the unit - nice to have but not a deal breaker for me.

I opened them up to flash - very easy to do & all the required connection points are labelled - (I just didn’t have all the necessary bits to do OTA flash)

1 Like

I just uploaded this to the Sonoff-Tasmota Template site; https://blakadder.github.io/templates/kogan_smarterhome.html

3 Likes

Is that the one with power monitoring or without?

1 Like

With Monitoring. I worked out what all the pins are so it seems to be working just great. It’s a very basic module so you have to calibrate your self (otherwise known as a 60w bulb…).

Edit: It’s these guys - https://www.kogan.com/au/buy/kogan-smarterhome-smart-plug-with-energy-meter-pack-of-4-kogan/

nice! would you mind sharing the GPIO info etc? I was thinking of getting some but need that detail to use ESPhome, rather than using Tasmota

GPIO0 = Button1 (17)
GPIO4 = HLW8012 CF (133)
GPIO5 = HLWBL CF1 (132)
GPIO12 = HLWBL SELi (131)
GPIO13 = LED1i (56)
GPIO14 = Relay1 (21) - main relay, controls ring LED

Note that you will need to translate some of those onto esphome. However the GPIO13 is an inverted led (so off when on…?) and of the esphome support the HLW 8012 power/wattage/current sensor that should be easy anough to work out (3 pins, CF, CF1 and a selector pin).

Edit2: The Sel pin in inverted too… if you don’t do this you will end up with huge Watts and very small volts :smiley: :smiley:

1 Like

sorry for my lack of understanding here… what do the HLW items represent? I’m guessing these are relating to the power monitoring? but how?

EDIT: just saw your edit :smile: I’m look into it

Details here for ESPHome;

you can see the details on the IC here;

champion! :grin:

1 Like

Pleasure, glad my fiddling over the last few weekends is being so useful.

1 Like

Nice work mate! I just dropped the template into a couple of my switches & now have the button working as well. Time to flash the rest of them.

Great work! Thanks Bevan.

Thanks Bevan. got mine working. Any tips on calibrating these?

Thanks Bevan,

I have been able to OTA flash using tuya-convert to sonoff-basic bin.

I then flashed ESPHome using Intermittent Tech’s (https://blog.quindorian.org/2019/02/home-assistant-10-wifi-energy-meter-with-esphome.html/) code modified to suit the Kogan plug (some GPIO changes)

Seems like everything is working just need to calibrate the plug. To get the button to work correctly I needed to set the mode to input pull-up for the button.

Need to work out calibration next.

Cheers,

JP

With sonoff-tasmota firmware I got an old school 60w bulb and largely followed the guide here GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at

To find voltage (Australia is 230v +/- 10%, so quite wide) use a pre or self-calibrated meter. If you have a solar system then that should also have your current voltage which is going to be fairly good. Worst case, take the reading from one of the Kogans before you flash it.

Watts comes from the bulb. Incandescent bulbs are best for this.

Current can be worked out from the above two, see; Watts/Volts/Amps/Ohms Calculator

Power factor should be 1.0 for an incandescent bulb.

Here are the are the Kogan Smart Plug Tasmota settings as a template string:
{"NAME":"KoganSmartPlug","GPIO":[17,255,255,255,133,132,255,255,131,56,21,255,255],"FLAG":0,"BASE":18}

You can apply this template string configuration in Tasmota (v6.5 upwards) by:

  1. Upgrade to latest Tasmota version, if v6.4 or below (from Main HTTP menu):
    [Firmware Upgrade] | Upgrade by web server: [Start Upgrade]

  2. Enter the custom template string above (from Main HTTP menu):
    [Configuration] | [Configure Other] | Template: paste template string from above
    Check the [Activate] box below the template string
    [Save]

1 Like

Thanks for this mate, works like a charm :+1:

Hi @JustinP do you have an update on this? Would you mind sharing the ESPhome code for the Kogan plugs? I’m just trying to code mine now but a few things are guesses :thinking: at this stage…

Hi Sperkydave,

Here is a config on one of my Kogan plugs, hope this is helpful -

substitutions:
plug_name: plug03

Higher value gives lower watt readout

#current_res: “0.00221”
current_res: “0.00087”

Lower value gives lower voltage readout

#voltage_div: “955”
voltage_div: “2072”
esphome:
name: ${plug_name}
platform: ESP8266
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pwd

Enable logging

logger:

Enable Web server

web_server:
port: 80

Enable Home Assistant API

api:
password: !secret esphome_api
ota:
password: !secret esphome_ota
time:

  • platform: homeassistant
    id: homeassistant_time

switch:

  • platform: gpio
    name: “${plug_name}_Relay”
    pin: GPIO14
    id: relay

restore_mode: ALWAYS_ON

  • platform: gpio
    name: “${plug_name}_LED_Green”
    pin: GPIO13
    inverted: True
    restore_mode: ALWAYS_OFF

sensor:

  • platform: hlw8012
    sel_pin:
    number: GPIO12
    inverted: True
    cf_pin: GPIO04
    cf1_pin: GPIO05
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
    name: “${plug_name}_Amperage”
    unit_of_measurement: A
    voltage:
    name: “${plug_name}_Voltage”
    unit_of_measurement: V
    power:
    name: “${plug_name}_Wattage”
    unit_of_measurement: W
    id: “${plug_name}_Wattage”
    change_mode_every: 8
    update_interval: 10s
  • platform: total_daily_energy
    name: “${plug_name}_Total Daily Energy”
    power_id: “${plug_name}_Wattage”
    filters:
    # Multiplication factor from W to kW is 0.001
    - multiply: 0.001
    unit_of_measurement: kWh

Extra sensor to keep track of plug uptime

  • platform: uptime
    name: ${plug_name}_Uptime Sensor

  • platform: wifi_signal
    name: “${plug_name}_WiFi Signal Sensor”
    update_interval: 60s

binary_sensor:

  • platform: gpio
    pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: True
    name: “${plug_name}_Button”
    on_press:
    • switch.toggle: relay

Thanks, I’ll give it a try.

EDIT: worked nicely, cheers. I just had to play around with the voltage divider to calibrate the reading to match my tested voltage. Out of curiosity where did you get the original values from?