You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
896 B
32 lines
896 B
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/output/float_output.h"
|
|
#include "esphome/components/light/light_output.h"
|
|
|
|
namespace esphome {
|
|
namespace c_monochromatic {
|
|
|
|
class MonochromaticLightOutput : public light::LightOutput {
|
|
public:
|
|
void set_output(output::FloatOutput *upper, output::FloatOutput *lower) { upper_ = upper; lower_ = lower; }
|
|
light::LightTraits get_traits() override {
|
|
auto traits = light::LightTraits();
|
|
traits.set_supported_color_modes({light::ColorMode::BRIGHTNESS});
|
|
return traits;
|
|
}
|
|
void write_state(light::LightState *state) override {
|
|
float bright;
|
|
state->current_values_as_brightness(&bright);
|
|
this->upper_->set_level(bright);
|
|
this->lower_->set_level(bright);
|
|
}
|
|
|
|
protected:
|
|
output::FloatOutput *upper_;
|
|
output::FloatOutput *lower_;
|
|
};
|
|
|
|
} // namespace monochromatic
|
|
} // namespace esphome
|