Skip to content

Commit

Permalink
Merge pull request #132 from Lochnair/patch-1
Browse files Browse the repository at this point in the history
Quick attempt at fixing compatibility with ESPHome 2024.7.0
  • Loading branch information
echavet authored Jul 18, 2024
2 parents 956a7c8 + 406d446 commit 89e75b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/cn105/uptime_connection_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -31,4 +31,4 @@ namespace esphome {
void HpUpTimeConnectionSensor::dump_config() { LOG_SENSOR("", "Uptime Connection Sensor", this); }

} // namespace uptime
} // namespace esphome
} // namespace esphome
6 changes: 3 additions & 3 deletions components/cn105/uptime_connection_sensor.h
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,4 +16,4 @@ namespace esphome {
bool connected_{ false };
};
} // namespace uptime
} // namespace esphome
} // namespace esphome

0 comments on commit 89e75b4

Please sign in to comment.