From b76b6f1eb47d469af260460e22d89eeed59978b4 Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Wed, 17 Jul 2024 20:35:41 +0200 Subject: [PATCH 1/2] Update uptime_connection_sensor.h --- components/cn105/uptime_connection_sensor.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cn105/uptime_connection_sensor.h b/components/cn105/uptime_connection_sensor.h index 9314a32..97c2977 100644 --- a/components/cn105/uptime_connection_sensor.h +++ b/components/cn105/uptime_connection_sensor.h @@ -1,10 +1,10 @@ #pragma once -#include "esphome/components/uptime/uptime_sensor.h" +#include "esphome/components/uptime/uptime_seconds_sensor.h" namespace esphome { namespace uptime { - class HpUpTimeConnectionSensor : public UptimeSensor { + class HpUpTimeConnectionSensor : public UptimeSecondsSensor { public: void update() override; std::string unique_id() override; @@ -16,4 +16,4 @@ namespace esphome { bool connected_{ false }; }; } // namespace uptime -} // namespace esphome \ No newline at end of file +} // namespace esphome From 406d4468705d3335733a73f42fa8af3eba26971a Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Wed, 17 Jul 2024 20:37:09 +0200 Subject: [PATCH 2/2] Update uptime_connection_sensor.cpp --- components/cn105/uptime_connection_sensor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cn105/uptime_connection_sensor.cpp b/components/cn105/uptime_connection_sensor.cpp index fa22a26..7f5e509 100644 --- a/components/cn105/uptime_connection_sensor.cpp +++ b/components/cn105/uptime_connection_sensor.cpp @@ -9,7 +9,7 @@ namespace esphome { static const char* const TAG = "uptime.connection.sensor"; void HpUpTimeConnectionSensor::update() { if (connected_) { - UptimeSensor::update(); + UptimeSecondsSensor::update(); } else { this->uptime_ = 0; this->publish_state(0); @@ -31,4 +31,4 @@ namespace esphome { void HpUpTimeConnectionSensor::dump_config() { LOG_SENSOR("", "Uptime Connection Sensor", this); } } // namespace uptime -} // namespace esphome \ No newline at end of file +} // namespace esphome