Skip to content

Convert Plex to config flow#26157

Closed
jjlawren wants to merge 59 commits into
home-assistant:devfrom
jjlawren:plex_config_flow
Closed

Convert Plex to config flow#26157
jjlawren wants to merge 59 commits into
home-assistant:devfrom
jjlawren:plex_config_flow

Conversation

@jjlawren
Copy link
Copy Markdown
Contributor

@jjlawren jjlawren commented Aug 23, 2019

Description:

Primary changes:

  • Uses config flow
  • Uses config options
  • Validates configs before adding
  • Removes legacy configurator setup
  • Imports existing media_player settings (configuration and plex.conf)
  • Imports existing sensor configuration
  • Shares Plex credentials and connections between media_player and sensor
  • Enable one or both media_player and sensor per integration
  • Uses discovery to set defaults for config flow
  • Allows to configure multiple Plex servers
  • Allows interactive selection of server if multiple servers associated with an account
  • Removes password-based logins:
    • Security reasons
    • Future plan to add external authentication where password can be used again

Related issue (if applicable): fixes #18113 #22973

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10238

Example entry for configuration.yaml (if applicable):

Legacy configurations from both platforms are accepted and imported to a config entry with exception of username, password, and name options on sensor platform. They can remain in the configuration but are ignored.

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.

Comment thread homeassistant/components/plex/config_flow.py Outdated
Comment thread homeassistant/components/plex/config_flow.py
Comment thread homeassistant/components/plex/config_flow.py
@jjlawren jjlawren changed the title Convert Plex to config flow WIP: Convert Plex to config flow Aug 24, 2019
@jjlawren
Copy link
Copy Markdown
Contributor Author

I've just discovered that tokens can be used to authenticate a Plex account by themselves with no need to also supply the username. Will be refactoring to (hopefully) simplify things a bit.

@jjlawren jjlawren changed the title WIP: Convert Plex to config flow Convert Plex to config flow Aug 26, 2019
@Hellowlol
Copy link
Copy Markdown
Contributor

Hellowlol commented Aug 27, 2019

While your at it i think you should reconsider the entire login method. Plex support oauth so we could skip the username, password etc. and just pass the authtoken that we get from plex to the MyPlexAccount() from there we could create a list of servers that the user can pick.

@jjlawren
Copy link
Copy Markdown
Contributor Author

@Hellowlol That's already planned for a followup PR, but I need to get the config flow/entry in place first.

@jjlawren jjlawren changed the title Convert Plex to config flow WIP: Convert Plex to config flow Aug 27, 2019
@jjlawren
Copy link
Copy Markdown
Contributor Author

Back to WIP shortly. I've thought of a better way to cache the connection URLs instead of hitting the Plex endpoints on every startup. Should make it more reliable if internet connectivity isn't available and servers are local. Should also make the stored config far more consistent.

@jjlawren jjlawren changed the title WIP: Convert Plex to config flow Convert Plex to config flow Aug 28, 2019
@jjlawren
Copy link
Copy Markdown
Contributor Author

I believe this is ready for review. Docs have also been updated.

A PR to automate obtaining external authorization is also ready after this is merged.

@jjlawren
Copy link
Copy Markdown
Contributor Author

Closing in favor of #26548.

@jjlawren jjlawren closed this Sep 10, 2019
@lock lock Bot locked and limited conversation to collaborators Sep 11, 2019
@jjlawren jjlawren deleted the plex_config_flow branch October 26, 2019 14:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

media_player.plex initializes 2 times

7 participants