BennyB44
(Benny B #44)
January 22, 2020, 3:10am
1
I have a Mirabella Genio CCT white downlight that requires a different light component setup.
This light runs a pwm on GPIO12 and 14 to a second chip to control the CW WW blend on one PWM and Brightness on the other. It also turns the light off at a duty cycle less than about 10%.
How would I set that up with esphome?
Cheers
@BennyB44 , I think you are looking for something like this:
esphome:
name: mirabella
platform: ESP8266
board: esp01_1m
on_boot:
priority: 100 # Highest priority, ensures light turns on without delay.
then:
- light.turn_on: light
wifi:
ssid: 'your_ssid'
password: 'your_password'
ap:
ssid: 'mirabella1'
password: 'ap_password'
domain: '.mydomain.com'
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: 'api_password'
ota:
password: 'ota_password'
web_server:
port: 80
sensor:
- platform: wifi_signal
name: "Mirabella Genio WiFi Signal"
update_interval: 60s
output:
- platform: esp8266_pwm
id: output_warm_white
pin: GPIO12
- platform: esp8266_pwm
id: output_daylight
pin: GPIO14
light:
- platform: cwww
name: "Mirabella Genio"
cold_white: output_daylight
warm_white: output_warm_white
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
# Ensure the light turns on by default if the physical switch is actuated.
restore_mode: ALWAYS_ON
BennyB44
(Benny B #44)
January 22, 2020, 9:27pm
3
Thank you for the reply. That would work under normal circumstances but the Genio bulb doesn’t use the 2 pwm channels to control CW and WW individually. On 1 pwm at 0% duty cycle it is WW and 100% is CW. The other is a Brightness control that doesn’t operate below 10% duty cycle. So nothing on the slider till 10% and full on at 100%.
I found this out after the CWWW setup didn’t perform as you would expect so I set the channels up as 2 monochromatic lights and played with the brightness sliders to work out their function.
TinyDoT
January 24, 2020, 11:16pm
4
Hmmm, that sucks, sorry that didn’t help.
JavOtam
(Christopher Johnson)
April 4, 2020, 1:53am
5
Hi, I don’t know if you solved this but this is what worked for me with a bulb that had the same properties.
genio.yaml
globals:
- id: maxmireds
type: float
restore_value: no
initial_value: '370'
- id: minmireds
type: float
restore_value: no
initial_value: '154'
substitutions:
hostname: genio_1
display_name: Mirabella Genio
esphome:
name: $hostname
platform: ESP8266
board: esp01_1m
includes:
- genio_output.h
wifi:
ssid: "Your SSID"
password: "wifi_password"
ota:
password: "ota_password"
api:
password: "api_password"
# Enable logging
logger:
light:
- platform: custom
lambda: |-
auto light_out = new GenioLightOutput(id(brightness), id(color_temperature));
App.register_component(light_out);
return {light_out};
lights:
- name: $display_name
output:
- platform: esp8266_pwm
id: brightness
pin: GPIO12
- platform: esp8266_pwm
id: color_temperature
pin: GPIO14
genio_output.h
#pragma once
#include "esphome.h"
class GenioLightOutput : public Component, public LightOutput {
public:
GenioLightOutput(FloatOutput *brightness, FloatOutput *color_temperature)
{
brightness_ = brightness;
color_temperature_ = color_temperature;
}
LightTraits get_traits() override {
auto traits = LightTraits();
traits.set_supports_brightness(true);
traits.set_supports_color_temperature(true);
traits.set_max_mireds(id(maxmireds));
traits.set_min_mireds(id(minmireds));
return traits;
}
void write_state(LightState *state) override {
float brightness, color_temperature;
state->current_values_as_brightness(&brightness);
color_temperature = (1 - (state->current_values.get_color_temperature() - id(minmireds)) / (id(maxmireds) - id(minmireds)));
if (brightness == 0 )
{
this->brightness_->set_level(0);
this->color_temperature_->set_level(color_temperature);
}
else
{
this->brightness_->set_level((brightness * 0.9) + 0.1);
this->color_temperature_->set_level(color_temperature);
}
}
protected:
FloatOutput *brightness_;
FloatOutput *color_temperature_;
};
SimonPth
(Simon)
April 4, 2020, 10:39pm
6
You need the cwww2 custom component.
You can find it here :
And then your code should look something like this:
cdmonk
August 9, 2020, 9:47am
7
You have copied and pasted my code from GitHub.
It has an issue and the CWWW2 custom component works perfectly.
1 Like
Siggi1
January 28, 2024, 2:06pm
8
Hello there,
I wanted to ask wether its possible to change the cct blending in esp home?
With a voltage meter I can measure that when both colours are at full brightness, there are actually 12V directly at the copper traces on the strip itself. I know, this is an error because it can’t measure the pwm correctly but it still seams like esp home dimms both the cw and the ww components respectively. Is there a way to get full output power on both channels?
Did you look at the Docs?
Its right there at the top…
Siggi1
February 2, 2024, 4:21pm
12
I did read the documentation several times, yet I apparently have overseen the variable “constant_brightness” every time. Thanks for this