ESPHome 2025.9.0-dev
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 void loop() override;
27
28 void publish_state_and_save(float state);
29
30 protected:
31 void process_new_state_(float state);
32
38 uint32_t last_update_{0};
40 float total_energy_{0.0f};
41 float last_power_state_{0.0f};
42};
43
44} // namespace total_daily_energy
45} // namespace esphome
Base-class for all sensors.
Definition sensor.h:59
float state
This member variable stores the last state that has passed through all filters.
Definition sensor.h:133
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
void set_method(TotalDailyEnergyMethod method)
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7