Rename "Ruckus Unleashed" integration to "Ruckus" (#125392)

This commit is contained in:
Tony 2024-09-07 00:48:16 +12:00 committed by GitHub
parent aba23eb513
commit 9777ed2e62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 31 additions and 35 deletions

View File

@ -1,4 +1,4 @@
"""The Ruckus Unleashed integration."""
"""The Ruckus integration."""
import logging
@ -24,13 +24,13 @@ from .const import (
PLATFORMS,
UNDO_UPDATE_LISTENERS,
)
from .coordinator import RuckusUnleashedDataUpdateCoordinator
from .coordinator import RuckusDataUpdateCoordinator
_LOGGER = logging.getLogger(__package__)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Ruckus Unleashed from a config entry."""
"""Set up Ruckus from a config entry."""
ruckus = AjaxSession.async_create(
entry.data[CONF_HOST],
@ -46,7 +46,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await ruckus.close()
raise ConfigEntryAuthFailed from autherr
coordinator = RuckusUnleashedDataUpdateCoordinator(hass, ruckus=ruckus)
coordinator = RuckusDataUpdateCoordinator(hass, ruckus=ruckus)
await coordinator.async_config_entry_first_refresh()

View File

@ -1,4 +1,4 @@
"""Config flow for Ruckus Unleashed integration."""
"""Config flow for Ruckus integration."""
from collections.abc import Mapping
import logging
@ -59,8 +59,8 @@ async def validate_input(hass: HomeAssistant, data):
}
class RuckusUnleashedConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Ruckus Unleashed."""
class RuckusConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Ruckus."""
VERSION = 1

View File

@ -1,4 +1,4 @@
"""Constants for the Ruckus Unleashed integration."""
"""Constants for the Ruckus integration."""
from homeassistant.const import Platform

View File

@ -1,4 +1,4 @@
"""Ruckus Unleashed DataUpdateCoordinator."""
"""Ruckus DataUpdateCoordinator."""
from datetime import timedelta
import logging
@ -15,11 +15,11 @@ from .const import API_CLIENT_MAC, DOMAIN, KEY_SYS_CLIENTS, SCAN_INTERVAL
_LOGGER = logging.getLogger(__package__)
class RuckusUnleashedDataUpdateCoordinator(DataUpdateCoordinator):
"""Coordinator to manage data from Ruckus Unleashed client."""
class RuckusDataUpdateCoordinator(DataUpdateCoordinator):
"""Coordinator to manage data from Ruckus client."""
def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None:
"""Initialize global Ruckus Unleashed data updater."""
"""Initialize global Ruckus data updater."""
self.ruckus = ruckus
update_interval = timedelta(seconds=SCAN_INTERVAL)
@ -38,7 +38,7 @@ class RuckusUnleashedDataUpdateCoordinator(DataUpdateCoordinator):
return {client[API_CLIENT_MAC]: client for client in clients}
async def _async_update_data(self) -> dict:
"""Fetch Ruckus Unleashed data."""
"""Fetch Ruckus data."""
try:
return {KEY_SYS_CLIENTS: await self._fetch_clients()}
except AuthenticationError as autherror:

View File

@ -1,4 +1,4 @@
"""Support for Ruckus Unleashed devices."""
"""Support for Ruckus devices."""
from __future__ import annotations
@ -19,7 +19,7 @@ from .const import (
KEY_SYS_CLIENTS,
UNDO_UPDATE_LISTENERS,
)
from .coordinator import RuckusUnleashedDataUpdateCoordinator
from .coordinator import RuckusDataUpdateCoordinator
_LOGGER = logging.getLogger(__package__)
@ -27,7 +27,7 @@ _LOGGER = logging.getLogger(__package__)
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up device tracker for Ruckus Unleashed component."""
"""Set up device tracker for Ruckus component."""
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
tracked: set[str] = set()
@ -58,9 +58,7 @@ def add_new_entities(coordinator, async_add_entities, tracked):
device = coordinator.data[KEY_SYS_CLIENTS][mac]
_LOGGER.debug("adding new device: [%s] %s", mac, device[API_CLIENT_HOSTNAME])
new_tracked.append(
RuckusUnleashedDevice(coordinator, mac, device[API_CLIENT_HOSTNAME])
)
new_tracked.append(RuckusDevice(coordinator, mac, device[API_CLIENT_HOSTNAME]))
tracked.add(mac)
async_add_entities(new_tracked)
@ -69,13 +67,13 @@ def add_new_entities(coordinator, async_add_entities, tracked):
@callback
def restore_entities(
registry: er.EntityRegistry,
coordinator: RuckusUnleashedDataUpdateCoordinator,
coordinator: RuckusDataUpdateCoordinator,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
tracked: set[str],
) -> None:
"""Restore clients that are not a part of active clients list."""
missing: list[RuckusUnleashedDevice] = []
missing: list[RuckusDevice] = []
for entity in registry.entities.get_entries_for_config_entry_id(entry.entry_id):
if (
@ -83,9 +81,7 @@ def restore_entities(
and entity.unique_id not in coordinator.data[KEY_SYS_CLIENTS]
):
missing.append(
RuckusUnleashedDevice(
coordinator, entity.unique_id, entity.original_name
)
RuckusDevice(coordinator, entity.unique_id, entity.original_name)
)
tracked.add(entity.unique_id)
@ -93,11 +89,11 @@ def restore_entities(
async_add_entities(missing)
class RuckusUnleashedDevice(CoordinatorEntity, ScannerEntity):
"""Representation of a Ruckus Unleashed client."""
class RuckusDevice(CoordinatorEntity, ScannerEntity):
"""Representation of a Ruckus client."""
def __init__(self, coordinator, mac, name) -> None:
"""Initialize a Ruckus Unleashed client."""
"""Initialize a Ruckus client."""
super().__init__(coordinator)
self._mac = mac
self._name = name

View File

@ -1,6 +1,6 @@
{
"domain": "ruckus_unleashed",
"name": "Ruckus Unleashed",
"name": "Ruckus",
"codeowners": ["@lanrat", "@ms264556", "@gabe565"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ruckus_unleashed",

View File

@ -5208,7 +5208,7 @@
"iot_class": "local_push"
},
"ruckus_unleashed": {
"name": "Ruckus Unleashed",
"name": "Ruckus",
"integration_type": "hub",
"config_flow": true,
"iot_class": "local_polling"

View File

@ -1,4 +1,4 @@
"""Tests for the Ruckus Unleashed integration."""
"""Tests for the Ruckus integration."""
from __future__ import annotations
@ -78,7 +78,7 @@ DEFAULT_UNIQUEID = DEFAULT_SYSTEM_INFO[API_SYS_SYSINFO][API_SYS_SYSINFO_SERIAL]
def mock_config_entry() -> MockConfigEntry:
"""Return a Ruckus Unleashed mock config entry."""
"""Return a Ruckus mock config entry."""
return MockConfigEntry(
domain=DOMAIN,
title=DEFAULT_TITLE,
@ -89,7 +89,7 @@ def mock_config_entry() -> MockConfigEntry:
async def init_integration(hass: HomeAssistant) -> MockConfigEntry:
"""Set up the Ruckus Unleashed integration in Home Assistant."""
"""Set up the Ruckus integration in Home Assistant."""
entry = mock_config_entry()
entry.add_to_hass(hass)
# Make device tied to other integration so device tracker entities get enabled

View File

@ -1,4 +1,4 @@
"""Test the Ruckus Unleashed config flow."""
"""Test the config flow."""
from copy import deepcopy
from datetime import timedelta

View File

@ -1,4 +1,4 @@
"""The sensor tests for the Ruckus Unleashed platform."""
"""The sensor tests for the Ruckus platform."""
from datetime import timedelta
from unittest.mock import AsyncMock

View File

@ -1,4 +1,4 @@
"""Test the Ruckus Unleashed config flow."""
"""Test the Ruckus config flow."""
from unittest.mock import AsyncMock