ESPHome  2024.10.2
tuya_switch.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace tuya {
9 
10 class TuyaSwitch : public switch_::Switch, public Component {
11  public:
12  void setup() override;
13  void dump_config() override;
14  void set_switch_id(uint8_t switch_id) { this->switch_id_ = switch_id; }
15 
16  void set_tuya_parent(Tuya *parent) { this->parent_ = parent; }
17 
18  protected:
19  void write_state(bool state) override;
20 
22  uint8_t switch_id_{0};
23 };
24 
25 } // namespace tuya
26 } // namespace esphome
Base class for all switches.
Definition: switch.h:39
void set_switch_id(uint8_t switch_id)
Definition: tuya_switch.h:14
void write_state(bool state) override
Definition: tuya_switch.cpp:16
void set_tuya_parent(Tuya *parent)
Definition: tuya_switch.h:16
void setup() override
Definition: tuya_switch.cpp:9
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void dump_config() override
Definition: tuya_switch.cpp:22
bool state
The current reported state of the binary sensor.
Definition: switch.h:53