ESPHome  2024.10.2
binary_light_output.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace 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
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:34
virtual void turn_on()
Enable this binary output.
Definition: binary_output.h:43
Interface to write LightStates to hardware.
Definition: light_output.h:12
virtual void turn_off()
Disable this binary output.
Definition: binary_output.h:51
light::LightTraits get_traits() override
void current_values_as_binary(bool *binary)
The result of all the current_values_as_* methods have gamma correction applied.
void set_output(output::BinaryOutput *output)
Light can be turned on/off.
This class is used to represent the capabilities of a light.
Definition: light_traits.h:11
void write_state(light::LightState *state) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool state
Definition: fan.h:34