Remove polling

This commit is contained in:
2025-10-14 03:03:08 -06:00
parent 4a347cf7ae
commit bc23b38d6c
3 changed files with 3 additions and 12 deletions

View File

@@ -21,13 +21,6 @@ void AppStatus::loop() {
this->last_status_ = status;
}
void AppStatus::update() {
ESP_LOGV(TAG, "update() called", TRUEFALSE(this->inverted_));
auto status = this->get_status_();
this->publish_status_(status);
this->last_status_ = status;
}
void AppStatus::dump_config() {
ESP_LOGCONFIG(TAG, "App status binary sensor");
ESP_LOGCONFIG(TAG, " include warnings = %s", TRUEFALSE(this->include_warnings_));

View File

@@ -6,11 +6,10 @@
namespace esphome {
namespace app_status {
class AppStatus : public binary_sensor::BinarySensor, public PollingComponent {
class AppStatus : public binary_sensor::BinarySensor, public Component {
public:
void setup() override;
void loop() override;
void update() override;
void dump_config() override;
float get_loop_priority() const override { return 50.0f; }

View File

@@ -15,13 +15,12 @@ DETECT_STATUS_ENUM = {
}
app_status_ns = cg.esphome_ns.namespace("app_status")
AppStatus = app_status_ns.class_("AppStatus", binary_sensor.BinarySensor, cg.PollingComponent)
AppStatus = app_status_ns.class_("AppStatus", binary_sensor.BinarySensor, cg.Component)
#CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(AppStatus).extend({cv.GenerateID(): cv.declare_id(AppStatus)}).extend(cv.COMPONENT_SCHEMA)
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(AppStatus).extend({
cv.GenerateID(): cv.declare_id(AppStatus),
cv.Optional(CONF_DETECT_STATUS, default=[CONF_WARNING, CONF_ERROR]): cv.ensure_list(cv.enum(DETECT_STATUS_ENUM)),
}).extend(cv.polling_component_schema(default_update_interval="60s"))
}).extend(cv.COMPONENT_SCHEMA)
async def to_code(config):
var = await binary_sensor.new_binary_sensor(config)