Skip to content

Commit

Permalink
Add more supported models (#1275)
Browse files Browse the repository at this point in the history
* airpurifier_miot: add zhimi.airp.mb4a

* Add roborock t6 (roborock.vacuum.t6)

* Add viomi.vacuum.v10 to viomi

* Add Roborock T7 (roborock.vacuum.a11)
  • Loading branch information
rytilahti committed Jan 4, 2022
1 parent fd98051 commit fb3191b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
7 changes: 6 additions & 1 deletion miio/airpurifier_miot.py
Expand Up @@ -16,6 +16,11 @@
"zhimi.airpurifier.vb2", # airpurifier proh
]

SUPPORTED_MODELS_MB4 = [
"zhimi.airpurifier.mb4", # airpurifier 3c
"zhimi.airp.mb4a", # airpurifier 3c
]

_LOGGER = logging.getLogger(__name__)
_MAPPING = {
# Air Purifier (siid=2)
Expand Down Expand Up @@ -468,7 +473,7 @@ class AirPurifierMB4(BasicAirPurifierMiot):
"""Main class representing the air purifier which uses MIoT protocol."""

mapping = _MODEL_AIRPURIFIER_MB4
_supported_models = ["zhimi.airpurifier.mb4"] # airpurifier 3c
_supported_models = SUPPORTED_MODELS_MB4

@command(
default_output=format_output(
Expand Down
23 changes: 21 additions & 2 deletions miio/integrations/vacuum/roborock/vacuum.py
Expand Up @@ -137,7 +137,9 @@ class CarpetCleaningMode(enum.Enum):
ROCKROBO_S5 = "roborock.vacuum.s5"
ROCKROBO_S5_MAX = "roborock.vacuum.s5e"
ROCKROBO_S6 = "roborock.vacuum.s6"
ROCKROBO_T6 = "roborock.vacuum.t6" # cn s6
ROCKROBO_S6_PURE = "roborock.vacuum.a08"
ROCKROBO_T7 = "roborock.vacuum.a11" # cn s7
ROCKROBO_T7S = "roborock.vacuum.a14"
ROCKROBO_S7 = "roborock.vacuum.a15"
ROCKROBO_S6_MAXV = "roborock.vacuum.a10"
Expand All @@ -151,7 +153,9 @@ class CarpetCleaningMode(enum.Enum):
ROCKROBO_S5,
ROCKROBO_S5_MAX,
ROCKROBO_S6,
ROCKROBO_T6,
ROCKROBO_S6_PURE,
ROCKROBO_T7,
ROCKROBO_T7S,
ROCKROBO_S7,
ROCKROBO_S6_MAXV,
Expand All @@ -172,7 +176,7 @@ def __init__(
start_id: int = 0,
debug: int = 0,
*,
model=None
model=None,
):
super().__init__(ip, token, start_id, debug, model=model)
self.manual_seqnum = -1
Expand Down Expand Up @@ -223,12 +227,27 @@ def _fetch_info(self) -> DeviceInfo:
return info
except (TypeError, DeviceInfoUnavailableException):
# cloud-blocked gen1 vacuums will not return proper payloads
def create_dummy_mac(addr):
"""Returns a dummy mac for a given IP address.
This squats the FF:FF:<first octet> OUI for a dummy mac presentation to
allow presenting a unique identifier for homeassistant.
"""
from ipaddress import ip_address

ip_to_mac = ":".join(
[f"{hex(x).replace('0x', ''):0>2}" for x in ip_address(addr).packed]
)
return f"FF:FF:{ip_to_mac}"

dummy_v1 = DeviceInfo(
{
"model": ROCKROBO_V1,
"token": self.token,
"netif": {"localIp": self.ip},
"fw_ver": "1.0_dummy",
"mac": create_dummy_mac(self.ip),
"fw_ver": "1.0_nocloud",
"hw_ver": "1st gen non-cloud hw",
}
)

Expand Down
2 changes: 1 addition & 1 deletion miio/integrations/vacuum/viomi/viomivacuum.py
Expand Up @@ -62,7 +62,7 @@

_LOGGER = logging.getLogger(__name__)

SUPPORTED_MODELS = ["viomi.vacuum.v7", "viomi.vacuum.v8"]
SUPPORTED_MODELS = ["viomi.vacuum.v7", "viomi.vacuum.v8", "viomi.vacuum.v10"]

ERROR_CODES = {
0: "Sleeping and not charging",
Expand Down

0 comments on commit fb3191b

Please sign in to comment.