Try various consumables codes rather than just relying on fixed series ones
This commit is contained in:
parent
0874e359d4
commit
3625657886
|
|
@ -98,8 +98,7 @@ class TUYA_CODES(StrEnum):
|
||||||
AUTO_RETURN = "135"
|
AUTO_RETURN = "135"
|
||||||
DO_NOT_DISTURB = "107"
|
DO_NOT_DISTURB = "107"
|
||||||
BOOST_IQ = "118"
|
BOOST_IQ = "118"
|
||||||
G_CONSUMABLES = "142"
|
CONSUMABLES = ["142", "116"]
|
||||||
X_CONSUMABLES = "116"
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
|
|
@ -318,18 +317,16 @@ class RoboVacEntity(StateVacuumEntity):
|
||||||
# self.map_data = self.tuyastatus.get("121")
|
# self.map_data = self.tuyastatus.get("121")
|
||||||
# self.erro_msg? = self.tuyastatus.get("124")
|
# self.erro_msg? = self.tuyastatus.get("124")
|
||||||
if self.robovac_supported & RoboVacEntityFeature.CONSUMABLES:
|
if self.robovac_supported & RoboVacEntityFeature.CONSUMABLES:
|
||||||
robovac_series = self.vacuum.getRoboVacSeries()
|
for CONSUMABLE_CODE in TUYA_CODES.CONSUMABLES:
|
||||||
if (
|
if (
|
||||||
self.tuyastatus.get(TUYA_CODES["{}_CONSUMABLES".format(robovac_series)])
|
CONSUMABLE_CODE in self.tuyastatus
|
||||||
is not None
|
and self.tuyastatus.get(CONSUMABLE_CODE) is not None
|
||||||
):
|
):
|
||||||
self._attr_consumables = ast.literal_eval(
|
self._attr_consumables = ast.literal_eval(
|
||||||
base64.b64decode(
|
base64.b64decode(self.tuyastatus.get(CONSUMABLE_CODE)).decode(
|
||||||
self.tuyastatus.get(
|
"ascii"
|
||||||
TUYA_CODES["{}_CONSUMABLES".format(robovac_series)]
|
|
||||||
)
|
)
|
||||||
).decode("ascii")
|
)["consumable"]["duration"]
|
||||||
)["consumable"]["duration"]
|
|
||||||
|
|
||||||
async def async_locate(self, **kwargs):
|
async def async_locate(self, **kwargs):
|
||||||
"""Locate the vacuum cleaner."""
|
"""Locate the vacuum cleaner."""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue