ESPHome 2025.5.0
Loading...
Searching...
No Matches
binary_light_output.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace binary {
9
11 public:
12 void set_output(output::BinaryOutput *output) { output_ = output; }
14 auto traits = light::LightTraits();
15 traits.set_supported_color_modes({light::ColorMode::ON_OFF});
16 return traits;
17 }
19 bool binary;
20 state->current_values_as_binary(&binary);
21 if (binary) {
22 this->output_->turn_on();
23 } else {
24 this->output_->turn_off();
25 }
26 }
27
28 protected:
30};
31
32} // namespace binary
33} // namespace esphome
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:63
This class is used to represent the capabilities of a light.
virtual void turn_off()
Disable this binary output.
virtual void turn_on()
Enable this binary output.
bool state
Definition fan.h:0
@ ON_OFF
Only on/off control.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7