Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zone support for Dyson 360 Heurist #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pfrybar
Copy link

@pfrybar pfrybar commented May 21, 2021

This PR adds support for zones to the Dyson 360 Heurist - #8

Zones are defined in the Dyson Link app and (unfortunately) stored on Dyson servers. You need to call the Dyson API to get a PersistentMap. Then to tell the Heurist to clean a specific zone, you must pass in the id and last updated date of the map, along with the zone ids to be cleaned. This is made easier by the start_zones method which allows you to specify zones by name.

Example:

auth_info = {...}   # setup with proper auth config
heurist_cloud = DysonCloud360Heurist(account=account, serial='XXX-YY-ZZZZZZZZ')
map = heurist_cloud.get_persistent_maps()[0]

heurist = Dyson360Heurist(serial='XXX-YY-ZZZZZZZZ', credential='...')
heurist.connect('1.2.3.4')
heurist.start_zones(map, ['Bedroom', 'Hallway', 'Kitchen'])

I tested this with my Heurist and it works. To see if I could clean a zone without internet, I disabled my internet but left Wifi turned on and opened the Dyson Link app. I could start a full clean but everything related to Zones were disabled. I could not see, edit, or clean any zones. I snooped the MQTT messages to see if the map data is passed anywhere, but unfortunately it is not. This will make integration with HA more difficult.

@codecov
Copy link

codecov bot commented May 22, 2021

Codecov Report

Merging #10 (7f8b838) into main (35d00dd) will decrease coverage by 1.12%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
- Coverage   97.65%   96.53%   -1.13%     
==========================================
  Files          21       22       +1     
  Lines         940      981      +41     
==========================================
+ Hits          918      947      +29     
- Misses         22       34      +12     
Impacted Files Coverage Δ
libdyson/dyson_360_heurist.py 82.22% <33.33%> (-17.78%) ⬇️
libdyson/cloud/cloud_360_heurist.py 85.71% <85.71%> (ø)
libdyson/utils.py 48.14% <100.00%> (+4.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35d00dd...7f8b838. Read the comment docs.

Copy link
Owner

@shenxn shenxn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Looks good in general. Can you also write some tests?

@@ -3,3 +3,4 @@ cryptography>=3.1
requests
zeroconf
attrs
python-dateutil
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this to setup.py as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants