Commit Graph

18 Commits (3b14d9f3754ae3e31b1a3698a06b58b7498502d2)

Author SHA1 Message Date
jjlawren 88441d5f68 Reduce connection timeout to avoid config flow timeouts (#29172) 2019-11-27 14:14:01 -08:00
Ville Skyttä 99c7608fb4 Lint config cleanups (#28864)
* Remove bunch of unneeded lint exclusions

* Use symbolic names instead of identifiers in pylint disables

* Tighten scope of some pylint disables
2019-11-25 22:40:08 -08:00
jjlawren 206547a5d8 Skip updating idle Plex clients (#28664)
* Skip updating idle clients

* Different operators
2019-11-10 11:35:12 +01:00
jjlawren ef687a36ff
Add Plex debug logging (#28665) 2019-11-09 17:02:56 -06:00
jjlawren 21d48218aa Use server-specific unique_ids for Plex media_players (#28447) 2019-11-01 22:41:26 +01:00
jjlawren 43c7b57d1e Update Plex via websockets (#28158)
* Save client identifier from auth for future use

* Use websocket events to update Plex

* Handle websocket disconnections

* Use aiohttp, shut down socket cleanly

* Bad rebase fix

* Don't connect websocket during config_flow validation, fix tests

* Move websocket handling to external library

* Close websocket session on HA stop

* Use external library, revert unnecessary test change

* Async & lint fixes

* Clean up websocket stopper on entry unload

* Setup websocket in component, pass actual needed object to library
2019-10-25 18:37:50 +02:00
jjlawren a644182b5e Save client identifier from Plex auth for future use (#27951)
* Save client identifier from auth for future use

* Bump requirements

* Stick with version 1
2019-10-22 23:32:57 -07:00
jjlawren d1fcc5762b Make dispatch signals unique per server (#28029) 2019-10-21 10:44:07 +02:00
jjlawren eeb1bfc6f5 Central update for Plex platforms (#27764)
* Update Plex platforms together

* Remove unnecessary methods

* Overhaul of Plex update logic

* Apply suggestions from code review

Use set instead of list

Co-Authored-By: Martin Hjelmare <marhje52@kth.se>

* Review suggestions and cleanup

* Fixes, remove sensor throttle

* Guarantee entity name, use common scheme

* Keep name stable once set
2019-10-19 23:31:15 +02:00
jjlawren 0888098718 Use URI provided by Plex for local connections (#27515)
* Use provided URI for local connections

* Use provided plexapi connection method

* Remove unused mock from tests

* Handle potential edge case(s)
2019-10-17 17:31:53 -07:00
jjlawren df8bf51598 Fix single Plex server case (#27326) 2019-10-08 08:54:01 -07:00
jjlawren 0915d927df Fix Plex media_player.play_media service (#27278)
* First attempt to fix play_media

* More changes to media playback

* Use playqueues, clean up play_media

* Use similar function name, add docstring
2019-10-06 21:02:58 -07:00
jjlawren 571ab5a978 Plex external config flow (#26936)
* Plex external auth config flow

* Update requirements_all

* Test dependency

* Bad await, delay variable

* Use hass aiohttp session, bump plexauth

* Bump requirements

* Bump library version again

* Use callback view instead of polling

* Update tests for callback view

* Reduce timeout with callback

* Review feedback

* F-string

* Wrap sync call

* Unused

* Revert unnecessary async wrap
2019-10-01 17:20:30 +02:00
jjlawren 9b204ad162 Add Plex config options support (#26870)
* Add config options support

* Actually copy dict

* Move media_player options to PlexServer class

* Handle updated config options

* Move callback out of server
2019-09-26 11:10:20 +02:00
jjlawren 2d12bac0e2 Add Plex config flow support (#26548)
* Add config flow support

* Log error on failed connection

* Review comments

* Unused errors

* Move form to step

* Use instance var instead of passing argument

* Only share servers created by component

* Return errors early to avoid try:else

* Separate debug for validation vs setup

* Unnecessary

* Unnecessary checks

* Combine import flows, move logic to component

* Use config entry discovery handler

* Temporary lint fix

* Filter out servers already configured

* Remove manual config flow

* Skip discovery if a config exists

* Swap conditional to reduce indenting

* Only discover when no configs created or creating

* Un-nest function

* Proper async use

* Move legacy file import to discovery

* Fix, bad else

* Separate validate step

* Unused without manual setup step

* Async oops

* First attempt at tests

* Test cleanup

* Full test coverage for config_flow, enable tests

* Lint

* Fix lint vs black

* Add test init

* Add test package requirement

* Actually run script

* Use 'not None' convention

* Group exceptions by result

* Improve logic, add new error and test

* Test cleanup

* Add more asserts
2019-09-19 23:29:26 +02:00
jjlawren 6eeb01edc4 Remove default host for Plex config (#26583)
* Remove default host, allow config with token(+server)

* Require one of host or token

* Oops

* Adjust schema

* Fix schema

* Add self as codeowner

* Update CODEOWNERS
2019-09-11 20:21:08 +02:00
jjlawren 30fb4ddc98 Move config and connections to Plex component (#26488)
* Move config and connections to component

* Separate imports

* Set a unique_id on sensor

* Set a platforms const

* Add SERVERS dict, hardcode to single server

* Move to debug

* Return false

* More debug

* Import at top to fix lint

* Guard against legacy setup attempts

* Refactor to add setup callback

* Review comments

* Log levels

* Return result of callback

* Store CONFIGURING in hass.data

* Set up discovery if no config data

* Use schema to set defaults

* Remove media_player options to remove entities

* Improve error handling
2019-09-09 23:28:20 +02:00
jjlawren 2cd845fb25 Standardize Plex server connections (#26444)
* Common connection class

* Omit tests for new Plex files

* Oops

* Add missing properties

* Remove redundant log message

* Stopgap to avoid duplicate setups

* Cleaner check for server setup

Co-Authored-By: Martin Hjelmare <marhje52@kth.se>

* Cleaner check for server setup

Co-Authored-By: Martin Hjelmare <marhje52@kth.se>

* Not needed with previous setup check

* Remove username/password support

* Reduce log level

Co-Authored-By: Martin Hjelmare <marhje52@kth.se>

* Don't do setup in __init__

* Oops

* Committing too fast...

* Connect after init

* Catch update exceptions like media_player

* Pass in validated PlexServer instance

* Remove unnecessary check

* Counter should be unknown on init

* Remove servername config option
2019-09-05 19:50:26 +02:00