mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
8e75980ebd
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
24 lines
501 B
C++
24 lines
501 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
|
|
namespace esphome {
|
|
namespace template_ {
|
|
|
|
class TemplateSensor : public sensor::Sensor, public PollingComponent {
|
|
public:
|
|
void set_template(std::function<optional<float>()> &&f);
|
|
|
|
void update() override;
|
|
|
|
void dump_config() override;
|
|
|
|
float get_setup_priority() const override;
|
|
|
|
protected:
|
|
optional<std::function<optional<float>()>> f_;
|
|
};
|
|
|
|
} // namespace template_
|
|
} // namespace esphome
|