ESPHome 2025.12.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 : 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 void set_interlock(const std::initializer_list<Switch *> &interlock);
22 void set_interlock_wait_time(uint32_t interlock_wait_time) { interlock_wait_time_ = interlock_wait_time; }
23
24 protected:
25 void write_state(bool state) override;
26
30};
31
32} // namespace gpio
33} // namespace esphome
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template...
Definition helpers.h:184
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:22
void write_state(bool state) override
void set_pin(GPIOPin *pin)
Definition gpio_switch.h:13
FixedVector< Switch * > interlock_
Definition gpio_switch.h:28
Base class for all switches.
Definition switch.h:39
bool state
The current reported state of the binary sensor.
Definition switch.h:56
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7