You can definitely override existing and create custom C++ components in ESPHome without too much hassle. It allows lambdas in the YAML itself.