ESPHome 2026.5.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
10
16
18 public:
19 void set_restore(bool restore) { restore_ = restore; }
20 void set_time(time::RealTimeClock *time) { time_ = time; }
21 void set_parent(Sensor *parent) { parent_ = parent; }
22 void set_method(TotalDailyEnergyMethod method) { method_ = method; }
23 void setup() override;
24 void dump_config() override;
25
26 void publish_state_and_save(float state);
27
28 protected:
29 void process_new_state_(float state);
31
39 float total_energy_{0.0f};
40 float last_power_state_{0.0f};
41};
42
43} // namespace esphome::total_daily_energy
Base-class for all sensors.
Definition sensor.h:47
float state
This member variable stores the last state that has passed through all filters.
Definition sensor.h:138
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
void set_method(TotalDailyEnergyMethod method)
static void uint32_t