I got one of these
https://www.kogan.com/au/buy/kogan-smarterhome-17l-smart-glass-kettle/
tasmota it
wrote this
I got one of these
https://www.kogan.com/au/buy/kogan-smarterhome-17l-smart-glass-kettle/
tasmota it
wrote this
Thanks Dave, I used the following instructions in my YAML file but I canât get the sliders in HA to be correctly mapped, the pin assignment for the output_white is probably not right or something is missing. The âwhite valueâ slider seems inactive. What do you recommend reading to understand how to figure out the pins mapping?
light:
- platform: rgbw
name: ${name}
red: output_red
green: output_green
blue: output_blue
white: output_white
output:
- platform: esp8266_pwm
id: output_red
pin: GPIO4
- platform: esp8266_pwm
id: output_green
pin: GPIO12
- platform: esp8266_pwm
id: output_blue
pin: GPIO14
- platform: esp8266_pwm
id: output_white
pin: GPIO13
Can I get a version of this with proper formatting? I canât seem to get it to validate, as Iâm having issues with the indentation.
Hey Lance
Try this -
substitutions:
plug_name: plug01
# 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
#- platform: gpio
# name: "${plug_name}_LED_Red"
# 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: 60s
- 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: 300s
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "${plug_name}_Button"
on_press:
- switch.toggle: relay
âKogan SmarterHomeâą Smart Plug with Energy Meter & 5V 2.4A USB Portsâ
If youâd like the button to work, use the following.
- platform: gpio
pin:
number: GPIO2
mode: INPUT_PULLUP
inverted: true
name: "$devicename Power Button"
on_press:
- switch.toggle: relay
- platform: gpio
pin:
number: GPIO3
mode: INPUT_PULLUP
inverted: true
name: "$devicename Power Button"
on_press:
- switch.toggle: relay
Yeah I know. Either item on its own doesnât make the button work but having them both doesâŠ
Worked perfectlyâŠThanks all!!
I got my Kogan Lights working in esphome with the following config (after adapting your config and @kanga_whoâs tasmota config from a few posts back):
I couldnât get the colour temp slider to transition between the white LEDs and the RGB LEDs though. (Solved! see below)
light:
# merges the brightness slider and white level slider into one
- platform: custom
lambda: |-
auto light_out = new BetterRGBWLightOutput(id(red), id(green), id(blue), id(cold_white), id(warm_white));
App.register_component(light_out);
return {light_out};
lights:
- name: $display_name
default_transition_length: 500ms
sm16716:
data_pin: GPIO14
clock_pin: GPIO4
num_channels: 3
num_chips: 1
power_supply:
- id: rgb_power
pin: GPIO13
output:
- platform: sm16716
id: blue
channel: 0
power_supply: rgb_power
- platform: sm16716
id: green
channel: 1
power_supply: rgb_power
- platform: sm16716
id: red
channel: 2
power_supply: rgb_power
- platform: esp8266_pwm
id: warm_white
pin: GPIO5
- platform: esp8266_pwm
id: cold_white
pin: GPIO13
I also got the colour temperature to gradually switch between the RGB and main white LED light with the following modified BetterRGBWOutput code by user displaced:
/* A Better RGBW(W) Output
Based on/inspired by user *envy* at https://github.com/esphome/feature-requests/issues/212#issuecomment-498036079
And modified by *kabloomy* for Australian Kogan SmarterHome lights
Why?:
I have RGBWW (RGB + Cool-White + Warm-White) LED bulbs. After finding the correct PWM GPIOs to control each channel
and setting them up with esphome and HomeAssistant, I noticed the controls in HA were weird.
HA presented a brightness slider, colour temperature slider, 'white value' slider and an RGB picker.
The 'white value' and 'brightness' only worked to brighten/dim the CW/WW and RGB LEDs respectively. I wanted a single
'brightness' slider that worked no matter if the bulb was showing white or colour.
How?:
This output checks what the desired state is. If the RGB levels are equal, then the code turns off the RGB
LEDs and turns on the Cool and Warm LEDs. These levels set the white temperature, but not the brightness.
So, we also grab the brightness setting and multiply the CW/WW levels by it to get final levels for CW/WW.
If the desired RGB levels differ from eachother, then we know we want a coloured light. So, the code
turns off the CW/WW LEDs and sets the RGB levels as desired. We don't do a brightness multiplication here,
since that already seems to have been applied.
*/
#pragma once
#include "esphome.h"
class BetterRGBWLightOutput : public Component, public LightOutput {
public:
BetterRGBWLightOutput(FloatOutput *red, FloatOutput *green, FloatOutput *blue, FloatOutput *cold_white, FloatOutput *warm_white)
{
red_ = red;
green_ = green;
blue_ = blue;
cold_white_ = cold_white;
warm_white_ = warm_white;
}
LightTraits get_traits() override {
auto traits = LightTraits();
traits.set_supports_brightness(true);
traits.set_supports_rgb(true);
traits.set_supports_color_temperature(true);
traits.set_min_mireds(166);
traits.set_max_mireds(370);
return traits;
}
void write_state(LightState *state) override {
float red, green, blue, cold_white, warm_white, brightness;
state->current_values_as_rgbww(&red, &green, &blue, &cold_white, &warm_white);
state->current_values_as_brightness(&brightness);
if (red == green && red == blue && cold_white != 0)
{
// Cool white mode (RGB)
// the cold_white pin doesn't seem to exist in the Kogan lights...
// cold white is simulated with the RGB
this->red_->set_level(cold_white * brightness);
this->green_->set_level(cold_white * brightness);
this->blue_->set_level(cold_white * brightness);
this->cold_white_->set_level(0);
this->warm_white_->set_level(0.5 * warm_white * brightness);
}
else if (red == green && red == blue)
{
// Warm white mode
this->red_->set_level(0);
this->green_->set_level(0);
this->blue_->set_level(0);
this->cold_white_->set_level(0);
this->warm_white_->set_level(warm_white * brightness);
}
else
{
// RGB mode
this->red_->set_level(red);
this->green_->set_level(green);
this->blue_->set_level(blue);
this->cold_white_->set_level(0);
this->warm_white_->set_level(0);
}
}
protected:
FloatOutput *red_;
FloatOutput *green_;
FloatOutput *blue_;
FloatOutput *cold_white_;
FloatOutput *warm_white_;
};
cheers Asher, the last missing piece!
For other newbies like me, this needs to be in the âbinary_sensor:â section
An FYI who runs into issues with Kogan WA template - the new Kogan White Temperature bulbs require a different tasmota template:
{"NAME":"GenioBulbCCT","GPIO":[0,0,0,0,0,37,0,0,0,38,0,0,0],"FLAG":0,"BASE":48}
The important bit there is the BASE: 48, using module 48 which has one channel for brightness and one for color temperature.
The product code is the same for old and new bulbs, I ran into it replacing older bulbs and couldnât work out why the old template wasnât working , gah!
Are you using this model: https://www.kogan.com/au/buy/kogan-smarterhome-smart-plug-energy-meter-5v-24a-usb-ports/
I canât see a button, looking to buy one but I donât know if itâs supported (different than https://www.kogan.com/au/buy/kogan-smarterhome-smart-plug-energy-meter/)
Button is on the bottom
Can flash using Tuya-convert using tasmota or esphome firmware
Today I flashed a hihome smart switch (wpp 16s1) with tuyaconvert and esphome. Everything works but it shows the wrong voltages aprox 600 V⊠How do I calibrate this. I know I can do this with current_resistor and voltage_divider right? But what does these values say and how do I have to interpret them to calibrate the sensor.
I have the same issue, I got a Kogan Smart Plug that I flashed with tuya convert and the V seems off.
substitutions:
plug_name: kogan_plug_01
current_res: "0.00087"
voltage_div: "2072"
switch:
- platform: gpio
name: "${plug_name}_Relay"
pin: GPIO14
id: relay
- 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: 60s
- 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: 300s
binary_sensor:
- platform: gpio
pin:
number: GPIO2
mode: INPUT_PULLUP
inverted: true
name: "$plug_name Power Button"
on_press:
- switch.toggle: relay
- platform: gpio
pin:
number: GPIO3
mode: INPUT_PULLUP
inverted: true
name: "$plug_name Power Button"
on_press:
- switch.toggle: relay
My readings (I have an almost idle 2007 iMac running on Ubuntu plugged in, screen off, no GPU usage), the W seems to high for this computer (should be max 200W):
I use these values for the Gen2 Kogan Plugs
The ones you posted I think are from the Gen1 Plugs (without USB)
current_res: "0.00225"
voltage_div: "805"
Thanks! Out of curiosity how did you figure out these numbers? I have basic electronic knowledge but keen to learn more
I used an arlec power meter and a 60w incandescent bulb in a lamp
Basically match the readings between the meter and esphome (voltage first)
Those numbers need to be determined through a calibration using a multimeter for each device since every smart plug is slightly different and needs different values
I tried your method but I canât get the values right. It seems that volt_div changes the values for power and voltage and current_res changes power and amperage. The problem is that if I calibrate volt_div and cur_res in a way that voltage and amperage matches, the value for power is far from the right value. And if I change one value to match the power the other values are not right anymore.
I find a workaround where I useba lineair function within the lambda filter but this is more work and I like the way to define only two variables.
Any ideas to get get the right values?
What are you using for a load?
Calibrate voltage first using a voltmeter to confirm actual voltage, then adjust the current value. If you are using an ammeter then you should be able to get it spot on. The power value is calculated and will be inaccurate for non linear loads, hence the need to use either an old incandescent bulb or a heater element