Start using runtime_data for zwave_js (#117261)

* Start using runtime_data for zwave_js

* fix bug
This commit is contained in:
Raman Gupta 2024-05-11 14:08:30 -04:00 committed by GitHub
parent a892062f01
commit 1f792fc2aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 47 additions and 52 deletions

View file

@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import DATA_CLIENT, DOMAIN, USER_AGENT
from .const import DATA_CLIENT, USER_AGENT
from .helpers import (
ZwaveValueMatcher,
get_home_and_node_id_from_device_entry,
@ -148,7 +148,7 @@ async def async_get_device_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry, device: dr.DeviceEntry
) -> dict[str, Any]:
"""Return diagnostics for a device."""
client: Client = hass.data[DOMAIN][config_entry.entry_id][DATA_CLIENT]
client: Client = config_entry.runtime_data[DATA_CLIENT]
identifiers = get_home_and_node_id_from_device_entry(device)
node_id = identifiers[1] if identifiers else None
driver = client.driver