mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
5645be4e0f
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
23 lines
615 B
C++
23 lines
615 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
|
|
namespace esphome {
|
|
namespace homeassistant {
|
|
|
|
class HomeassistantSensor : public sensor::Sensor, public Component {
|
|
public:
|
|
void set_entity_id(const std::string &entity_id) { entity_id_ = entity_id; }
|
|
void set_attribute(const std::string &attribute) { attribute_ = attribute; }
|
|
void setup() override;
|
|
void dump_config() override;
|
|
float get_setup_priority() const override;
|
|
|
|
protected:
|
|
std::string entity_id_;
|
|
optional<std::string> attribute_;
|
|
};
|
|
|
|
} // namespace homeassistant
|
|
} // namespace esphome
|