mirror of
https://github.com/home-assistant/core.git
synced 2026-10-07 14:58:11 -04:00
Remove redundant Sofar None checks (#183263)
This commit is contained in:
@@ -59,7 +59,7 @@ async def async_setup_entry(
|
||||
async_add_entities(
|
||||
SofarButton(runtime_data, description)
|
||||
for description in BUTTON_DESCRIPTIONS
|
||||
if inverter_type is not None and matches(inverter_type, description.applies_to)
|
||||
if matches(inverter_type, description.applies_to)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ class SofarDataUpdateCoordinator(DataUpdateCoordinator[UpdateReport]):
|
||||
def device_info(self) -> dr.DeviceInfo:
|
||||
"""Return device information."""
|
||||
serial = self.device.serial_number
|
||||
assert serial is not None
|
||||
identity = self.device.identity
|
||||
return dr.DeviceInfo(
|
||||
identifiers={(DOMAIN, serial)},
|
||||
|
||||
@@ -37,7 +37,6 @@ class SofarEntity(CoordinatorEntity[SofarDataUpdateCoordinator]):
|
||||
super().__init__(runtime_data.coordinator_for(entity_description.component))
|
||||
self.entity_description = entity_description
|
||||
serial = self.coordinator.device.serial_number
|
||||
assert serial is not None
|
||||
self._attr_unique_id = f"{serial}_{entity_description.key}"
|
||||
self._attr_device_info = self._device_info(runtime_data, serial)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user