Integrate Kogan SmarterHome products into HA

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?

From memory used a plug in Arlec power meter and a light globe to calibrate but have not really validated the figures yet.

Can you let me know what values you ended up using ?

Cheers,

Justin

Curious if any of you guys has tried flashing or integrating bunning’s other “smart” brand like the “Sengled” or the “wiz

Anyone using any other Kogan products like the diffuser or smart kettle?
Thanks.

HI Justin

I’ve shamelessy copied your example but i can’t get it to validate. I always end up with a “duplicate name” or even an ascii error. Are you able to offer any suggestions? Current error is line 42 duplicate key platform

Screenshots below

I’ve tried using the lint yaml checker, it passes but gets reorganised into a different format that errors out as well

@drenai You need to remove ‘platform: gpio’ on line 42 because it’s already defined on line 37 and can only be defined once.

Hope that helps.

Try checking the indentation and the dashes see screen dump from mine that works without error -

image

If you still have issues let me know.

Cheers,

Justin

Just wanted to let everyone know that I received four new Kogan plugs yesterday and they are still able to be upgraded OTA.

Have both on order, will check them out to see if they can have the firmware swapped out

@bevancoleman I have received some Kogan RGBW bulbs and have flashed one with Tasmota but have no idea of the template to get RGBs going in Tasmota.

This is the Kogan White bulb template:
{"NAME":"Kogan White/Wa","GPIO":[0,0,0,0,37,40,0,0,41,38,39,0,0],"FLAG":0,"BASE":18}

I am assuming that I would need to assign values to some of the zeros, perhaps Led1, Led2 etc, but I am only guessing. I have already tried the Mirabella RGB bulb template and had no luck.

Do you have experience with the Kogan bulbs, and if not, would you like a free bulb for testing purposes to work out the values?

Sorry I don’t have any experiance with the LED bulbs. It does look a LOT like the Mirabella (both physicaly and in the template), but all it takes is one wire to be different and it will not work :frowning:

Does the white template work and show white?

Thanks Justin. Finally got to validate. it turns out the ascii errors were caused by a strange style of quotation mark when i copied some code across