get_matter_device_info: Test the Matter config entry is set up (#111792)
Ensure the Matter config entry is set uppull/112516/head
parent
b19b5dc451
commit
dd85a97a48
|
@ -1,4 +1,5 @@
|
|||
"""The Matter integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
|
@ -45,7 +46,10 @@ def get_matter_device_info(
|
|||
hass: HomeAssistant, device_id: str
|
||||
) -> MatterDeviceInfo | None:
|
||||
"""Return Matter device info or None if device does not exist."""
|
||||
if not (node := node_from_ha_device_id(hass, device_id)):
|
||||
# Test hass.data[DOMAIN] to ensure config entry is set up
|
||||
if not hass.data.get(DOMAIN, False) or not (
|
||||
node := node_from_ha_device_id(hass, device_id)
|
||||
):
|
||||
return None
|
||||
|
||||
return MatterDeviceInfo(
|
||||
|
|
Loading…
Reference in New Issue