Use constant instead of plain key name for device info connections in roborock and roomba (#103182)

This commit is contained in:
Jan-Philipp Benecke 2023-11-01 18:09:49 +01:00 committed by GitHub
parent 56b4369f44
commit 67fa304b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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."""

View File

@ -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)
}