6static const char *
const TAG =
"switch.gpio";
7#ifdef USE_GPIO_SWITCH_INTERLOCK
8static constexpr uint32_t INTERLOCK_TIMEOUT_ID = 0;
30 LOG_SWITCH(
"",
"GPIO Switch",
this);
31 LOG_PIN(
" Pin: ", this->
pin_);
32#ifdef USE_GPIO_SWITCH_INTERLOCK
34 ESP_LOGCONFIG(TAG,
" Interlocks:");
38 ESP_LOGCONFIG(TAG,
" %s", lock->get_name().c_str());
44#ifdef USE_GPIO_SWITCH_INTERLOCK
77#ifdef USE_GPIO_SWITCH_INTERLOCK
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_timeout(const std boo cancel_timeout)(const char *name)
Cancel a timeout function.
virtual void digital_write(bool value)=0
void dump_config() override
uint32_t interlock_wait_time_
float get_setup_priority() const override
void set_interlock(const std::initializer_list< Switch * > &interlock)
void write_state(bool state) override
FixedVector< Switch * > interlock_
void turn_on()
Turn this switch on.
void turn_off()
Turn this switch off.
bool state
The current reported state of the binary sensor.
void publish_state(bool state)
Publish a state to the front-end from the back-end.
optional< bool > get_initial_state_with_restore_mode()
Returns the initial state of the switch, after applying restore mode rules.
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.