mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07: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.roborock_typing import DeviceProp
|
||||
|
||||
from homeassistant.const import ATTR_CONNECTIONS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
@ -54,7 +55,7 @@ class RoborockDataUpdateCoordinator(DataUpdateCoordinator[DeviceProp]):
|
||||
)
|
||||
|
||||
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:
|
||||
"""Verify that the api is reachable. If it is not, switch clients."""
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.components.vacuum import (
|
||||
StateVacuumEntity,
|
||||
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
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@ -83,7 +83,7 @@ class IRobotEntity(Entity):
|
||||
if mac_address := self.vacuum_state.get("hwPartsRev", {}).get(
|
||||
"wlan0HwAddr", self.vacuum_state.get("mac")
|
||||
):
|
||||
self._attr_device_info["connections"] = {
|
||||
self._attr_device_info[ATTR_CONNECTIONS] = {
|
||||
(dr.CONNECTION_NETWORK_MAC, mac_address)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user