Skip to content

Commit

Permalink
chore: Updated name of account based entities
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Nov 12, 2023
1 parent 137ccf2 commit b68147f
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 23 deletions.
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/intelligent/bump_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/intelligent/charge_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/intelligent/dispatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/intelligent/ready_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/intelligent/smart_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/octoplus/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SensorStateClass
)
from ..api_client import OctopusEnergyApiClient
from ..utils import account_id_to_unique_key


_LOGGER = logging.getLogger(__name__)

Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/octoplus/saving_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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):
Expand Down
3 changes: 0 additions & 3 deletions custom_components/octopus_energy/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('-', '')
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand Down

0 comments on commit b68147f

Please sign in to comment.