34 lines
811 B
C++
34 lines
811 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
|
|
|
namespace esphome {
|
|
namespace app_status {
|
|
|
|
class AppStatus : public binary_sensor::BinarySensor, public PollingComponent {
|
|
public:
|
|
void setup() override;
|
|
void loop() override;
|
|
void update() override;
|
|
void dump_config() override;
|
|
|
|
float get_loop_priority() const override { return 50.0f; }
|
|
|
|
void set_include_errors(bool allow) { this->include_errors_ = allow; }
|
|
void set_include_warnings(bool allow) { this->include_warnings_ = allow; }
|
|
|
|
protected:
|
|
uint8_t last_status_{0xFF};
|
|
bool include_warnings_{true};
|
|
bool include_errors_{true};
|
|
|
|
uint8_t get_status_() const;
|
|
void publish_status_(uint8_t status);
|
|
};
|
|
|
|
} // namespace app_status
|
|
} // namespace esphome
|
|
|
|
// vim:set sw=2:
|