ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
gpio_switch.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/hal.h"
7
8namespace esphome {
9namespace gpio {
10
11class GPIOSwitch final : public switch_::Switch, public Component {
12 public:
13 void set_pin(GPIOPin *pin) { pin_ = pin; }
14
15 // ========== INTERNAL METHODS ==========
16 // (In most use cases you won't need these)
17 float get_setup_priority() const override;
18
19 void setup() override;
20 void dump_config() override;
21#ifdef USE_GPIO_SWITCH_INTERLOCK
22 void set_interlock(const std::initializer_list<Switch *> &interlock);
23 void set_interlock_wait_time(uint32_t interlock_wait_time) { interlock_wait_time_ = interlock_wait_time; }
24#endif
25
26 protected:
27 void write_state(bool state) override;
28
30#ifdef USE_GPIO_SWITCH_INTERLOCK
33#endif
34};
35
36} // namespace gpio
37} // namespace esphome
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template...
Definition helpers.h:522
void dump_config() override
float get_setup_priority() const override
void set_interlock(const std::initializer_list< Switch * > &interlock)
void set_interlock_wait_time(uint32_t interlock_wait_time)
Definition gpio_switch.h:23
void write_state(bool state) override
void set_pin(GPIOPin *pin)
Definition gpio_switch.h:13
FixedVector< Switch * > interlock_
Definition gpio_switch.h:31
Base class for all switches.
Definition switch.h:38
bool state
The current reported state of the binary sensor.
Definition switch.h:55
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
static void uint32_t