diff --git a/custom_components/roomba_rest980/LegacyCompatibility.py b/custom_components/roomba_rest980/LegacyCompatibility.py index 42bb8ef..1a1184f 100644 --- a/custom_components/roomba_rest980/LegacyCompatibility.py +++ b/custom_components/roomba_rest980/LegacyCompatibility.py @@ -8,7 +8,9 @@ from .const import ( cycleMappings, errorMappings, jobInitiatorMappings, + mopRanks, notReadyMappings, + padMappings, phaseMappings, yesNoMappings, ) @@ -130,7 +132,7 @@ def createExtendedAttributes(self) -> dict[str, any]: else: robotCleanMode = "n-a" - return { + robotObject = { "extendedStatus": extv, "notready_msg": notReadyMappings.get(notReady, notReady), "error_msg": errorMappings.get(err, err), @@ -157,3 +159,27 @@ def createExtendedAttributes(self) -> dict[str, any]: "maint_due": False, "pmap0_id": pmap0id, } + + if data.get("padWetness"): + # It's a mop + # TODO: Make sure this works! I don't own a mop, so I'm just re-using what jeremywillans has written. + robotCleanMode = data.get("padWetness")["disposable"] + mopRankOverlap = data.get("rankOverlap") + detectedPad = data.get("detectedPad") + tankPresent = data.get("tankPresent") + lidOpen = data.get("lidOpen") + if mopRankOverlap: + robotObject["mop_behavior"] = mopRanks.get(mopRankOverlap, mopRankOverlap) + if detectedPad: + robotObject["pad"] = padMappings.get(detectedPad) + if tankPresent: + if notReady == 31: # Fill Tank + robotObject["tank"] = "Fill Tank" + elif not lidOpen: + robotObject["tank"] = "Ready" + elif lidOpen: + robotObject["tank"] = "Lid Open" + else: + robotObject["tank"] = "Tank Missing" + + return robotObject diff --git a/custom_components/roomba_rest980/const.py b/custom_components/roomba_rest980/const.py index b26519e..606d497 100644 --- a/custom_components/roomba_rest980/const.py +++ b/custom_components/roomba_rest980/const.py @@ -9,6 +9,7 @@ notReadyMappings = { 0: "n-a", 2: "Uneven Ground", 15: "Low Battery", + 31: "Fill Tank", 39: "Pending", 48: "Path Blocked", 68: "Updating Map", @@ -154,6 +155,16 @@ jobInitiatorMappings = { "none": "None", # Added for RoombaJobInitiator } +mopRanks = {25: "Extended", 67: "Standard", 85: "Deep"} + +padMappings = { + "reusableDry": "Dry", + "reusableWet": "Wet", + "dispDry": "Single Dry", + "dispWet": "Single Wet", + "invalid": "No Pad", +} + regionTypeMappings = { "default": "mdi:map-marker", "custom": "mdi:face-agent", diff --git a/custom_components/roomba_rest980/manifest.json b/custom_components/roomba_rest980/manifest.json index 3c24084..81cfe4d 100644 --- a/custom_components/roomba_rest980/manifest.json +++ b/custom_components/roomba_rest980/manifest.json @@ -31,7 +31,7 @@ "requirements": [ "aiofiles==24.1.0" ], - "version": "1.12.0", + "version": "1.13.0", "zeroconf": [ { "type": "_amzn-alexa._tcp.local.",