Skip to content

Add config flow to iCloud#28968

Merged
MartinHjelmare merged 15 commits into
home-assistant:devfrom
Quentame:icloud/config-flow
Dec 9, 2019
Merged

Add config flow to iCloud#28968
MartinHjelmare merged 15 commits into
home-assistant:devfrom
Quentame:icloud/config-flow

Conversation

@Quentame
Copy link
Copy Markdown
Member

@Quentame Quentame commented Nov 22, 2019

Breaking Change:

The iCloud component leaves the device_tracker platform to become an integration.

From:

device_tracker:
  - platform: icloud
    username: __email__
    password: __password__

To:

icloud:
  - username: __email__
    password: __password__

Here are all the services :
SERVICE_ICLOUD_PLAY_SOUND = "play_sound"
SERVICE_ICLOUD_DISPLAY_MESSAGE = "display_message"
SERVICE_ICLOUD_LOST_DEVICE = "lost_device"
SERVICE_ICLOUD_UPDATE = "update"

Some services are renamed :
'icloud_lost_device' --> 'lost_device'
'icloud_update' --> 'update'

'icloud_reset' is removed

The iCloud cookie folder moved from [HA_dir]/icloud to [HA_dir]/.storage/icloud.

Description:

Dramatically improve the iCloud integration addition UX with config flow, translated steps (will do),
and list selection while choosing the trusted device (instead of a number).

It also adds documentation to services, and will fix issues.

Following the draft PR #24053 and crowded PR #26590

PR doing :

  • add config flow + tests
  • fix existing services
  • add play_sound & display_message services
  • document services
  • can use devices with the same name
  • prepare to add sensor platform (battery for devices)

Related issue (if applicable):
fixes #13312
fixes #20195
fixes #28826

Pull request with documentation for home-assistant.io : home-assistant/home-assistant.io#11259

Example entry for configuration.yaml (if applicable):

icloud:
  - username: __email__
    password: __password__

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

Comment thread homeassistant/components/icloud/__init__.py Outdated
Comment thread homeassistant/components/icloud/__init__.py Outdated
Comment thread homeassistant/components/icloud/__init__.py
Comment thread homeassistant/components/icloud/config_flow.py Outdated
Comment thread homeassistant/components/icloud/config_flow.py Outdated
Comment thread homeassistant/components/icloud/config_flow.py Outdated
Comment thread homeassistant/components/icloud/config_flow.py Outdated
@balloob balloob mentioned this pull request Nov 26, 2019
4 tasks
Comment thread tests/components/icloud/test_config_flow.py Outdated
Comment thread tests/components/icloud/test_config_flow.py Outdated
@Quentame Quentame force-pushed the icloud/config-flow branch 4 times, most recently from 74c3fdd to 8df4d76 Compare December 2, 2019 21:45
@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 2, 2019

I've updated the description to follow the added breaking changes : the location of the iCloud cookie folder + the deletion of the reset service

@MartinHjelmare
Copy link
Copy Markdown
Member

Do the tests need updating to not do I/O?

@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 3, 2019

@MartinHjelmare : Yep, I'm working on it right now. Hope to make it work for 0.103.0 😄

@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 3, 2019

If you wanna help, I have this for now :

Capture d’écran 2019-12-02 à 23 17 53

Capture d’écran 2019-12-02 à 23 17 03

@MartinHjelmare
Copy link
Copy Markdown
Member

Why not patch the service class as we talked about above?

@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 3, 2019

Ok, just working in my computer, pushing

@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 3, 2019

@MartinHjelmare : What do you think of e2d040e ?

Comment thread tests/components/icloud/test_config_flow.py Outdated
Comment thread tests/components/icloud/test_config_flow.py Outdated
Comment thread tests/components/icloud/test_config_flow.py Outdated
@Quentame Quentame force-pushed the icloud/config-flow branch 4 times, most recently from 33ac49d to fc02053 Compare December 6, 2019 12:15
@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 9, 2019

What is the state of the PR now ?

Comment thread tests/components/icloud/test_config_flow.py Outdated
Comment thread tests/components/icloud/test_config_flow.py Outdated
Comment thread tests/components/icloud/test_config_flow.py Outdated
@MartinHjelmare
Copy link
Copy Markdown
Member

@Quentame
Copy link
Copy Markdown
Member Author

Quentame commented Dec 9, 2019

Got the 100% code coverage 😉

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good!

@MartinHjelmare MartinHjelmare merged commit c804f8f into home-assistant:dev Dec 9, 2019
@Quentame Quentame deleted the icloud/config-flow branch December 9, 2019 16:33
@Quentame Quentame mentioned this pull request Dec 10, 2019
8 tasks
@lock lock Bot locked and limited conversation to collaborators Dec 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

4 participants