mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
get_matter_device_info: Test the Matter config entry is set up (#111792)
Ensure the Matter config entry is set up
This commit is contained in:
parent
1eac7bcbec
commit
c6fd9e25ce
@ -1,4 +1,5 @@
|
|||||||
"""The Matter integration."""
|
"""The Matter integration."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -45,7 +46,10 @@ def get_matter_device_info(
|
|||||||
hass: HomeAssistant, device_id: str
|
hass: HomeAssistant, device_id: str
|
||||||
) -> MatterDeviceInfo | None:
|
) -> MatterDeviceInfo | None:
|
||||||
"""Return Matter device info or None if device does not exist."""
|
"""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 None
|
||||||
|
|
||||||
return MatterDeviceInfo(
|
return MatterDeviceInfo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user