ESPHome 2025.5.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
template_switch.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace template_ {
9
11 public:
13
14 void setup() override;
15 void dump_config() override;
16
17 void set_state_lambda(std::function<optional<bool>()> &&f);
20 void set_optimistic(bool optimistic);
22 void loop() override;
23
24 float get_setup_priority() const override;
25
26 protected:
27 bool assumed_state() override;
28
29 void write_state(bool state) override;
30
32 bool optimistic_{false};
33 bool assumed_state_{false};
37};
38
39} // namespace template_
40} // namespace esphome
Base class for all switches.
Definition switch.h:39
bool state
The current reported state of the binary sensor.
Definition switch.h:53
float get_setup_priority() const override
void write_state(bool state) override
void set_assumed_state(bool assumed_state)
optional< std::function< optional< bool >()> > f_
void set_state_lambda(std::function< optional< bool >()> &&f)
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7