ESPHome 2025.5.0
Loading...
Searching...
No Matches
total_daily_energy.h
Go to the documentation of this file.
1#pragma once
2
5#include "esphome/core/hal.h"
8
9namespace esphome {
10namespace total_daily_energy {
11
17
19 public:
20 void set_restore(bool restore) { restore_ = restore; }
21 void set_time(time::RealTimeClock *time) { time_ = time; }
22 void set_parent(Sensor *parent) { parent_ = parent; }
23 void set_method(TotalDailyEnergyMethod method) { method_ = method; }
24 void setup() override;
25 void dump_config() override;
26 float get_setup_priority() const override { return setup_priority::DATA; }
27 void loop() override;
28
29 void publish_state_and_save(float state);
30
31 protected:
32 void process_new_state_(float state);
33
39 uint32_t last_update_{0};
41 float total_energy_{0.0f};
42 float last_power_state_{0.0f};
43};
44
45} // namespace total_daily_energy
46} // namespace esphome
Base-class for all sensors.
Definition sensor.h:57
float state
This member variable stores the last state that has passed through all filters.
Definition sensor.h:131
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
void set_method(TotalDailyEnergyMethod method)
const float DATA
For components that import data from directly connected sensors like DHT.
Definition component.cpp:19
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7