Skip to content

Commit

Permalink
feat: updated the default names of various sensors to be more useful …
Browse files Browse the repository at this point in the history
…in areas of HA when space is limited

BREAKING CHANGE:
If you are relying on the previous default names of sensors then you will need to update your
sensors manually. Only the visual default name of the sensors have changed; the entity ids will
remain the same and therefore will not effect any automatmations. If you have manually changed the
names of the sensors, this should not effect you.
  • Loading branch information
BottlecapDave committed Apr 27, 2024
1 parent 40d21d1 commit 870c917
Show file tree
Hide file tree
Showing 48 changed files with 60 additions and 59 deletions.
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/electricity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, hass: HomeAssistant, meter, point):
self._is_export = meter["is_export"]
self._is_smart_meter = meter["is_smart_meter"]
self._export_id_addition = "_export" if self._is_export == True else ""
self._export_name_addition = " Export" if self._is_export == True else ""
self._export_name_addition = "Export " if self._is_export == True else ""

self._attributes = {
"mpan": self._mpan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
base_name = f"Electricity {self._serial_number} {self._mpan} Current Accumulative Consumption"
base_name = f"Current Accumulative Consumption Electricity ({self._serial_number}/{self._mpan})"
if self._peak_type is not None:
return f"{base_name} ({get_peak_name(self._peak_type)})"
return f"{get_peak_name(self._peak_type)} {base_name}"

return base_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
base_name = f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Current Accumulative Cost"
base_name = f"Current Accumulative Cost {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"
if self._peak_type is not None:
return f"{base_name} ({get_peak_name(self._peak_type)})"
return f"{get_peak_name(self._peak_type)} {base_name}"

return base_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan} Current Consumption"
return f"Current Consumption Electricity ({self._serial_number}/{self._mpan})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan} Current Demand"
return f"Current Demand Electricity ({self._serial_number}/{self._mpan})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Current Rate"
return f"Current Rate {self._export_name_addition}Electricity ({self._serial_number} {self._mpan})"

@property
def state_class(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/electricity/next_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Next Rate"
return f"Next Rate {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def state_class(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/electricity/off_peak.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Off Peak"
return f"Off Peak {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def icon(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
base_name = f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Accumulative Consumption"
base_name = f"Previous Accumulative Consumption {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

if self._peak_type is not None:
return f"{base_name} ({get_peak_name(self._peak_type)})"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
base_id = f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Accumulative Cost"
base_id = f"Previous Accumulative Cost {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"
if self._peak_type is not None:
return f"{base_id} ({get_peak_name(self._peak_type)})"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Accumulative Cost Override"
return f"Previous Accumulative Cost Override {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def entity_registry_enabled_default(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Cost Override Tariff"
return f"Previous Cost Override Tariff {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def icon(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Rate"
return f"Previous Rate {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def state_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Current Day Rates"
return f"Current Day Rates {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Next Day Rates"
return f"Next Day Rates {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Consumption Rates"
return f"Previous Consumption Rates {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def entity_registry_enabled_default(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Consumption Override Rates"
return f"Previous Consumption Override Rates {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

@property
def entity_registry_enabled_default(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Previous Day Rates"
return f"Previous Day Rates {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f'Electricity {self._serial_number} {self._mpan}{self._export_name_addition} Current Standing Charge'
return f'Current Standing Charge {self._export_name_addition}Electricity ({self._serial_number}/{self._mpan})'

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Current Accumulative Consumption ({UnitOfVolume.CUBIC_METERS})"
return f"Current Accumulative Consumption ({UnitOfVolume.CUBIC_METERS}) Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Current Accumulative Consumption"
return f"Current Accumulative Consumption Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Current Accumulative Cost"
return f"Current Accumulative Cost Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Current Consumption"
return f"Current Consumption Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/current_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f'Gas {self._serial_number} {self._mprn} Current Rate'
return f'Current Rate Gas ({self._serial_number}/{self._mprn})'

@property
def state_class(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/next_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f'Gas {self._serial_number} {self._mprn} Next Rate'
return f'Next Rate Gas ({self._serial_number}/{self._mprn})'

@property
def state_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Accumulative Consumption"
return f"Previous Accumulative Consumption Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Accumulative Consumption (kWh)"
return f"Previous Accumulative Consumption (kWh) Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Accumulative Cost"
return f"Previous Accumulative Cost Gas ({self._serial_number}/{self._mprn})"

@property
def device_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Accumulative Cost Override"
return f"Previous Accumulative Cost Override Gas ({self._serial_number}/{self._mprn})"

@property
def entity_registry_enabled_default(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Cost Override Tariff"
return f"Previous Cost Override Tariff Gas ({self._serial_number}/{self._mprn})"

@property
def icon(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/previous_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f'Gas {self._serial_number} {self._mprn} Previous Rate'
return f'Previous Rate Gas ({self._serial_number}/{self._mprn})'

@property
def state_class(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/rates_current_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Current Day Rates"
return f"Current Day Rates Gas ({self._serial_number}/{self._mprn})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/rates_next_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Next Day Rates"
return f"Next Day Rates Gas ({self._serial_number}/{self._mprn})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Consumption Rates"
return f"Previous Consumption Rates Gas ({self._serial_number}/{self._mprn})"

@property
def entity_registry_enabled_default(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def entity_registry_enabled_default(self) -> bool:
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Consumption Override Rates"
return f"Previous Consumption Override Rates Gas ({self._serial_number}/{self._mprn})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/rates_previous_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Gas {self._serial_number} {self._mprn} Previous Day Rates"
return f"Previous Day Rates Gas ({self._serial_number}/{self._mprn})"

async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/gas/standing_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f'Gas {self._serial_number} {self._mprn} Current Standing Charge'
return f'Current Standing Charge Gas ({self._serial_number}/{self._mprn})'

@property
def state_class(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Octopus Energy {self._account_id} Intelligent Bump Charge"
return f"Intelligent Bump Charge ({self._account_id})"

@property
def icon(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Octopus Energy {self._account_id} Intelligent Charge Limit"
return f"Intelligent Charge Limit ({self._account_id})"

@property
def icon(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Octopus Energy {self._account_id} Intelligent Dispatching"
return f"Intelligent Dispatching ({self._account_id})"

@property
def icon(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/intelligent/ready_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Octopus Energy {self._account_id} Intelligent Ready Time"
return f"Intelligent Ready Time ({self._account_id})"

@property
def icon(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Octopus Energy {self._account_id} Intelligent Smart Charge"
return f"Intelligent Smart Charge ({self._account_id})"

@property
def icon(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/octoplus/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def unique_id(self):
@property
def name(self):
"""Name of the sensor."""
return f"Octopus Energy {self._account_id} Octoplus Points"
return f"Octoplus Points ({self._account_id})"

@property
def icon(self):
Expand Down
Loading

0 comments on commit 870c917

Please sign in to comment.