mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Use constant instead of plain key name for device info connections in roborock and roomba (#103182)
This commit is contained in:
parent
56b4369f44
commit
67fa304b78
@ -10,6 +10,7 @@ from roborock.exceptions import RoborockException
|
|||||||
from roborock.local_api import RoborockLocalClient
|
from roborock.local_api import RoborockLocalClient
|
||||||
from roborock.roborock_typing import DeviceProp
|
from roborock.roborock_typing import DeviceProp
|
||||||
|
|
||||||
|
from homeassistant.const import ATTR_CONNECTIONS
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
@ -54,7 +55,7 @@ class RoborockDataUpdateCoordinator(DataUpdateCoordinator[DeviceProp]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if mac := self.roborock_device_info.network_info.mac:
|
if mac := self.roborock_device_info.network_info.mac:
|
||||||
self.device_info["connections"] = {(dr.CONNECTION_NETWORK_MAC, mac)}
|
self.device_info[ATTR_CONNECTIONS] = {(dr.CONNECTION_NETWORK_MAC, mac)}
|
||||||
|
|
||||||
async def verify_api(self) -> None:
|
async def verify_api(self) -> None:
|
||||||
"""Verify that the api is reachable. If it is not, switch clients."""
|
"""Verify that the api is reachable. If it is not, switch clients."""
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.components.vacuum import (
|
|||||||
StateVacuumEntity,
|
StateVacuumEntity,
|
||||||
VacuumEntityFeature,
|
VacuumEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_IDLE, STATE_PAUSED
|
from homeassistant.const import ATTR_CONNECTIONS, STATE_IDLE, STATE_PAUSED
|
||||||
import homeassistant.helpers.device_registry as dr
|
import homeassistant.helpers.device_registry as dr
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
@ -83,7 +83,7 @@ class IRobotEntity(Entity):
|
|||||||
if mac_address := self.vacuum_state.get("hwPartsRev", {}).get(
|
if mac_address := self.vacuum_state.get("hwPartsRev", {}).get(
|
||||||
"wlan0HwAddr", self.vacuum_state.get("mac")
|
"wlan0HwAddr", self.vacuum_state.get("mac")
|
||||||
):
|
):
|
||||||
self._attr_device_info["connections"] = {
|
self._attr_device_info[ATTR_CONNECTIONS] = {
|
||||||
(dr.CONNECTION_NETWORK_MAC, mac_address)
|
(dr.CONNECTION_NETWORK_MAC, mac_address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user