Hi,
Since the removal of the custom component feature in the 2025.1 release I try to create an external component to replace my usage.
I’m faced with an error that I can’t resolve. Any help will be greatly appreciated !
Basically, I use esphome to send RGB data from a light via I2C to an arduino.
Here is the yaml config:
# [...]
external_components:
- source: livingcolors
light:
- platform: livingcolors
name: "LivingColors"
light.py:
livingcolors_ns = cg.esphome_ns.namespace("livingcolors")
LivingcolorsLightOutput = livingcolors_ns.class_(
"LivingcolorsLightOutput"
)
CONFIG_SCHEMA = (
cv.Schema(
{
cv.GenerateID(): cv.declare_id(LivingcolorsLightOutput),
}
)
)
livingcolor.h:
namespace esphome {
namespace livingcolors {
class LivingcolorsLightOutput : public light::LightOutput {
public:
void setup() override {
Wire.begin();
}
light::LightTraits get_traits() override {
auto traits = LightTraits();
traits.set_supported_color_modes({ColorMode::RGB, ColorMode::BRIGHTNESS});
return traits;
}
void write_state(light::LightState *state) override {
float red, green, blue;
state->current_values_as_rgb(&red, &green, &blue);
// [...]
Wire.beginTransmission(0x21);
Wire.write(buf);
Wire.endTransmission();
}
};
} // namespace livingcolors
} // namespace esphome
(I’ve also an empty __init.py__
file)
When I try to compile/install it I am faced with this error:
INFO ESPHome 2025.2.1
INFO Reading configuration /config/esphome/livingcolors.yaml...
Failed config
light: [source /config/esphome/livingcolors.yaml:39]
expected a dictionary.
- platform: livingcolors
name: LivingColors
I’ve tried several things after reading different documentation and posts on this forum without managing to solve this problem.
So, I’m asking the help of the community, could someone help me to solve this?
Thanks