2019-04-17 12:06:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esphome/core/component.h"
|
|
|
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
|
|
|
|
|
|
|
namespace esphome {
|
|
|
|
namespace homeassistant {
|
|
|
|
|
|
|
|
class HomeassistantBinarySensor : public binary_sensor::BinarySensor, public Component {
|
|
|
|
public:
|
2019-04-22 21:56:30 +02:00
|
|
|
void set_entity_id(const std::string &entity_id) { entity_id_ = entity_id; }
|
2021-05-17 01:16:22 +02:00
|
|
|
void set_attribute(const std::string &attribute) { attribute_ = attribute; }
|
2019-04-17 12:06:00 +02:00
|
|
|
void setup() override;
|
|
|
|
void dump_config() override;
|
|
|
|
float get_setup_priority() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::string entity_id_;
|
2021-05-17 01:16:22 +02:00
|
|
|
optional<std::string> attribute_;
|
2019-06-15 18:02:17 +02:00
|
|
|
bool initial_{true};
|
2019-04-17 12:06:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace homeassistant
|
|
|
|
} // namespace esphome
|