ESPHome 2026.5.1
Loading...
Searching...
No Matches
binary_light_output.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::binary {
8
10 public:
11 void set_output(output::BinaryOutput *output) { output_ = output; }
13 auto traits = light::LightTraits();
14 traits.set_supported_color_modes({light::ColorMode::ON_OFF});
15 return traits;
16 }
18 bool binary;
19 state->current_values_as_binary(&binary);
20 if (binary) {
21 this->output_->turn_on();
22 } else {
23 this->output_->turn_off();
24 }
25 }
26
27 protected:
29};
30
31} // namespace esphome::binary
void set_output(output::BinaryOutput *output)
void write_state(light::LightState *state) override
light::LightTraits get_traits() override
Interface to write LightStates to hardware.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:93
This class is used to represent the capabilities of a light.
Definition light_traits.h:9
virtual void turn_off()
Disable this binary output.
virtual void turn_on()
Enable this binary output.
bool state
Definition fan.h:2
@ ON_OFF
Only on/off control.