Skip to content

Commit 08b758b

Browse files
Add device info and parallel_updates to Transmission (home-assistant#157423)
1 parent 4306fbe commit 08b758b

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

homeassistant/components/transmission/__init__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
)
2727
from homeassistant.core import HomeAssistant, callback
2828
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
29-
from homeassistant.helpers import config_validation as cv, entity_registry as er
29+
from homeassistant.helpers import (
30+
config_validation as cv,
31+
device_registry as dr,
32+
entity_registry as er,
33+
)
34+
from homeassistant.helpers.device_registry import DeviceEntryType
3035
from homeassistant.helpers.typing import ConfigType
3136

3237
from .const import DEFAULT_PATH, DEFAULT_SSL, DOMAIN
@@ -93,6 +98,19 @@ def update_unique_id(
9398
except (AuthenticationError, UnknownError) as error:
9499
raise ConfigEntryAuthFailed from error
95100

101+
protocol: Final = "https" if config_entry.data[CONF_SSL] else "http"
102+
device_registry = dr.async_get(hass)
103+
device_registry.async_get_or_create(
104+
config_entry_id=config_entry.entry_id,
105+
identifiers={(DOMAIN, config_entry.entry_id)},
106+
manufacturer="Transmission",
107+
entry_type=DeviceEntryType.SERVICE,
108+
sw_version=api.server_version,
109+
configuration_url=(
110+
f"{protocol}://{config_entry.data[CONF_HOST]}:{config_entry.data[CONF_PORT]}"
111+
),
112+
)
113+
96114
coordinator = TransmissionDataUpdateCoordinator(hass, config_entry, api)
97115
await hass.async_add_executor_job(coordinator.init_torrent_list)
98116

homeassistant/components/transmission/entity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ def __init__(
2626
)
2727
self._attr_device_info = DeviceInfo(
2828
identifiers={(DOMAIN, coordinator.config_entry.entry_id)},
29-
manufacturer="Transmission",
3029
)

homeassistant/components/transmission/quality_scale.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ rules:
3030
entity-unavailable: done
3131
integration-owner: done
3232
log-when-unavailable: done
33-
parallel-updates: todo
33+
parallel-updates: done
3434
reauthentication-flow: done
3535
test-coverage: done
3636

3737
# Gold
38-
devices:
39-
status: todo
40-
comment: |
41-
Add additional device detail including link to ui.
38+
devices: done
4239
diagnostics: todo
4340
discovery-update-info: todo
4441
discovery: todo

homeassistant/components/transmission/sensor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
from .coordinator import TransmissionConfigEntry, TransmissionDataUpdateCoordinator
3030
from .entity import TransmissionEntity
3131

32+
PARALLEL_UPDATES = 0
33+
3234
MODES: dict[str, list[str] | None] = {
3335
"started_torrents": ["downloading"],
3436
"completed_torrents": ["seeding"],

homeassistant/components/transmission/switch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from .coordinator import TransmissionConfigEntry, TransmissionDataUpdateCoordinator
1212
from .entity import TransmissionEntity
1313

14+
PARALLEL_UPDATES = 0
15+
1416

1517
@dataclass(frozen=True, kw_only=True)
1618
class TransmissionSwitchEntityDescription(SwitchEntityDescription):

tests/components/transmission/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def mock_transmission_client() -> Generator[AsyncMock]:
4747
):
4848
client = mock_client_class.return_value
4949

50+
client.server_version = "4.0.5 (a6fe2a64aa)"
51+
5052
session_stats_data = {
5153
"uploadSpeed": 1,
5254
"downloadSpeed": 1,

0 commit comments

Comments
 (0)