mirror of
https://github.com/esphome/esphome.git
synced 2025-10-26 20:53:50 +00:00
Remove last_reset_type and convert all those sensors to TOTAL_INCREASING (#2233)
This commit is contained in:
@@ -14,10 +14,6 @@ namespace sensor {
|
||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \
|
||||
} \
|
||||
ESP_LOGCONFIG(TAG, "%s State Class: '%s'", prefix, state_class_to_string((obj)->state_class)); \
|
||||
if ((obj)->state_class == sensor::STATE_CLASS_MEASUREMENT && \
|
||||
(obj)->last_reset_type != sensor::LAST_RESET_TYPE_NONE) { \
|
||||
ESP_LOGCONFIG(TAG, "%s Last Reset Type: '%s'", prefix, last_reset_type_to_string((obj)->last_reset_type)); \
|
||||
} \
|
||||
ESP_LOGCONFIG(TAG, "%s Unit of Measurement: '%s'", prefix, (obj)->get_unit_of_measurement().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Accuracy Decimals: %d", prefix, (obj)->get_accuracy_decimals()); \
|
||||
if (!(obj)->get_icon().empty()) { \
|
||||
@@ -42,20 +38,6 @@ enum StateClass : uint8_t {
|
||||
|
||||
const char *state_class_to_string(StateClass state_class);
|
||||
|
||||
/**
|
||||
* Sensor last reset types
|
||||
*/
|
||||
enum LastResetType : uint8_t {
|
||||
/// This sensor does not support resetting. ie, it is not accumulative
|
||||
LAST_RESET_TYPE_NONE = 0,
|
||||
/// This sensor is expected to never reset its value
|
||||
LAST_RESET_TYPE_NEVER = 1,
|
||||
/// This sensor may reset and Home Assistant will watch for this
|
||||
LAST_RESET_TYPE_AUTO = 2,
|
||||
};
|
||||
|
||||
const char *last_reset_type_to_string(LastResetType last_reset_type);
|
||||
|
||||
/** Base-class for all sensors.
|
||||
*
|
||||
* A sensor has unit of measurement and can use publish_state to send out a new value with the specified accuracy.
|
||||
@@ -174,12 +156,6 @@ class Sensor : public Nameable {
|
||||
*/
|
||||
virtual std::string device_class();
|
||||
|
||||
// The Last reset type of this sensor
|
||||
LastResetType last_reset_type{LAST_RESET_TYPE_NONE};
|
||||
|
||||
/// Manually set the Home Assistant last reset type for this sensor.
|
||||
void set_last_reset_type(LastResetType last_reset_type);
|
||||
|
||||
/** A unique ID for this sensor, empty for no unique id. See unique ID requirements:
|
||||
* https://developers.home-assistant.io/docs/en/entity_registry_index.html#unique-id-requirements
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user