Skip to content

Commit

Permalink
Adds initial support for Dyson 360 Vis Nav
Browse files Browse the repository at this point in the history
  • Loading branch information
dotvezz committed Apr 1, 2024
1 parent 42ab726 commit d6733b1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libdyson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion libdyson/cloud/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

FILE_PATH = pathlib.Path(__file__).parent.absolute()


class HTTPBearerAuth(AuthBase):
"""Attaches HTTP Bearder Authentication to the given Request object."""

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libdyson/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions libdyson/dyson_360_vis_nav.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = libdyson-neon
version = 1.3.0
version = 1.4.0
author = The libdyson Working Group
author_email = [email protected]
license = MIT License
Expand Down
3 changes: 3 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,6 +23,7 @@
DEVICE_TYPE_PURIFIER_BIG_QUIET,
Dyson360Eye,
Dyson360Heurist,
Dyson360VisNav,
DysonDevice,
DysonPureCool,
DysonPureCoolLink,
Expand All @@ -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),
Expand Down

0 comments on commit d6733b1

Please sign in to comment.