mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	Merge branch 'state_class_to_string_no_alloc' into integration
This commit is contained in:
		| @@ -17,8 +17,8 @@ void log_sensor(const char *tag, const char *prefix, const char *type, Sensor *o | ||||
|                 "%s  State Class: '%s'\n" | ||||
|                 "%s  Unit of Measurement: '%s'\n" | ||||
|                 "%s  Accuracy Decimals: %d", | ||||
|                 prefix, type, obj->get_name().c_str(), prefix, state_class_to_string(obj->get_state_class()).c_str(), | ||||
|                 prefix, obj->get_unit_of_measurement_ref().c_str(), prefix, obj->get_accuracy_decimals()); | ||||
|                 prefix, type, obj->get_name().c_str(), prefix, state_class_to_string(obj->get_state_class()), prefix, | ||||
|                 obj->get_unit_of_measurement_ref().c_str(), prefix, obj->get_accuracy_decimals()); | ||||
|  | ||||
|   if (!obj->get_device_class_ref().empty()) { | ||||
|     ESP_LOGCONFIG(tag, "%s  Device Class: '%s'", prefix, obj->get_device_class_ref().c_str()); | ||||
| @@ -33,7 +33,7 @@ void log_sensor(const char *tag, const char *prefix, const char *type, Sensor *o | ||||
|   } | ||||
| } | ||||
|  | ||||
| std::string state_class_to_string(StateClass state_class) { | ||||
| const char *state_class_to_string(StateClass state_class) { | ||||
|   switch (state_class) { | ||||
|     case STATE_CLASS_MEASUREMENT: | ||||
|       return "measurement"; | ||||
|   | ||||
| @@ -33,7 +33,7 @@ enum StateClass : uint8_t { | ||||
|   STATE_CLASS_TOTAL = 3, | ||||
| }; | ||||
|  | ||||
| std::string state_class_to_string(StateClass state_class); | ||||
| const char *state_class_to_string(StateClass state_class); | ||||
|  | ||||
| /** Base-class for all sensors. | ||||
|  * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user