Skip to content

Commit

Permalink
Add quality scale, coordinator UpdateFailed, manual removal of devices
Browse files Browse the repository at this point in the history
  • Loading branch information
autinerd committed Nov 21, 2024
1 parent cf6800c commit 935ba22
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 2 deletions.
15 changes: 15 additions & 0 deletions homeassistant/components/eheimdigital/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntry

from .const import DOMAIN
from .coordinator import EheimDigitalUpdateCoordinator

PLATFORMS = [Platform.LIGHT]
Expand Down Expand Up @@ -33,3 +35,16 @@ async def async_unload_entry(
"""Unload a config entry."""
await entry.runtime_data.hub.close()
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)


async def async_remove_config_entry_device(
hass: HomeAssistant,
config_entry: EheimDigitalConfigEntry,
device_entry: DeviceEntry,
) -> bool:
"""Remove a config entry from a device."""
return not any(

Check warning on line 46 in homeassistant/components/eheimdigital/__init__.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/eheimdigital/__init__.py#L46

Added line #L46 was not covered by tests
identifier
for identifier in device_entry.identifiers
if identifier[0] == DOMAIN and identifier[1] in config_entry.runtime_data.data
)
8 changes: 6 additions & 2 deletions homeassistant/components/eheimdigital/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections.abc import Callable, Coroutine
from typing import Any

from aiohttp import ClientError
from eheimdigital.device import EheimDigitalDevice
from eheimdigital.hub import EheimDigitalHub
from eheimdigital.types import EheimDeviceType
Expand All @@ -14,7 +15,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.entity_component import DEFAULT_SCAN_INTERVAL
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import DOMAIN, LOGGER

Expand Down Expand Up @@ -73,5 +74,8 @@ async def _async_setup(self) -> None:
await self.hub.update()

async def _async_update_data(self) -> dict[str, EheimDigitalDevice]:
await self.hub.update()
try:
await self.hub.update()
except ClientError as ex:
raise UpdateFailed from ex

Check warning on line 80 in homeassistant/components/eheimdigital/coordinator.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/eheimdigital/coordinator.py#L79-L80

Added lines #L79 - L80 were not covered by tests
return self.data
70 changes: 70 additions & 0 deletions homeassistant/components/eheimdigital/quality_scale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
rules:
# Bronze
action-setup:
status: exempt
comment: No service actions implemented.
appropriate-polling: done
brands: done
common-modules: done
config-flow-test-coverage: done
config-flow: done
dependency-transparency: done
docs-actions:
status: exempt
comment: No service actions implemented.
docs-high-level-description: done
docs-installation-instructions: done
docs-removal-instructions: done
entity-event-setup: done
entity-unique-id: done
has-entity-name: done
runtime-data: done
test-before-configure: done
test-before-setup: done
unique-config-entry: done

# Silver
action-exceptions:
status: exempt
comment: No service actions implemented.
config-entry-unloading: done
docs-configuration-parameters:
status: exempt
comment: This integration doesn't have an options flow.
docs-installation-parameters: done
entity-unavailable: done
integration-owner: done
log-when-unavailable: done
parallel-updates: done
reauthentication-flow:
status: exempt
comment: This integration requires no authentication.
test-coverage: done

# Gold
devices: done
diagnostics: todo
discovery-update-info: done
discovery: done
docs-data-update: todo
docs-examples: todo
docs-known-limitations: todo
docs-supported-devices: done
docs-supported-functions: done
docs-troubleshooting: todo
docs-use-cases: todo
dynamic-devices: done
entity-category: done
entity-device-class: done
entity-disabled-by-default: done
entity-translations: done
exception-translations: todo
icon-translations: todo
reconfiguration-flow: todo
repair-issues: todo
stale-devices: done

# Platinum
async-dependency: done
inject-websession: done
strict-typing: done

0 comments on commit 935ba22

Please sign in to comment.