Add copy integration (#3241)

This commit is contained in:
Otto Winter
2022-02-20 21:13:37 +01:00
committed by GitHub
parent 8dae7f8225
commit f59dbe4a88
35 changed files with 934 additions and 0 deletions
@@ -0,0 +1,18 @@
#include "copy_sensor.h"
#include "esphome/core/log.h"
namespace esphome {
namespace copy {
static const char *const TAG = "copy.sensor";
void CopySensor::setup() {
source_->add_on_state_callback([this](float value) { this->publish_state(value); });
if (source_->has_state())
this->publish_state(source_->state);
}
void CopySensor::dump_config() { LOG_SENSOR("", "Copy Sensor", this); }
} // namespace copy
} // namespace esphome