mirror of
https://github.com/esphome/esphome.git
synced 2025-10-26 20:53:50 +00:00
Keep Device Class in Flash. (#4639)
* Keep Device Class in Flash. * Remove blank line --------- Co-authored-by: Your Name <you@example.com>
This commit is contained in:
@@ -54,7 +54,7 @@ std::string state_class_to_string(StateClass state_class);
|
||||
*
|
||||
* A sensor has unit of measurement and can use publish_state to send out a new value with the specified accuracy.
|
||||
*/
|
||||
class Sensor : public EntityBase {
|
||||
class Sensor : public EntityBase, public EntityBase_DeviceClass {
|
||||
public:
|
||||
explicit Sensor();
|
||||
|
||||
@@ -68,11 +68,6 @@ class Sensor : public EntityBase {
|
||||
/// Manually set the accuracy in decimals.
|
||||
void set_accuracy_decimals(int8_t accuracy_decimals);
|
||||
|
||||
/// Get the device class, using the manual override if set.
|
||||
std::string get_device_class();
|
||||
/// Manually set the device class.
|
||||
void set_device_class(const std::string &device_class);
|
||||
|
||||
/// Get the state class, using the manual override if set.
|
||||
StateClass get_state_class();
|
||||
/// Manually set the state class.
|
||||
@@ -165,7 +160,6 @@ class Sensor : public EntityBase {
|
||||
|
||||
optional<std::string> unit_of_measurement_; ///< Unit of measurement override
|
||||
optional<int8_t> accuracy_decimals_; ///< Accuracy in decimals override
|
||||
optional<std::string> device_class_; ///< Device class override
|
||||
optional<StateClass> state_class_{STATE_CLASS_NONE}; ///< State class override
|
||||
bool force_update_{false}; ///< Force update mode
|
||||
bool has_state_{false};
|
||||
|
||||
Reference in New Issue
Block a user