From b68147fcb906491dcb37a0344e0e216b7bbf615a Mon Sep 17 00:00:00 2001 From: BottlecapDave Date: Sun, 12 Nov 2023 14:59:16 +0000 Subject: [PATCH] chore: Updated name of account based entities --- custom_components/octopus_energy/intelligent/bump_charge.py | 4 ++-- custom_components/octopus_energy/intelligent/charge_limit.py | 4 ++-- custom_components/octopus_energy/intelligent/dispatching.py | 4 ++-- custom_components/octopus_energy/intelligent/ready_time.py | 4 ++-- custom_components/octopus_energy/intelligent/smart_charge.py | 4 ++-- custom_components/octopus_energy/octoplus/points.py | 4 ++-- custom_components/octopus_energy/octoplus/saving_sessions.py | 4 ++-- .../octopus_energy/octoplus/saving_sessions_events.py | 4 ++-- custom_components/octopus_energy/utils/__init__.py | 3 --- .../octopus_energy/wheel_of_fortune/electricity_spins.py | 4 ++-- .../octopus_energy/wheel_of_fortune/gas_spins.py | 4 ++-- 11 files changed, 20 insertions(+), 23 deletions(-) diff --git a/custom_components/octopus_energy/intelligent/bump_charge.py b/custom_components/octopus_energy/intelligent/bump_charge.py index c9eea63a..c41ac71f 100644 --- a/custom_components/octopus_energy/intelligent/bump_charge.py +++ b/custom_components/octopus_energy/intelligent/bump_charge.py @@ -13,7 +13,7 @@ from ..api_client import OctopusEnergyApiClient from . import is_in_bump_charge from ..coordinators.intelligent_dispatches import IntelligentDispatchesCoordinatorResult -from ..utils import account_id_to_unique_key + _LOGGER = logging.getLogger(__name__) @@ -36,7 +36,7 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_intelligent_bump_charge" + return f"octopus_energy_{self._account_id}_intelligent_bump_charge" @property def name(self): diff --git a/custom_components/octopus_energy/intelligent/charge_limit.py b/custom_components/octopus_energy/intelligent/charge_limit.py index 696bdafa..be1af75e 100644 --- a/custom_components/octopus_energy/intelligent/charge_limit.py +++ b/custom_components/octopus_energy/intelligent/charge_limit.py @@ -14,7 +14,7 @@ from .base import OctopusEnergyIntelligentSensor from ..api_client import OctopusEnergyApiClient from ..coordinators.intelligent_settings import IntelligentCoordinatorResult -from ..utils import account_id_to_unique_key + _LOGGER = logging.getLogger(__name__) @@ -37,7 +37,7 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_intelligent_charge_limit" + return f"octopus_energy_{self._account_id}_intelligent_charge_limit" @property def name(self): diff --git a/custom_components/octopus_energy/intelligent/dispatching.py b/custom_components/octopus_energy/intelligent/dispatching.py index fa338d6d..7f2e4db9 100644 --- a/custom_components/octopus_energy/intelligent/dispatching.py +++ b/custom_components/octopus_energy/intelligent/dispatching.py @@ -22,7 +22,7 @@ from .base import OctopusEnergyIntelligentSensor from ..coordinators.intelligent_dispatches import IntelligentDispatchesCoordinatorResult -from ..utils import account_id_to_unique_key + _LOGGER = logging.getLogger(__name__) @@ -52,7 +52,7 @@ def __init__(self, hass: HomeAssistant, coordinator, rates_coordinator, mpan: st @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_intelligent_dispatching" + return f"octopus_energy_{self._account_id}_intelligent_dispatching" @property def name(self): diff --git a/custom_components/octopus_energy/intelligent/ready_time.py b/custom_components/octopus_energy/intelligent/ready_time.py index e7cc8d0c..fdf13bbf 100644 --- a/custom_components/octopus_energy/intelligent/ready_time.py +++ b/custom_components/octopus_energy/intelligent/ready_time.py @@ -13,7 +13,7 @@ from .base import OctopusEnergyIntelligentSensor from ..api_client import OctopusEnergyApiClient from ..coordinators.intelligent_settings import IntelligentCoordinatorResult -from ..utils import account_id_to_unique_key + _LOGGER = logging.getLogger(__name__) @@ -36,7 +36,7 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_intelligent_ready_time" + return f"octopus_energy_{self._account_id}_intelligent_ready_time" @property def name(self): diff --git a/custom_components/octopus_energy/intelligent/smart_charge.py b/custom_components/octopus_energy/intelligent/smart_charge.py index 6b224c61..9de06e93 100644 --- a/custom_components/octopus_energy/intelligent/smart_charge.py +++ b/custom_components/octopus_energy/intelligent/smart_charge.py @@ -12,7 +12,7 @@ from .base import OctopusEnergyIntelligentSensor from ..api_client import OctopusEnergyApiClient from ..coordinators.intelligent_settings import IntelligentCoordinatorResult -from ..utils import account_id_to_unique_key + _LOGGER = logging.getLogger(__name__) @@ -35,7 +35,7 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_intelligent_smart_charge" + return f"octopus_energy_{self._account_id}_intelligent_smart_charge" @property def name(self): diff --git a/custom_components/octopus_energy/octoplus/points.py b/custom_components/octopus_energy/octoplus/points.py index 45d80f11..e4c94bbc 100644 --- a/custom_components/octopus_energy/octoplus/points.py +++ b/custom_components/octopus_energy/octoplus/points.py @@ -10,7 +10,7 @@ SensorStateClass ) from ..api_client import OctopusEnergyApiClient -from ..utils import account_id_to_unique_key + _LOGGER = logging.getLogger(__name__) @@ -33,7 +33,7 @@ def __init__(self, hass: HomeAssistant, client: OctopusEnergyApiClient, account_ @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_octoplus_points" + return f"octopus_energy_{self._account_id}_octoplus_points" @property def name(self): diff --git a/custom_components/octopus_energy/octoplus/saving_sessions.py b/custom_components/octopus_energy/octoplus/saving_sessions.py index b52482e6..e7f3c7eb 100644 --- a/custom_components/octopus_energy/octoplus/saving_sessions.py +++ b/custom_components/octopus_energy/octoplus/saving_sessions.py @@ -16,7 +16,7 @@ current_saving_sessions_event, get_next_saving_sessions_event ) -from ..utils import account_id_to_unique_key + from ..coordinators.saving_sessions import SavingSessionsCoordinatorResult _LOGGER = logging.getLogger(__name__) @@ -46,7 +46,7 @@ def __init__(self, hass: HomeAssistant, coordinator, account_id: str): @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_octoplus_saving_sessions" + return f"octopus_energy_{self._account_id}_octoplus_saving_sessions" @property def name(self): diff --git a/custom_components/octopus_energy/octoplus/saving_sessions_events.py b/custom_components/octopus_energy/octoplus/saving_sessions_events.py index 1ee62798..d88a6eac 100644 --- a/custom_components/octopus_energy/octoplus/saving_sessions_events.py +++ b/custom_components/octopus_energy/octoplus/saving_sessions_events.py @@ -8,7 +8,7 @@ from homeassistant.helpers.restore_state import RestoreEntity from ..const import EVENT_ALL_SAVING_SESSIONS -from ..utils import account_id_to_unique_key + from ..api_client import OctopusEnergyApiClient _LOGGER = logging.getLogger(__name__) @@ -30,7 +30,7 @@ def __init__(self, hass: HomeAssistant, client: OctopusEnergyApiClient, account_ @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_octoplus_saving_session_events" + return f"octopus_energy_{self._account_id}_octoplus_saving_session_events" @property def name(self): diff --git a/custom_components/octopus_energy/utils/__init__.py b/custom_components/octopus_energy/utils/__init__.py index 2fd878bc..88771928 100644 --- a/custom_components/octopus_energy/utils/__init__.py +++ b/custom_components/octopus_energy/utils/__init__.py @@ -108,6 +108,3 @@ def private_rates_to_public_rates(rates: list): new_rates.append(new_rate) return new_rates - -def account_id_to_unique_key(account_id: str): - return account_id.replace('-', '') \ No newline at end of file diff --git a/custom_components/octopus_energy/wheel_of_fortune/electricity_spins.py b/custom_components/octopus_energy/wheel_of_fortune/electricity_spins.py index d5597f4c..d73019da 100644 --- a/custom_components/octopus_energy/wheel_of_fortune/electricity_spins.py +++ b/custom_components/octopus_energy/wheel_of_fortune/electricity_spins.py @@ -9,7 +9,7 @@ RestoreSensor, SensorStateClass ) -from ..utils import account_id_to_unique_key + from ..coordinators.wheel_of_fortune import WheelOfFortuneSpinsCoordinatorResult from ..api_client import OctopusEnergyApiClient @@ -35,7 +35,7 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_wheel_of_fortune_spins_electricity" + return f"octopus_energy_{self._account_id}_wheel_of_fortune_spins_electricity" @property def name(self): diff --git a/custom_components/octopus_energy/wheel_of_fortune/gas_spins.py b/custom_components/octopus_energy/wheel_of_fortune/gas_spins.py index 06295891..b8dddbde 100644 --- a/custom_components/octopus_energy/wheel_of_fortune/gas_spins.py +++ b/custom_components/octopus_energy/wheel_of_fortune/gas_spins.py @@ -9,7 +9,7 @@ RestoreSensor, SensorStateClass ) -from ..utils import account_id_to_unique_key + from ..coordinators.wheel_of_fortune import WheelOfFortuneSpinsCoordinatorResult from ..api_client import OctopusEnergyApiClient @@ -35,7 +35,7 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli @property def unique_id(self): """The id of the sensor.""" - return f"octopus_energy_{account_id_to_unique_key(self._account_id)}_wheel_of_fortune_spins_gas" + return f"octopus_energy_{self._account_id}_wheel_of_fortune_spins_gas" @property def name(self):