diff --git a/libdyson/__init__.py b/libdyson/__init__.py index 1618ff4..6dda875 100644 --- a/libdyson/__init__.py +++ b/libdyson/__init__.py @@ -4,6 +4,7 @@ from .const import ( DEVICE_TYPE_360_EYE, DEVICE_TYPE_360_HEURIST, + DEVICE_TYPE_360_VIS_NAV, DEVICE_TYPE_PURE_COOL, DEVICE_TYPE_PURIFIER_COOL_E, DEVICE_TYPE_PURIFIER_COOL_K, @@ -32,6 +33,7 @@ from .discovery import DysonDiscovery # noqa: F401 from .dyson_360_eye import Dyson360Eye from .dyson_360_heurist import Dyson360Heurist +from .dyson_360_vis_nav import Dyson360VisNav from .dyson_device import DysonDevice from .dyson_pure_cool import DysonPureCool from .dyson_pure_cool_link import DysonPureCoolLink @@ -48,6 +50,8 @@ def get_device(serial: str, credential: str, device_type: str) -> Optional[Dyson return Dyson360Eye(serial, credential) if device_type == DEVICE_TYPE_360_HEURIST: return Dyson360Heurist(serial, credential) + if device_type == DEVICE_TYPE_360_VIS_NAV: + return Dyson360VisNav(serial, credential) if device_type in [ DEVICE_TYPE_PURE_COOL_LINK_DESK, DEVICE_TYPE_PURE_COOL_LINK, diff --git a/libdyson/cloud/account.py b/libdyson/cloud/account.py index 1def0d8..4ce3378 100644 --- a/libdyson/cloud/account.py +++ b/libdyson/cloud/account.py @@ -35,6 +35,7 @@ FILE_PATH = pathlib.Path(__file__).parent.absolute() + class HTTPBearerAuth(AuthBase): """Attaches HTTP Bearder Authentication to the given Request object.""" @@ -202,7 +203,7 @@ def devices(self) -> List[DysonDeviceInfo]: devices = [] response = self.request("GET", API_PATH_DEVICES) for raw in response.json(): - if not raw.get("LocalCredentials"): + if raw.get("LocalCredentials") is None: # Lightcycle lights don't have LocalCredentials. # They're not supported so just skip. # See https://github.com/shenxn/libdyson/issues/2 for more info diff --git a/libdyson/const.py b/libdyson/const.py index 2597888..534d925 100644 --- a/libdyson/const.py +++ b/libdyson/const.py @@ -3,6 +3,7 @@ DEVICE_TYPE_360_EYE = "N223" DEVICE_TYPE_360_HEURIST = "276" +DEVICE_TYPE_360_VIS_NAV = "277" DEVICE_TYPE_PURE_COOL_LINK_DESK = "469" # DP01? DP02? This one's a bit older, and scraping the Dyson website is unclear DEVICE_TYPE_PURE_COOL_DESK = "520" # AM06? This one's also a bit older, and also hard to scrape off the Dyson website DEVICE_TYPE_PURE_COOL_LINK = "475" # TP02 diff --git a/libdyson/dyson_360_vis_nav.py b/libdyson/dyson_360_vis_nav.py new file mode 100644 index 0000000..f2e3b30 --- /dev/null +++ b/libdyson/dyson_360_vis_nav.py @@ -0,0 +1,13 @@ +"""Dyson 360 Vis Nav vacuum robot.""" + +from .const import DEVICE_TYPE_360_VIS_NAV +from .dyson_360_heurist import Dyson360Heurist + + +class Dyson360VisNav(Dyson360Heurist): + """Dyson 360 Vis Nav device.""" + + @property + def device_type(self) -> str: + """Return the device type.""" + return DEVICE_TYPE_360_VIS_NAV diff --git a/setup.cfg b/setup.cfg index bf24216..6b148bd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = libdyson-neon -version = 1.3.0 +version = 1.4.0 author = The libdyson Working Group author_email = dotvezz@gmail.com license = MIT License diff --git a/tests/test_init.py b/tests/test_init.py index fa09cf3..ec81b5f 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -6,6 +6,7 @@ from libdyson import ( DEVICE_TYPE_360_EYE, DEVICE_TYPE_360_HEURIST, + DEVICE_TYPE_360_VIS_NAV, DEVICE_TYPE_PURE_COOL, DEVICE_TYPE_PURIFIER_COOL_E, DEVICE_TYPE_PURIFIER_COOL_K, @@ -22,6 +23,7 @@ DEVICE_TYPE_PURIFIER_BIG_QUIET, Dyson360Eye, Dyson360Heurist, + Dyson360VisNav, DysonDevice, DysonPureCool, DysonPureCoolLink, @@ -40,6 +42,7 @@ [ (DEVICE_TYPE_360_EYE, Dyson360Eye), (DEVICE_TYPE_360_HEURIST, Dyson360Heurist), + (DEVICE_TYPE_360_VIS_NAV, Dyson360VisNav), (DEVICE_TYPE_PURE_COOL_LINK_DESK, DysonPureCoolLink), (DEVICE_TYPE_PURE_COOL_LINK, DysonPureCoolLink), (DEVICE_TYPE_PURE_COOL, DysonPureCool),