mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Merge remote-tracking branch 'upstream/dev' into integration
This commit is contained in:
		| @@ -16,6 +16,7 @@ from esphome.const import ( | ||||
|     DEVICE_CLASS_ENERGY, | ||||
|     DEVICE_CLASS_POWER, | ||||
|     DEVICE_CLASS_POWER_FACTOR, | ||||
|     DEVICE_CLASS_REACTIVE_POWER, | ||||
|     DEVICE_CLASS_VOLTAGE, | ||||
|     ICON_CURRENT_AC, | ||||
|     ICON_LIGHTBULB, | ||||
| @@ -78,6 +79,7 @@ CONFIG_SCHEMA = ( | ||||
|                 unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE, | ||||
|                 icon=ICON_LIGHTBULB, | ||||
|                 accuracy_decimals=2, | ||||
|                 device_class=DEVICE_CLASS_REACTIVE_POWER, | ||||
|                 state_class=STATE_CLASS_MEASUREMENT, | ||||
|             ), | ||||
|             cv.Optional(CONF_POWER_FACTOR): sensor.sensor_schema( | ||||
|   | ||||
| @@ -17,10 +17,12 @@ from esphome.const import ( | ||||
|     CONF_REACTIVE_POWER, | ||||
|     CONF_REVERSE_ACTIVE_ENERGY, | ||||
|     CONF_VOLTAGE, | ||||
|     DEVICE_CLASS_APPARENT_POWER, | ||||
|     DEVICE_CLASS_CURRENT, | ||||
|     DEVICE_CLASS_ENERGY, | ||||
|     DEVICE_CLASS_POWER, | ||||
|     DEVICE_CLASS_POWER_FACTOR, | ||||
|     DEVICE_CLASS_REACTIVE_POWER, | ||||
|     DEVICE_CLASS_TEMPERATURE, | ||||
|     DEVICE_CLASS_VOLTAGE, | ||||
|     ENTITY_CATEGORY_DIAGNOSTIC, | ||||
| @@ -100,13 +102,13 @@ ATM90E32_PHASE_SCHEMA = cv.Schema( | ||||
|             unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE, | ||||
|             icon=ICON_LIGHTBULB, | ||||
|             accuracy_decimals=2, | ||||
|             device_class=DEVICE_CLASS_POWER, | ||||
|             device_class=DEVICE_CLASS_REACTIVE_POWER, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ), | ||||
|         cv.Optional(CONF_APPARENT_POWER): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_VOLT_AMPS, | ||||
|             accuracy_decimals=2, | ||||
|             device_class=DEVICE_CLASS_POWER, | ||||
|             device_class=DEVICE_CLASS_APPARENT_POWER, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ), | ||||
|         cv.Optional(CONF_POWER_FACTOR): sensor.sensor_schema( | ||||
|   | ||||
| @@ -2,12 +2,11 @@ | ||||
|  | ||||
| #include "esphome/core/defines.h" | ||||
| #ifdef USE_OTA | ||||
| #include "esphome/components/ota/ota_backend.h" | ||||
| #include "esphome/components/socket/socket.h" | ||||
| #include "esphome/core/helpers.h" | ||||
| #include "esphome/core/log.h" | ||||
| #include "esphome/core/preferences.h" | ||||
| #include "esphome/core/log.h" | ||||
| #include "esphome/components/ota/ota_backend.h" | ||||
| #include "esphome/components/socket/socket.h" | ||||
|  | ||||
| namespace esphome { | ||||
|  | ||||
|   | ||||
| @@ -835,4 +835,25 @@ void Scheduler::recycle_item_(std::unique_ptr<SchedulerItem> item) { | ||||
|   // else: unique_ptr will delete the item when it goes out of scope | ||||
| } | ||||
|  | ||||
| void Scheduler::recycle_item_(std::unique_ptr<SchedulerItem> item) { | ||||
|   if (!item) | ||||
|     return; | ||||
|  | ||||
|   if (this->scheduler_item_pool_.size() < MAX_POOL_SIZE) { | ||||
|     // Clear callback to release captured resources | ||||
|     item->callback = nullptr; | ||||
|     // Clear dynamic name if any | ||||
|     item->clear_dynamic_name(); | ||||
|     this->scheduler_item_pool_.push_back(std::move(item)); | ||||
| #ifdef ESPHOME_DEBUG_SCHEDULER | ||||
|     ESP_LOGD(TAG, "Recycled item to pool (pool size now: %zu)", this->scheduler_item_pool_.size()); | ||||
| #endif | ||||
|   } else { | ||||
| #ifdef ESPHOME_DEBUG_SCHEDULER | ||||
|     ESP_LOGD(TAG, "Pool full (size: %zu), deleting item", this->scheduler_item_pool_.size()); | ||||
| #endif | ||||
|   } | ||||
|   // else: unique_ptr will delete the item when it goes out of scope | ||||
| } | ||||
|  | ||||
| }  // namespace esphome | ||||
|   | ||||
		Reference in New Issue
	
	Block a user