Skip to content

Commit

Permalink
ruff part 5
Browse files Browse the repository at this point in the history
  • Loading branch information
sfstar committed Jan 29, 2025
1 parent 3f6eff9 commit 8e3c6e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/victron/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ async def async_setup_entry(
for name in registerLedger:
for register_name, registerInfo in register_info_dict[name].items():
_LOGGER.debug(
"unit == "
+ str(slave)
+ " registerLedger == "
+ str(registerLedger)
+ " registerInfo "
"unit == %s registerLedger == %s registerInfo",
slave,
registerLedger,
)
if config_entry.options[CONF_ADVANCED_OPTIONS]:
if not isinstance(
Expand All @@ -86,7 +84,7 @@ async def async_setup_entry(
if isinstance(registerInfo.entityType, TextReadEntityType)
else None,
)
_LOGGER.debug("composed description == " + str(description))
_LOGGER.debug("composed description == %s", description)

descriptions.append(description)

Expand All @@ -101,6 +99,7 @@ async def async_setup_entry(


def determine_victron_device_class(name, unit):
"""Determine the device class of a sensor based on its name and unit."""
if unit == PERCENTAGE and "soc" in name:
return SensorDeviceClass.BATTERY
if unit == PERCENTAGE:
Expand Down Expand Up @@ -205,6 +204,7 @@ def _handle_coordinator_update(self) -> None:

@property
def available(self) -> bool:
"""Return True if entity is available."""
full_key = str(self.description.slave) + "." + self.description.key
return self.coordinator.processed_data()["availability"][full_key]

Expand Down

0 comments on commit 8e3c6e3

Please sign in to comment.