diff --git a/custom_components/powercalc/config_flow.py b/custom_components/powercalc/config_flow.py index 0974ccaa2..9f62f3f07 100644 --- a/custom_components/powercalc/config_flow.py +++ b/custom_components/powercalc/config_flow.py @@ -122,7 +122,6 @@ from .power_profile.library import ModelInfo, ProfileLibrary from .power_profile.power_profile import DOMAIN_DEVICE_TYPE, DeviceType, PowerProfile from .sensors.daily_energy import DEFAULT_DAILY_UPDATE_FREQUENCY -from .sensors.group.factory import generate_unique_id from .strategy.factory import PowerCalculatorStrategyFactory from .strategy.wled import CONFIG_SCHEMA as SCHEMA_POWER_WLED @@ -1381,9 +1380,6 @@ async def async_step_subtract_group(self, user_input: dict[str, Any] | None = No async def async_handle_group_creation(self) -> FlowResult: """Handle the group creation.""" self.selected_sensor_type = SensorType.GROUP - unique_id = generate_unique_id(self.sensor_config) - await self.async_set_unique_id(unique_id) - self._abort_if_unique_id_configured() if self.sensor_config.get(CONF_CREATE_UTILITY_METERS): return await self.async_step_utility_meter_options() diff --git a/custom_components/powercalc/sensors/group/factory.py b/custom_components/powercalc/sensors/group/factory.py index 2aef3f3d3..15a33bdfe 100644 --- a/custom_components/powercalc/sensors/group/factory.py +++ b/custom_components/powercalc/sensors/group/factory.py @@ -1,5 +1,4 @@ from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_UNIQUE_ID from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity from homeassistant.helpers.typing import ConfigType @@ -48,17 +47,3 @@ async def create_group_sensors( ) raise SensorConfigurationError(f"Group type {group_type} invalid") # pragma: no cover - - -def generate_unique_id(sensor_config: ConfigType) -> str: - """Generate a unique ID for a group sensor.""" - if CONF_UNIQUE_ID in sensor_config: - return str(sensor_config[CONF_UNIQUE_ID]) - - group_type: GroupType = sensor_config.get(CONF_GROUP_TYPE, GroupType.CUSTOM) - if group_type == GroupType.DOMAIN: - return domain_group.generate_unique_id(sensor_config) - if group_type == GroupType.SUBTRACT: - return subtract_group.generate_unique_id(sensor_config) - - return custom_group.generate_unique_id(sensor_config) diff --git a/custom_components/powercalc/translations/en.json b/custom_components/powercalc/translations/en.json index b62998764..b7b659ed8 100644 --- a/custom_components/powercalc/translations/en.json +++ b/custom_components/powercalc/translations/en.json @@ -29,7 +29,6 @@ "name": "Name", "on_time": "On time", "start_time": "Start time", - "unique_id": "Unique id", "unit_of_measurement": "Unit of measurement", "update_frequency": "Update frequency", "value": "Value", @@ -123,8 +122,7 @@ "hide_members": "Hide members", "include_non_powercalc_sensors": "Include non powercalc sensors", "name": "Name", - "sub_groups": "Sub groups", - "unique_id": "Unique id" + "sub_groups": "Sub groups" }, "data_description": { "area": "Adds all power sensors from the specified area", @@ -263,7 +261,6 @@ "create_utility_meters": "Create utility meters", "entity_id": "Base entity", "name": "Name", - "unique_id": "Unique id", "subtract_entities": "Subtract entities" }, "data_description": { @@ -326,8 +323,7 @@ "group": "Add to group", "mode": "Calculation strategy", "name": "Name", - "standby_power": "Standby power", - "unique_id": "Unique id" + "standby_power": "Standby power" }, "data_description": { "create_energy_sensor": "Whether powercalc needs to create a kWh sensor", @@ -335,8 +331,7 @@ "entity_id": "entity the virtual power is based on, the power sensor will listen to state changes of this entity to be updated", "group": "Fill in a custom group name to create a new group", "name": "Leaving blank will take the name from the source entity", - "standby_power": "Define the amount of power the device is consuming when in an OFF state", - "unique_id": "Specify a unique_id. This will allow to setup multiple power sensors for the same entity. When not specified it will take the unique_id of the source entity" + "standby_power": "Define the amount of power the device is consuming when in an OFF state" }, "description": "See the readme for more information about the possible strategies and configuration options. Either source entity or name is required, or both.", "title": "Create a virtual power sensor" diff --git a/tests/config_flow/test_group_subtract.py b/tests/config_flow/test_group_subtract.py index 446890de2..52c7276d7 100644 --- a/tests/config_flow/test_group_subtract.py +++ b/tests/config_flow/test_group_subtract.py @@ -39,8 +39,6 @@ async def test_subtract_group_flow(hass: HomeAssistant) -> None: user_input, ) assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY - config_entry: ConfigEntry = result["result"] - assert config_entry.unique_id == "pc_subtract_sensor.outlet_power" assert result["data"] == { CONF_SENSOR_TYPE: SensorType.GROUP, CONF_GROUP_TYPE: GroupType.SUBTRACT,