1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-08 11:50:34 +01:00
esphome/esphome/components/homeassistant/switch/homeassistant_switch.h
Markus 1d25db491c
[homeassistant] Native switch entity import and control (#7018)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2024-08-14 14:03:12 +12:00

23 lines
548 B
C++

#pragma once
#include "esphome/components/switch/switch.h"
#include "esphome/core/component.h"
namespace esphome {
namespace homeassistant {
class HomeassistantSwitch : public switch_::Switch, public Component {
public:
void set_entity_id(const std::string &entity_id) { this->entity_id_ = entity_id; }
void setup() override;
void dump_config() override;
float get_setup_priority() const override;
protected:
void write_state(bool state) override;
std::string entity_id_;
};
} // namespace homeassistant
} // namespace esphome