mirror of
https://github.com/sudoxnym/roomba_rest980.git
synced 2026-04-14 11:37:46 +00:00
update
This commit is contained in:
parent
44c2a2391d
commit
14c44e6680
2 changed files with 35 additions and 38 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue