Include mac address in roomba device info when available (#50437)

pull/50445/head
J. Nick Koston 2021-05-11 00:06:29 -05:00 committed by GitHub
parent b36c840909
commit d4cdb8e7e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@ from homeassistant.components.vacuum import (
SUPPORT_STOP,
StateVacuumEntity,
)
import homeassistant.helpers.device_registry as dr
from homeassistant.helpers.entity import Entity
from . import roomba_reported_state
@ -92,13 +93,18 @@ class IRobotEntity(Entity):
@property
def device_info(self):
"""Return the device info of the vacuum cleaner."""
return {
info = {
"identifiers": {(DOMAIN, self.robot_unique_id)},
"manufacturer": "iRobot",
"name": str(self._name),
"sw_version": self._version,
"model": self._sku,
}
if mac_address := self.vacuum_state.get("hwPartsRev", {}).get(
"wlan0HwAddr", self.vacuum_state.get("mac")
):
info["connections"] = {(dr.CONNECTION_NETWORK_MAC, mac_address)}
return info
@property
def _battery_level(self):