mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Remove dead hass.data usage from netgear_lte (#176140)
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
"""Support for Netgear LTE modems."""
|
||||
# pylint: disable=home-assistant-use-runtime-data # Uses legacy hass.data[DOMAIN] pattern
|
||||
|
||||
from typing import Any
|
||||
|
||||
from aiohttp.cookiejar import CookieJar
|
||||
import eternalegypt
|
||||
@@ -20,7 +17,6 @@ from .const import (
|
||||
ATTR_MESSAGE,
|
||||
ATTR_SMS_ID,
|
||||
DATA_HASS_CONFIG,
|
||||
DATA_SESSION,
|
||||
DOMAIN,
|
||||
)
|
||||
from .coordinator import NetgearLTEConfigEntry, NetgearLTEDataUpdateCoordinator
|
||||
@@ -71,9 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: NetgearLTEConfigEntry) -
|
||||
host = entry.data[CONF_HOST]
|
||||
password = entry.data[CONF_PASSWORD]
|
||||
|
||||
data: dict[str, Any] = hass.data.setdefault(DOMAIN, {})
|
||||
if not (session := data.get(DATA_SESSION)) or session.closed:
|
||||
session = async_create_clientsession(hass, cookie_jar=CookieJar(unsafe=True))
|
||||
session = async_create_clientsession(hass, cookie_jar=CookieJar(unsafe=True))
|
||||
modem = eternalegypt.Modem(hostname=host, websession=session)
|
||||
|
||||
try:
|
||||
@@ -112,8 +106,4 @@ async def async_setup_entry(hass: HomeAssistant, entry: NetgearLTEConfigEntry) -
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: NetgearLTEConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
if not hass.config_entries.async_loaded_entries(DOMAIN):
|
||||
hass.data.pop(DOMAIN, None)
|
||||
|
||||
return unload_ok
|
||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
||||
@@ -16,7 +16,6 @@ CONF_NOTIFY: Final = "notify"
|
||||
CONF_SENSOR: Final = "sensor"
|
||||
|
||||
DATA_HASS_CONFIG = "netgear_lte_hass_config"
|
||||
DATA_SESSION = "session"
|
||||
# https://kb.netgear.com/31160/How-do-I-change-my-4G-LTE-Modem-s-IP-address-range
|
||||
DEFAULT_HOST = "192.168.5.1"
|
||||
DOMAIN: Final = "netgear_lte"
|
||||
|
||||
Reference in New Issue
Block a user