1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 08:15:49 +00:00

Add demo integration (#2085)

This commit is contained in:
Otto Winter
2021-07-29 11:50:55 +02:00
committed by GitHub
parent af8d04818d
commit 16dbbfabc6
11 changed files with 969 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
namespace esphome {
namespace demo {
class DemoBinarySensor : public binary_sensor::BinarySensor, public PollingComponent {
public:
void setup() override { this->publish_initial_state(false); }
void update() override {
bool new_state = last_state_ = !last_state_;
this->publish_state(new_state);
}
protected:
bool last_state_ = false;
};
} // namespace demo
} // namespace esphome