Skip to content

Commit

Permalink
Use proper multiplication sign instead of letter x (#1005)
Browse files Browse the repository at this point in the history
* Use proper multiplication sign instead of letter x

* Change to multiplier in library and correct discovery

---------

Co-authored-by: Andrew Jackson <andrew@codechimp.org>
  • Loading branch information
bartkummel and andrew-codechimp committed Feb 13, 2024
1 parent f05807f commit ca42f0d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/battery_notes/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def current_battery_level(self, value):
def battery_type_and_quantity(self) -> str:
"""Merge battery type & quantity."""
if self.battery_quantity and int(self.battery_quantity) > 1:
return str(self.battery_quantity) + "x " + self.battery_type
return str(self.battery_quantity) + "× " + self.battery_type
return self.battery_type

@property
Expand Down
6 changes: 5 additions & 1 deletion custom_components/battery_notes/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
CONF_MANUFACTURER,
CONF_MODEL,
CONF_BATTERY_TYPE,
CONF_BATTERY_QUANTITY,
DOMAIN,
)
from .library import ModelInfo, DeviceBatteryDetails, Library
Expand Down Expand Up @@ -145,7 +146,10 @@ def _init_entity_discovery(
if device_battery_details:
discovery_data[
CONF_BATTERY_TYPE
] = device_battery_details.battery_type_and_quantity
] = device_battery_details.battery_type
discovery_data[
CONF_BATTERY_QUANTITY
] = device_battery_details.battery_quantity
discovery_data[CONF_MANUFACTURER] = device_battery_details.manufacturer
discovery_data[CONF_MODEL] = device_battery_details.model
discovery_data[CONF_DEVICE_NAME] = get_wrapped_device_name(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/battery_notes/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def battery_type_and_quantity(self):
quantity = 0

if quantity > 1:
batteries = str(quantity) + "x " + self.battery_type
batteries = str(quantity) + "× " + self.battery_type
else:
batteries = self.battery_type

Expand Down

0 comments on commit ca42f0d

Please sign in to comment.