Files
esphome/components/ratgdo/switch/ratgdo_switch.h
T
2026-07-12 12:56:02 +00:00

32 lines
714 B
C++

#pragma once
#include "../ratgdo.h"
#include "../ratgdo_state.h"
#include "esphome/components/switch/switch.h"
#include "esphome/core/component.h"
#include "esphome/core/defines.h"
namespace esphome::ratgdo {
enum SwitchType { RATGDO_LED = 1 };
class RATGDOSwitch : public switch_::Switch,
public RATGDOClient,
public Component {
public:
void dump_config() override;
void setup() override;
void set_switch_type(SwitchType switch_type_) {
this->switch_type_ = switch_type_;
}
void write_state(bool state) override;
void set_pin(GPIOPin* pin) { pin_ = pin; }
protected:
SwitchType switch_type_;
GPIOPin* pin_;
};
} // namespace esphome::ratgdo