From 14c44e66804b0b56ed152eb060c957d9d085eeec Mon Sep 17 00:00:00 2001 From: ia74 <68617740+ia74@users.noreply.github.com> Date: Sun, 20 Jul 2025 14:51:13 -0500 Subject: [PATCH] update --- .../roomba_rest980/LegacyCompatibility.py | 54 +++++++++---------- custom_components/roomba_rest980/vacuum.py | 19 +++---- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/custom_components/roomba_rest980/LegacyCompatibility.py b/custom_components/roomba_rest980/LegacyCompatibility.py index f596724..0640235 100644 --- a/custom_components/roomba_rest980/LegacyCompatibility.py +++ b/custom_components/roomba_rest980/LegacyCompatibility.py @@ -129,30 +129,30 @@ def createExtendedAttributes(self) -> dict[str, any]: robotCleanMode = "Auto" else: robotCleanMode = "n-a" - return [ - ("extendedStatus", extv), - ("notready_msg", notReadyMappings.get(notReady, notReady)), - ("error_msg", errorMappings.get(err, err)), - ("battery", f"{battery}%"), - ("software_ver", softwareVer), - ("phase", rPhase), - ("bin", binMappings.get(binFull, binFull)), - ("bin_present", yesNoMappings.get(binPresent, binPresent)), - ("clean_base", cleanBaseMappings.get(dockState, dockState)), - ("location", location), - ("rssi", rssi), - ("total_area", f"{round(sqft / 10.764 * 100)}m²"), - ("total_time", f"{hr}h {timeMin}m"), - ("total_jobs", numMissions), - ("dirt_events", numDirt), - ("evac_events", numEvacs), - ("job_initiator", jobInitiatorMappings.get(initiator, initiator)), - ("job_time", jobTime), - ("job_recharge", jobResumeTime), - ("job_expire", jobExpireTime), - ("clean_mode", robotCleanMode), - ("carpet_boost", robotCarpetBoost), - ("clean_edges", "true" if not data.get("openOnly", False) else "false"), - ("maint_due", False), - ("pmap0_id", pmap0id), - ] + return { + "extendedStatus": extv, + "notready_msg": notReadyMappings.get(notReady, notReady), + "error_msg": errorMappings.get(err, err), + "battery": f"{battery}%", + "software_ver": softwareVer, + "phase": rPhase, + "bin": binMappings.get(binFull, binFull), + "bin_present": yesNoMappings.get(binPresent, binPresent), + "clean_base": cleanBaseMappings.get(dockState, dockState), + "location": location, + "rssi": rssi, + "total_area": f"{round(sqft / 10.764 * 100)}m²", + "total_time": f"{hr}h {timeMin}m", + "total_jobs": numMissions, + "dirt_events": numDirt, + "evac_events": numEvacs, + "job_initiator": jobInitiatorMappings.get(initiator, initiator), + "job_time": jobTime, + "job_recharge": jobResumeTime, + "job_expire": jobExpireTime, + "clean_mode": robotCleanMode, + "carpet_boost": robotCarpetBoost, + "clean_edges": "true" if not data.get("openOnly", False) else "false", + "maint_due": False, + "pmap0_id": pmap0id, + } diff --git a/custom_components/roomba_rest980/vacuum.py b/custom_components/roomba_rest980/vacuum.py index 93d0883..77059fa 100644 --- a/custom_components/roomba_rest980/vacuum.py +++ b/custom_components/roomba_rest980/vacuum.py @@ -54,17 +54,6 @@ class RoombaVacuum(CoordinatorEntity, StateVacuumEntity): "manufacturer": "iRobot", } - @property - def device_info(self): - data = self.coordinator.data or {} - return { - "identifiers": self._attr_device_info.get("identifiers"), - "name": self._attr_device_info.get("name"), - "manufacturer": self._attr_device_info.get("manufacturer"), - "model": f"Roomba {data.get('sku')}", - "sw_version": data.get("softwareVer"), - } - def _handle_coordinator_update(self): """Update all attributes.""" data = self.coordinator.data or {} @@ -85,6 +74,14 @@ class RoombaVacuum(CoordinatorEntity, StateVacuumEntity): self._attr_available = data != {} self._attr_battery_level = data.get("batPct", 0) self._attr_extra_state_attributes = createExtendedAttributes(self) + self._attr_device_info = { + "identifiers": self._attr_device_info.get("identifiers"), + "name": self._attr_device_info.get("name"), + "manufacturer": self._attr_device_info.get("manufacturer"), + "model": f"Roomba {data.get('sku')}", + "sw_version": data.get("softwareVer"), + } + self._async_write_ha_state() async def async_clean_spot(self, **kwargs): """Spot clean."""