Commit Graph

1115 Commits (a99135a09e6ddfd2d9c05b0f9aa8e67c841a0ee4)

Author SHA1 Message Date
apetrycki cd0da4ed0e Fix mpd shuffle/random status (#19308)
* Fix shuffle/random status

MPD always shows true for shuffle.  For some reason casting the 0 or 1 as a boolean does not work.  Now returns 'true' or 'false' based on the value of 'random'.

* Update homeassistant/components/media_player/mpd.py

Change to correct way of returning shuffle boolean. 'random' needs to be cast as an integer before being cast as a boolean.

Co-Authored-By: apetrycki <34962392+apetrycki@users.noreply.github.com>

* Remove incorrect string code

Original fix method returns a string instead of a boolean.  Removed in favor of MartinHjelmare's method.
2018-12-27 00:04:40 -08:00
Steven Looman 501b3f9927 Disable creating port mappings from UI, add discovery from component (#18565)
* Disable creating port mappings from UI, add discovery from component

* Remove unused constant

* Upgrade to async_upnp_client==0.13.6 and use manufacturer from device

* Upgrade to async_upnp_client==0.13.7
2018-12-21 17:25:23 +00:00
John Mihalic f2c7e3fed4 Bump pyEmby to 1.6, add channel media type mapping (#19318) 2018-12-17 19:16:32 -05:00
MaxG88 f95bd9c78f Set unavailable when unreachable (#19012)
* Turn GPMDP Off When Unavailable

* Update requirements_all.txt

* Specified Exception Type

* Update gpmdp.py
2018-12-14 13:14:32 +01:00
Sander Geerts 0fa7186296 Support for the Harman Kardon AVR (#18471)
* Feature: support for the HK AVR

* Remove testcode

* Feature: support for the HK AVR

* Remove testcode

* Added checklist

* Review fixes whitespaces

* Lint fixes

* Review fixes, add current source

* Remove unused imports

* Review fixes; State constants, dict[key]

* More review fixes, Unknown state and Sources

* Review fix; rename devices to entities
2018-12-13 16:31:14 +01:00
Paulus Schoutsen 8ea0a8d40b
RFC: Deprecate auto target all for services and introduce entity_id: * (#19006)
* Deprecate auto target all

* Match on word 'all'
2018-12-13 10:07:59 +01:00
Teemu R 2fc0dfecb1 Convert songpal to use asynchronous websocket for state updates (#19129)
* Add websocket-based non-polling variant for songpal

* linting fixes

* changes based on Martin's feedback

* Fix linting

* add backoff timer for reconnects, fix variable naming (I thought that this wouldn't matter for internals..)

* Remove poll configuration variable

* bump the version just to be sure, the previous release lacked a version file (required for setup.py)
2018-12-12 23:05:55 +01:00
ehendrix23 8a62bc9237 Set directv unavailable state when errors returned for longer then a minute (#19014)
* Fix unavailable

Change setting to unavailable when getting request exceptions only after 1 minute has past since 1st occurrence.

* Put common code in _check_state_available

Put common code to determine if available should be set to False in method _check_state_available
2018-12-07 07:26:49 +01:00
Ville Skyttä 1be440a72b Upgrade pylint to 2.2.2 (#18750)
* Upgrade to 2.2.0

* simplifiable-if-expression fixes

* duplicate-string-formatting-argument fixes

* unused-import fixes

* Upgrade to 2.2.1

* Remove no longer needed disable

* Upgrade to 2.2.2
2018-12-06 11:54:44 +01:00
photinus 0aee355b14 Bump pyvizio version (#19048)
* Update vizio.py

Bump pyvizio version to reoslve get volume call and component setup failures

* Update of requirement_all
2018-12-05 16:00:49 -05:00
Jeff Irion 16e25f2039 Catch 'BrokenPipeError' exceptions for ADB commands (#19011) 2018-12-05 17:04:08 +01:00
Sébastien RAMAGE 3627de3e8a Change error to warning (#19035) 2018-12-05 15:58:46 +01:00
Oliver f3946cb54f Push to version 0.7.7 of denonavr (#18917) 2018-12-03 10:07:43 +01:00
Vladimir Eremin debae6ad2e Fix hdmi_cec entity race (#18753)
* Update shouldn't be called before adding the entity.
* Transitional states from
  8adc786bac/include/cectypes.h (L458-L459)

Addressing https://github.com/home-assistant/home-assistant/issues/12846
2018-12-02 15:51:04 +01:00
ehendrix23 ecca51b16b Add tests for directv platform (#18590)
* Create test for platform

Created test for platform.
Added media_stop to common.py test

* Multiple improvements

Fixed lint issue in common.py
Fixed lint issues in test_directv.py
Improved patching import using modile_patcher.start() and stop()
Added asserts for service calls.

* Updates based on Martin's review

Updates based on Martin's review.

* Updated test based on PR#18474

Updated test to use service play_media instead of select_source based on change from PR18474

* Lint issues

Lint issues

* Further updates based on feedback

Updates based on feedback provided.

* Using async_load_platform for discovery test

Using async_load_platform for discovery tests.
Added asserts to ensure entities are created with correct names.

* Used HASS event_loop to setup component

Use HASS event_loop to setup the component async.

* Updated to use state machine for # entities

Updated to use state machine to count # entities instead of entities.

* Use hass.loop instead of getting current loop

Small update to use hass.loop instead, thanks Martin!

* Forgot to remove asyncio

Removed asyncio import.

* Added fixtures

Added fixtures.

* Remove not needed updates and assertions

* Return mocked dtv instance from side_effect

* Fix return correct fixture instance

* Clean up assertions

* Fix remaining patches

* Mock time when setting up component in fixture

* Patch time correctly

* Attribute _last_update should return utcnow
2018-12-01 10:28:27 +01:00
Eric Nagley e50a6ef8af Add support for Mode trait in Google Assistant. (#18772)
* Add support for Mode trait in Google Assistant.

* Simplify supported logic.

* Fix SUPPORTED_MODE_SETTINGS to correct rip failures.

* more stray commas

* update tests.
2018-11-29 21:14:17 +01:00
Jonathan McDowell 1e3930a447 Add support for Panasonic Blu-Ray players (#18541)
* Add support for Panasonic Blu-Ray players

* Update panasonic_bluray.py

* Update panasonic_bluray.py
2018-11-21 14:22:24 +01:00
ehendrix23 377730a37c Change channel with play_media instead of select_source (#18474)
* Use service play_media instead of select_source

Use service play_media instead of select_source to change the channel as play_media is the right service for that.

* Log error on invalid media type

Log an error instead of raising a NotImplementedError if an invalid media type is provided.

* Changed so that success is not in else statement

Updated so that if media_type is channel that it is not in the else of an if.

* Update directv.py

Removed SELECT_SOURCE as supported feature.

* Rebased

Re-based with dev
2018-11-20 16:05:25 -07:00
dapowers87 d88040eeed Revert changes that broke UI (#18495)
* Revert changes that broke UI

* Change from UNKNOWN to None

* Remove STATE_UNKNOWN import
2018-11-20 13:29:05 +01:00
bw3 90f3f2b1e7 Fix for epson state not updating (#18357)
* Fixed update method name

* Update epson.py
2018-11-19 13:47:52 +01:00
ehendrix23 cdcc818bf9 Remove turn_on and turn_off feature for clients (#18234)
* Enhancements for DirecTV media player

Following enhancements have been made:

1. Added debug logging
2. Added ability to change channel using select_source service of the remote platform.
3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
4. Added the following attributes:
    a. media_position: current position of the media (in seconds)
    b. media_position_updated_at: timestamp when media_position was updated.
   c. source: current source (channel).
   d. media_isbeingrecorded: if current media is being recorded or not.
   e. media_rating: TV/Movie rating of the media
   f. media_recorded: if current media is recorded or live TV
   g. media_starttime: Timestamp media was aired

Reordered properties to follow same order as how they are in __init__.py of remote platform.

* Fixed error and cleaned up few items

Fixed an issue when determining if a program is recorded or not.
Cleaned up some coding.

* Added available property

Added available property

* Disable feature TURN_ON and TURN_OFF for DVR clients

Disable the feature turn_on and turn_off for DVR clients.

* self._is_client and raise NotImplementedError

Updated setting self._is_client
Raise NotImplementedError if turn_on or turn_off is called for clients.
2018-11-19 11:47:00 +01:00
Jeff Irion ab8c127a4a Enable native support + ADB authentication for Fire TV (#17767)
* Enable native support + ADB authentication for Fire TV

* Remove unnecessary underscore assignments

* Bump firetv to 1.0.5.3

* Change requirements to 'firetv>=1.0.6'

* Change requirement from 'firetv>=1.0.6' to 'firetv==1.0.6'

* Address pylint errors

* Ran 'python script/gen_requirements_all.py'

* Address some minor reviewer comments

* Run 'python script/gen_requirements_all.py'

* Just use the 'requirements_all.txt' and 'requirements_test_all.txt' from the 'dev' branch...

* Edit the 'requirements_all.txt' file manually

* Pass flake8 tests

* Pass pylint tests, add extended description for 'select_source'

* More precise exception catching

* More Pythonic returns

* Import exceptions inside '__init__'

* Remove 'time.sleep' command

* Sort the imports

* Use 'config[key]' instead of 'config.get(key)'

* Remove accessing of hidden attributes; bump firetv version to 1.0.7

* Bump firetv to 1.0.7 in 'requirements_all.txt'

* Don't access 'self.firetv._adb', use 'self.available' instead

* Remove '_host' and '_adbkey' attributes

* Create the 'FireTV' object in 'setup_platform' and check the connection before instantiating the entity

* Fixed config validation for 'adbkey'

* add_devices -> add_entities

* Remove 'pylint: disable=no-name-in-module'

* Don't assume the device is available after attempting to connect

* Update the state after reconnecting

* Modifications to 'adb_decorator'

* Modifications to 'setup_platform'

* Don't update the state if the ADB reconnect attempt was unsuccessful

* 'return None' -> 'return'

* Use 'threading.Lock()' instead of a boolean for 'adb_lock'

* Use a non-blocking 'threading.Lock'
2018-11-19 07:05:58 +01:00
Anders Melchiorsen c6ca27e9b4
Improve handling of unavailable Sonos speakers (#18534) 2018-11-17 13:18:51 +01:00
Leothlon afb3a52b5b Fixed bug for receivers without support for new command (#18478)
* Fixed bug for receivers without support for new command

* removed extra parenthesis
2018-11-15 10:49:10 -07:00
Steven Looman 9c92151ad1 Upgrade async_upnp_client to 0.13.2 (#18377) 2018-11-11 15:10:03 +00:00
Steven Looman d93716bd84 Add SUPPORT_SEEK for DLNA DMR devices + now (better) providing media_image_url for DLNA DMR devices (#18157)
* Upgrade to async_upnp_client==0.13.2, now (better) providing media_image_url for DLNA DMR devices

* Add SUPPORT_SEEK for DLNA DMR devices
2018-11-07 13:48:51 +01:00
4lloyd 114bc8ec18 Support eco mode option on Ziggo Mediabox XL (#17990)
* Added eco mode option to Ziggo Mediabox XL

* Changed eco_mode_on to eco_mode

* Removed eco_mode option, the player is unavailable when offline

* Timeout on connection, on/off states are handled via update

* Improved state detection and added available property
2018-11-06 13:14:52 +01:00
ehendrix23 561f6996c6 Duplicate entities on discovery (#18074)
* Enhancements for DirecTV media player

Following enhancements have been made:

1. Added debug logging
2. Added ability to change channel using select_source service of the remote platform.
3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
4. Added the following attributes:
    a. media_position: current position of the media (in seconds)
    b. media_position_updated_at: timestamp when media_position was updated.
   c. source: current source (channel).
   d. media_isbeingrecorded: if current media is being recorded or not.
   e. media_rating: TV/Movie rating of the media
   f. media_recorded: if current media is recorded or live TV
   g. media_starttime: Timestamp media was aired

Reordered properties to follow same order as how they are in __init__.py of remote platform.

* Fixed error and cleaned up few items

Fixed an issue when determining if a program is recorded or not.
Cleaned up some coding.

* Fix issue in checking if DTV device is already configured

If a DTV device was configured before, then discovery would add this device again seperately if the name specified in the configuration is different from the name on the DTV.

This issue is fixed now. Part of the fix also ensure to allow multiple "primary" devices on the network to be discovered.
Further also added debug logging to the setup_platform.

* Further improvements

Some additional improvements related to handling the DATA_DIRECTV in hass.data.

* Fixed flake8 issue

Fixed flake8 issue

* Added available property

Added available property

* Updated to use get_locations()

Replaced doing the request for getLocations with the get_locations() API from DirectPy instead.

* Fix for checking if device is available

Fix for checking if device is available and small update to debug log message.

* Fixed lint issue

Fixed lint issue with unused variable by adding ingore for it as this is for a enumerate

* Updated try/except and removed available

Updated tr/except having the except by the statement we're doing except on.
Removed available, will be a different PR.

* Updated known_devices to be tupples in a set

Updated known_devices to be a tupple in a set, removing loop to determine if client was already added.
2018-11-05 19:33:59 +01:00
vetegrodd b261c4b7f8 Activate kodi media player progress bar (#17626)
* Added code for progress bar

* Added doc string

* Using in

* More cleaning

* Only update position if needed.
2018-11-05 12:39:37 -05:00
ehendrix23 3d4ff74761 Add available property to DirecTV (#18168)
* Enhancements for DirecTV media player

Following enhancements have been made:

1. Added debug logging
2. Added ability to change channel using select_source service of the remote platform.
3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
4. Added the following attributes:
    a. media_position: current position of the media (in seconds)
    b. media_position_updated_at: timestamp when media_position was updated.
   c. source: current source (channel).
   d. media_isbeingrecorded: if current media is being recorded or not.
   e. media_rating: TV/Movie rating of the media
   f. media_recorded: if current media is recorded or live TV
   g. media_starttime: Timestamp media was aired

Reordered properties to follow same order as how they are in __init__.py of remote platform.

* Fixed error and cleaned up few items

Fixed an issue when determining if a program is recorded or not.
Cleaned up some coding.

* Fix issue in checking if DTV device is already configured

If a DTV device was configured before, then discovery would add this device again seperately if the name specified in the configuration is different from the name on the DTV.

This issue is fixed now. Part of the fix also ensure to allow multiple "primary" devices on the network to be discovered.
Further also added debug logging to the setup_platform.

* Further improvements

Some additional improvements related to handling the DATA_DIRECTV in hass.data.

* Fixed flake8 issue

Fixed flake8 issue

* Added available property

Added available property

* Updated to use get_locations()

Replaced doing the request for getLocations with the get_locations() API from DirectPy instead.

* Fix for checking if device is available

Fix for checking if device is available and small update to debug log message.

* Fixed lint issue

Fixed lint issue with unused variable by adding ingore for it as this is for a enumerate

* Updated try/except and removed available

Updated tr/except having the except by the statement we're doing except on.
Removed available, will be a different PR.

* Add available property

Add the available property to the entiry.
2018-11-05 16:19:03 +01:00
Leothlon 8613694544 Added service select_video_output and video_out attribute (#18081)
* Added service select_video_output and video_out attribute

* Fixed white lines and long lines

* Made line shorter

* Added period to comment according to flake8 rules

* Imported domain const

* Prefixed service with platform name

* changed "video output" to "hdmi output" to better reflect eiscp cammand

* video_output to hdmi_output rename
2018-11-02 11:07:36 +01:00
Ville Skyttä a4c0c34028 Use ssdp udn uuid as Samsung TV unique id (#18022) 2018-11-02 11:50:07 +02:00
Petro31 9b47af68ae Add surround programs to zone 2+ (#17445)
* Add surround programs to zone 2+

Add surround programs and surround program to any zone that supports it.

* Update yamaha.py

removed double fetching.
2018-11-01 21:26:53 +01:00
ehendrix23 deeb288daf Change source, add attributes, and improve state of DirecTV (#17536)
* Enhancements for DirecTV media player

Following enhancements have been made:

1. Added debug logging
2. Added ability to change channel using select_source service of the remote platform.
3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
4. Added the following attributes:
    a. media_position: current position of the media (in seconds)
    b. media_position_updated_at: timestamp when media_position was updated.
   c. source: current source (channel).
   d. media_isbeingrecorded: if current media is being recorded or not.
   e. media_rating: TV/Movie rating of the media
   f. media_recorded: if current media is recorded or live TV
   g. media_starttime: Timestamp media was aired

Reordered properties to follow same order as how they are in __init__.py of remote platform.

* Fixed error and cleaned up few items

Fixed an issue when determining if a program is recorded or not.
Cleaned up some coding.

* Attribute last position update only updated when position changed.

The attribute media_position_updated_at will only be updated if the position changed (thus media is playing for recorded or live TV).
Added assumed_state; will be set to False if in standby or when a recorded show is watched. For live TV it will be set to True.

* Added some empty lines for easier reading

Added some empty lines before returns to improve readability.

* Seperated words in constants

Seperated the words in constants.

* Fix _lastupdate to _last_update

Split words in _lastupdate to _last_update as I missed it.
2018-10-29 21:06:37 +01:00
Steven Looman 96c5e4c507 Fixes for upnp-component/#17753 and missing hass-data when only setup from config entry (#17868)
* Upgrade to async_upnp_client==0.13.0, fixing #17753

* Fix missing 'local_ip' when upnp-component itself is not setup, but ConfigEntry is
2018-10-29 08:10:01 +01:00
Nick Touran e343f5521c Upgrade gstreamer-player to 1.1.2 (#17568)
* Upgrade gstreamer-player to 1.1.2

* Updated requirements for gstreamer-player properly.
2018-10-19 18:11:47 +02:00
Steven Looman f7bc44955c Upgrade async_upnp_client to 0.12.7 (#17601) 2018-10-19 18:10:04 +02:00
Paulus Schoutsen 20fa6c5383
Update snapcast to 2.0.9 (#17573) 2018-10-18 11:06:32 +02:00
Matthew Garrett e2a1e21c8d Add support for LG soundbars (#17570)
* Add LG soundbar support

We can autodiscover these, so for now let's skip any local configuration.
Currently we expose volume, source and equaliser preset - we can expose the
other volume controls and options as well if necessary, but I don't know
whether it's worth it.

* Add discovery of LG devices

This is a generic discovery type that doesn't obviously contain enough
information to identify whether we're talking to a speaker system or any
other kind of device - on the other hand I haven't been able to find any
other LG devices that respond like this, so we can cross that bridge when
we get to it.

* Lint
2018-10-18 10:39:33 +02:00
Jorim Tielemans b50c93ccb7 Validate ports as a port (#17549)
* Validate ports as port

Better than just a positive integer since it limits the range from 1 to 65535.

* Validate port for Axis

* Validate port for Xiaomi Home Camera

* Validate port for Modbus

* Validate port for Yamaha MusicCast Receivers

* Update zhong_hong.py

Validate port as a port, the gateway address as positive_int
Also moved the default values to their variable

* Validate port for the Asterisk Voicemail interface

* Fix lint

* Validate port for Xiaomi Cameras
2018-10-17 23:09:05 +02:00
Eduard van Valkenburg 50a66abd80 Updated package to fix #16960 (#17555) 2018-10-17 22:56:54 +02:00
Steven Looman 7106d9e9d4 Upgrade async_upnp_client to 0.12.6 (#17560) 2018-10-17 22:56:21 +02:00
cgtobi e83a9aace4 Remove unnecessary call (#17514) 2018-10-17 10:53:05 +02:00
Ben Lebherz 764ea06795 Fix unhandled exception which creates many useless logs (#17508)
* Fix unhandled exception which creates many useless logs

* recover old component logic, sorry

* remove inline conditional
2018-10-16 16:41:38 +02:00
Dougal Matthews 6feacbbfe1 Include the name of the Volumio media player in errors (#17481)
When you have multiple Volumio media players it can be hard to determine
which one has a problem without this information.
2018-10-15 19:11:12 +02:00
kennedyshead 1cbb5b8e51 State is set to UNKNOWN rather than ON in order to make UI have an play/pause button (#17357) 2018-10-15 11:42:27 +02:00
Steven Looman e6d002c377 Update to async-upnp-client==0.12.5 (#17401) 2018-10-13 14:29:12 +02:00
kennedyshead e00ed84d84 The ping command will not detect device in standby as off (#17358) 2018-10-12 14:51:03 +02:00
Joshi ad4d5666fe Yamaha AVR update and change Sound Mode only on main_zone (#17241)
* Add support for sound_mode for Yamaha rxv media_player

* Catch ParseError Exeption on surround_program for unsupported models

* Catch all Exeptions from rxv

* only get sound mode list / current sound mode on main_zone
2018-10-10 14:07:33 +02:00
Ville Skyttä 707b7c202d Narrow scope of various pylint inline disables (#15364)
* Narrow scope of various pylint inline disables

* Whitespace tweaks
2018-10-10 12:17:11 +02:00
Alok Saboo 26f2e3dd8b Fix samsung bug (#17285) 2018-10-09 21:43:59 +02:00
definitio 6bf3f9e748 Fix mpd timeout error (#17254)
* Increase mpd client timeout

* Update mpd.py
2018-10-09 12:24:39 +02:00
Oliver 849665b9ca Pushed to version 0.7.6 of denonavr library to add more sound modes (#17227) 2018-10-08 09:32:14 +02:00
Ana Paula Gomes 02bf07d9df Add timeout and fix oscillations on Samsung TV component (#17102)
* Add timeout and fix oscillations

* Adjust code to py3.5.3

* Clean code
2018-10-04 16:02:14 +02:00
Martin Hjelmare 6a0c9a718e Fix sonos async use (#17099)
* Entry setup wasn't using the async api. Fix this by using correct
  async api.s
* Also use new async executor scheduler in async_added_to_hass.
2018-10-04 09:20:20 +02:00
Anders Melchiorsen 952a1b3513 Smaller steps for Sonos volume up/down (#17080) 2018-10-03 15:09:05 +02:00
Anders Melchiorsen a5402739b7 Keep the repeat mode when setting Sonos shuffle mode (#17083)
* Keep the repeat mode when setting Sonos shuffle mode

* Fix test
2018-10-03 14:50:13 +02:00
cdce8p 7f0a50ce31 async_create_task (#17059)
* async_create_task

* Update google.py
2018-10-02 11:03:09 +02:00
Anders Melchiorsen 4c36ffd0ef Remove error logging when Sonos shuffle_set is not available (#16921)
Error on set_shuffle with UPnP Error 712 received: Play mode not supported from 10.23.2.16
2018-10-01 17:58:04 +02:00
Paulus Schoutsen 2e6346ca43 Break up websocket 2 (#17028)
* Break up websocket 2

* Lint+Test

* Lintttt

* Rename
2018-10-01 16:09:31 +02:00
Paulus Schoutsen 22a80cf733
Break up websocket component (#17003)
* Break up websocket component

* Lint
2018-10-01 11:21:00 +02:00
cdce8p 134eeecd65 Async syntax 4/8 (#17018)
* Async syntax 4, media_player & notify

* Pylint fixes
2018-10-01 08:58:21 +02:00
Anders Melchiorsen 24e9c62fe7
Upgrade pysonos to 0.0.3 (#16901)
This version has downgraded/removed some logging that we then no
longer have to hide.
2018-09-27 01:09:30 +02:00
cdce8p dd45e99302 Remove service helper (4) (#16892)
* Update media_player

* Update lock

* Update notify

* Update remote

* Update scene

* Update vacuum

* Remove timer helpers

* Removed unused legacy helpers
2018-09-26 18:02:05 +02:00
Paulus Schoutsen e205092693
Revert incorrect check (#16883) 2018-09-26 10:15:49 +02:00
Robin Clarke 589554ad16 Allow soundtouch to play https content too (#16713) 2018-09-24 11:16:28 +02:00
Jason Hu 564ad7e22a Rework chromecast fix (#16804)
* Revert changes of #16471, and fix the platform setup issue

* Fix unit test

* Fix

* Fix comment

* Fix test

* Address review comment

* Address review comment
2018-09-23 23:35:07 +02:00
Anders Melchiorsen 78b6439ee6 Use pysonos for Sonos media player (#16753) 2018-09-20 23:50:11 +02:00
Jason Hu 3a45481b5b Handle chromecast CONNECTION_STATUS_DISCONNECTED event (#16732) 2018-09-20 10:48:45 +02:00
Jason Hu 308b7fb385 Add retry limit for chromecast connection (#16471) 2018-09-12 13:42:54 +02:00
Zoé Bőle 77026a2242 Increasing python-websockets' version number (#16578)
* increasing python-websockets' version number so now it works with python 3.7

* required version for websockets increased to work with Python 3.7

* script/gen_requirements_all.py is done
2018-09-12 12:44:14 +02:00
Ville Skyttä ee696643cd Isort preparations (#16555)
* Don't treat typing as an "in-between" module for import order

That was a < 3.5 era thing.

* Tighten scope of some pylint unused-import disables

To avoid isort moving a top level one around, undesirably broadening its
scope.
2018-09-11 11:21:48 +02:00
Fabian Affolter d2d715faa8
Upgrade wakeonlan to 1.1.6 (#16512) 2018-09-10 16:07:31 +02:00
Fabian Affolter 0d7ee9b93b
Order imports (#16515) 2018-09-09 14:26:06 +02:00
tadly d6d4ff6888 adds listener for OnAVStart and OnAVChange (#16495)
With Kodi 18, OnPlay is called before an item actually started playing.
For this OnAVStart and OnAVChange have been introduced.
2018-09-09 09:55:57 +02:00
Pawel 00cba29ae1 Support for playing radio preset by Onkyo media_player (#16258)
* Added support to play radio preset by play media

* Switch radio station by preset for Onkyo

* added SUPPORT_PLAY_MEDIA
2018-09-03 21:40:04 +02:00
Joshi 444df5b09a Add support for sound_mode for Yamaha rxv media_player (#16352) 2018-09-01 23:34:38 +02:00
Philipp Temminghoff 901cfef78e Support Sonos Beam HDMI input (#16340) 2018-09-01 16:02:38 +02:00
Teemu R 3cbf8e4f87 Bump songpal dependency (#16297)
Fixes #14936
2018-08-30 18:21:37 +02:00
Paulus Schoutsen 16a885824d
Add device info for sonos (#16263)
* Add device info for sonos

* Sets
2018-08-29 16:27:08 +02:00
Paulus Schoutsen 3934f7bf3a
Add device info to Chromecast (#16261) 2018-08-29 15:46:09 +02:00
Robert Svensson 63614a477a def device shouldnt call it self but self._device (#16255) 2018-08-29 10:07:32 +02:00
Robert Svensson 5341785aae Revert changes to platforms using self.device (#16209)
* Revert tank_utility

* Fix Soundtouch

* Fix Plex

* Fix Emby

* Fix Radiotherm

* Fix Juicenet

* Fix Qwikswitch

* Fix Xiaomi miio

* Fix Nest

* Fix Tellduslive

* Fix KNX
2018-08-26 21:25:39 +02:00
Robert Svensson 97173f495c Device registry store config entry (#16152)
* Allow device registry to optionally store config entries

* Connections and identifiers are now sets with tupels

* Make config entries mandatory

* Fix duplicate keys in test

* Rename device to device_info

* Entity platform should only create device entries if config_entry_id exists

* Fix Soundtouch tests

* Revert soundtouch to use self.device

* Fix baloobs comments

* Correct type in test
2018-08-25 10:59:28 +02:00
Paulus Schoutsen 994b829cb4
add_devices -> add_entities (#16171)
* add_devices -> add_entities

* Lint

* PyLint

* Revert external method in scsgate
2018-08-24 16:37:30 +02:00
Ville Skyttä dd9d53c83e Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0 (#14557)
* Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0

* Pydocstyle D401 fixes
2018-08-24 10:28:43 +02:00
Robert Svensson 0009be595c Device Registry (#15980)
* First draft

* Generate device id

* No obscure registry

* Dont store config_entry_id in device

* Storage

* Small mistake on rebase

* Do storage more like entity registry

* Improve device identification

* Add tests

* Remove deconz device support from PR

* Fix hound comments, voff!

* Fix comments and clean up

* Fix proper indentation

* Fix pydoc issues

* Fix mochad component to not use self.device

* Fix mochad light platform to not use self.device

* Fix TankUtilitySensor to not use self.device

* Fix Soundtouch to not use self.device

* Fix Plex to not use self.device

* Fix Emby to not use self.device

* Fix Heatmiser to not use self.device

* Fix Wemo lights to not use self.device

* Fix Lifx to not use self.device

* Fix Radiotherm to not use self.device

* Fix Juicenet to not use self.device

* Fix Qwikswitch to not use self.device

* Fix Xiaomi miio to not use self.device

* Fix Nest to not use self.device

* Fix Tellduslive to not use self.device

* Fix Knx to not use self.device

* Clean up a small mistake in soundtouch

* Fix comment from Ballob

* Fix bad indentation

* Fix indentatin

* Lint

* Remove unused variable

* Lint
2018-08-22 10:46:37 +02:00
Krasimir Zhelev ae5c4c7e13 Upgrade afsapi to 0.0.4, prevents aiohttp session close message, Fixes #13099 (#16098) 2018-08-21 15:30:40 +02:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Ed Marshall e782e2c0f3 Handle missing mpd capabilities (#15945)
* Handle missing mpd capabilities

It is possible to configure mpd without volume or playlist support.
Gracefully degrade when either of these features appears to be missing.

Resolves: #14459, #15927

* Use longer name for exception

* Only return support flags post-connection

* Small consistency fixes to mpd.py for review.
2018-08-18 09:54:23 +02:00
Steven Looman fa88d918b1 Upgrade to async_upnp_client==0.12.4 2018-08-17 21:29:31 +02:00
Anders Melchiorsen f2e399ccf3 Update SoCo to 0.16 (#16007) 2018-08-17 07:41:56 +02:00
Steven Looman 45452e510c Fix message "Updating dlna_dmr media_player took longer than ..." (#16005) 2018-08-16 22:42:11 +02:00
Paulus Schoutsen 1ff1639cef
More entity service (#15998)
* Camera use entity service

* Convert climate services

* Convert light

* Convert media player

* Migrate fan
2018-08-16 14:28:59 +02:00
Benoit Louy ef61c0c3a4 Add PJLink media player platform (#15083)
* add pjlink media player component

* retrieve pjlink device name from projector if name isn't specified in configuration

* update .coveragerc

* fix style

* add missing docstrings

* address PR comments from @MartinHjelmare

* fix code style

* use snake case string for source names

* add missing period at the end of comment string

* rewrite method as function

* revert to use source name provided by projector
2018-08-09 19:58:16 +02:00
Steven Looman 0ab65f1ac5 Follow changes to netdisco, separating DLNA into DLNA_DMS and DLNA_DMR (#15877)
* Follow changes to netdisco, separating DLNA into DLNA_DMS and DLNA_DMR

* No uppercase for names of netdisco discoverables
2018-08-08 11:54:22 +02:00
Steven Looman b152becbe0 Add media_player.dlna_dmr component (#14749)
* Add media_player.dlna_dmr component

* PEP 492

* Move DIDL-template up

* Remove max_volume-override option

* Remove picky_device support

* Use DEFAULT_NAME

* Make supported_features static

* Remove unneeded argument

* Proper module-docstring

* Add http dependency

* Remove additional_configuration options, no longer used

* Change default name to 'DLNA Digital Media Renderer'

* Use python-didl-lite for DIDL-Lite-xml construction/parsing

* Handle NOT_IMPLEMENTED for UPnP state variables RelativeTimePosition and CurrentMediaDuration

* Use UPnP-UDN for unique_id

* Proper handling of upnp events

* Keeping flake8 happy

* Update requirements_all.txt

* Make UDN optional

* Ensure NotifyView is started, before using it

* Only subscribe to services we're interested in

* Don't update state_variables if value has not been changed + minor refactoring

* Improve play_media, follow flow of DLNA more closely

* Hopefully fix ClientOSError problems

* Flake8 fixes

* Keep pylint happy

* Catch errors and report gracefully

* Update async_upnp_client to 0.11.0

* Don't be so noisy

* Define/use constants for HTTP status codes

* Add discovery entry for dlna_dmr

* More robustness with regard to state variable not being set (yet)

* Keep privates hidden

* Handle NOT_IMPLEMENTED for CurrentTrackMetaData state variable

* Fixes in async_upnp_client + renew UPnP subscriptions regularly

* Not too eager

* Refactor duplicate code to _current_transport_actions and improve parsing of actions

* Support RC:1 to RC:3 and AVT:1 to AVT:3

* Moved DLNA-specifics to async_upnp_client.dlna.DmrDevice

* Use our own HTTP server to listen for events.

* More clear and explicit log message for easier troubleshooting

* Follow changes by hass, fixes traceback

* Fix not being able to do next

* Changes after review by @MartinHjelmare

* Linting

* Use homeassistant.util.get_local_ip

* Moved upnp event handling to async_upnp_client

* Keeping pylint happy

* Changes after review by @MartinHjelmare
2018-08-05 14:41:18 +02:00
Diogo Gomes 48af5116b3 Update pymediaroom to 0.6.4 (#15786)
* Dependency version bump

* bump version
2018-08-02 20:13:48 +02:00
Teemu R 3208ad27ac Add kodi unique id based on discovery (#15093)
* kodi add unique id based on discovery

* initialize unique_id to None

* use netdisco-extracted mac_address

* use an uuid instead of mac for real uniqueness

* add missing docstring

* verify that there is no entity already for the given unique id

* whitespace fix
2018-07-30 17:09:38 +02:00
starkillerOG 48ba13bc6c Denonavr version push to 0.7.5 (#15743)
* Version push to 0.7.5

Improve logger warning

* Denonavr v.0.7.5
2018-07-29 15:42:23 -07:00
Jonathan Keljo a2b793c61b Add a component for Sisyphus Kinetic Art Tables (#14472)
* Add a component for Sisyphus Kinetic Art Tables

The [Sisyphus Kinetic Art Table](https://sisyphus-industries.com/) uses a
steel ball to draw intricate patterns in sand, thrown into sharp relief by a
ring of LED lights around the outside.

This component enables basic control of these tables through Home Assistant.

* Fix lints

* Docstrings, other lints

* More lints

* Yet more.

* Feedback

* Lint

* Missed one piece of feedback

* - Use async_added_to_hass in media player
- async_schedule_update_ha_state in listeners
- constants for supported features
- subscripting for required keys
- asyncio.wait
- update to sisyphus-control with passed-in session

* Update requirements

* lint
2018-07-29 07:34:43 +02:00
Ville Skyttä eee9b50b70 Upgrade pylint to 2.0.1 (#15683)
* Upgrade pylint to 2.0.1

* Pylint 2 bad-whitespace fix

* Pylint 2 possibly-unused-variable fixes

* Pylint 2 try-except-raise fixes

* Disable pylint fixme for todoist for now

https://github.com/PyCQA/pylint/pull/2320

* Disable pylint 2 useless-return for now

https://github.com/PyCQA/pylint/issues/2300

* Disable pylint 2 invalid-name for type variables for now

https://github.com/PyCQA/pylint/issues/1290

* Disable pylint 2 not-an-iterable for now

https://github.com/PyCQA/pylint/issues/2311

* Pylint 2 unsubscriptable-object workarounds

* Disable intentional pylint 2 assignment-from-nones

* Disable pylint 2 unsupported-membership-test apparent false positives

* Disable pylint 2 assignment-from-no-return apparent false positives

* Disable pylint 2 comparison-with-callable false positives

https://github.com/PyCQA/pylint/issues/2306
2018-07-26 08:55:42 +02:00
Anders Melchiorsen fddfb9e412 Refresh Sonos source list on changes (#15605) 2018-07-23 12:31:03 +02:00
Anders Melchiorsen 1325682d82 Use case insensitive comparison for Sonos model check (#15604) 2018-07-23 12:29:37 +02:00
Ville Skyttä b7c336a687 Pylint cleanups (#15626)
* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
2018-07-23 10:16:05 +02:00
Eugenio Panadero 9a8389060c fix aiohttp InvalidURL exception when fetching media player image (#15572)
* fix aiohttp InvalidURL exception when fetching media player image

The first call for the HA proxy (`/api/media_player_proxy/media_player.kodi?token=...&cache=...`)
is receiving relative urls that are failing, this is a simple fix to precede the base_url when hostname is None.

* fix import location and sort stdlib imports
2018-07-20 15:18:02 +02:00
Ville Skyttä 2f7b79764a More pylint 2 fixes (#15565)
## Description:

More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).

## Checklist:
  - [ ] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-20 11:45:20 +03:00
Ville Skyttä bf17ed0917 More pylint 2 fixes (#15516)
* Pylint 2 useless-import-alias fixes

* Pylint 2 chained-comparison fixes

* Pylint 2 consider-using-get fixes

* Pylint 2 len-as-condition fixes
2018-07-18 11:54:27 +02:00
Ville Skyttä e31dd4404e Pylint 2 fixes (#15487)
* pylint 2 inline disable syntax fixes

* pylint 2 logging-not-lazy fixes

* pylint 2 consider-using-in fixes

* Revert pylint 2 inline disable syntax fixes addressing unused-imports

Will have a go at removing more unused imports altogether first.
2018-07-17 19:34:29 +02:00
Philipp Schmitt fd568d77c7 Fix liveboxplaytv empty channel list (#15404) 2018-07-10 15:51:37 +02:00
Daniel Perna 6ee8d9bd65 Update ha-philipsjs to 0.0.5 (#15378)
* Update requirements_all.txt

* Update philips_js.py
2018-07-09 21:35:06 +02:00
starkillerOG b9eb0081cd Add sound mode support (#14910)
* Add sound mode support

* continuation line indent

* indentation

* indentation

* Remove option to configure sound_mode_dict

* Sound mode support

- removed the sound_mode_raw propertie because it was not used, (still available through self._sound_mode_raw (as device attribute for automations and diagnostics)

* Detect sound mode support from device

Removed the config option to indicate if sound mode is supported.
Added detection if sound mode is supported from the receiver itself.
Pushed denonavr library to V.0.7.4

* Pushed denonavr to v.0.7.4
2018-07-09 11:39:41 +02:00
Andrey 02238b6412 Add python 3.7 to travis and tox (#14523)
* Add python 3.7 to travis and tox

* Use pyyaml from github

* Don't version constraints

* Fix version tag

* Change to new pyyaml release

* Python 3.7 requires xenial

* Fix namespace detection

* Use correct RegEx type

* Update pexpect to 4.6

* Use correct validation for dictionaries

* Disable Py37 incompatible packages

* Upgrade all pexpect to 4.6

* Add explicit None as default param
2018-07-07 10:48:02 -04:00
Andrey 6c77702dcc
Switch to own packaged version of pylgnetcast (#15042)
## Description:

Switch to own packaged version of pylgnetcast

Request to make a pypi package didn't get any response: https://github.com/wokar/pylgnetcast/issues/1

**Related issue (if applicable):** #7069
2018-07-02 10:57:26 +03:00
Matt LeBrun 0094fd5c34 Add channel changing support to SamsungTV component (#14451)
Add channel changing support to SamsungTV component
2018-06-26 16:22:10 +02:00
Paulus Schoutsen 46ea28a4f8
Fix cast config (#15143) 2018-06-25 15:59:05 -04:00
Ville Skyttä b92350fb55 Lint cleanup (#15103)
* Remove unneeded inline pylint disables

* Remove unneeded noqa's

* Use symbol names instead of message ids in inline pylint disables
2018-06-25 13:05:07 -04:00
Jeff Irion 067e4f6d9a Show running apps as sources for Fire TV (#15033)
* Show running apps as sources for Fire TV

* Fix unnecessary 'else' after 'return' (no-else-return)

* Remove 'pylint: disable=unused-argument'

* cleanup
2018-06-18 18:13:50 +02:00
Jeff Irion 7bfa81c592 Improve volume support for Vizio Smartcast (#14981)
* Improve volume support for Vizio Smartcast

* Vizio: avoid an error when 'self._device.get_current_volume()' returns 'None'

* Improve volume support for Vizio Smartcast

* Vizio: avoid an error when 'self._device.get_current_volume()' returns 'None'

* First line should end with a period
2018-06-17 22:06:53 -06:00
Andrey e3fcf46566 Switch to own packaged version of braviarc (#15009) 2018-06-17 13:07:10 +02:00
Andrey 656eae288e Switch to own packaged version of spotipy (#14997) 2018-06-16 15:52:23 -04:00
Ville Skyttä 4bd7a7eee3 Remove inline pylint disables for messages disabled in pylintrc (#14978) 2018-06-16 00:15:46 +02:00
Paulus Schoutsen 2c6e6c2a6f
Add config entry for Sonos + Cast (#14955)
* Add config entry for Sonos

* Lint

* Use add_job

* Add Cast config entry

* Lint

* Rename DOMAIN import

* Mock pychromecast in test
2018-06-14 15:17:54 -04:00
Pawel 2ac23c8be6 Epson projector support (#14841)
* Epson projector support. Version based on external library

* Epson projector support. Version based on external library

* modified epson according to MartinHjelmare review.
Added description of cmode to services.yaml

* renamed EPSON_SCHEMA to epson_schema

* removed method of getting cmode property

* removed unnecessary checks
change name of cmode service

* renamed SERVICE_ATTR_CMODE to SERVICE_SELECT_CMODE
2018-06-13 07:28:59 +02:00
Ing. Jaroslav Šafka 89d008d1f3 Fix snapcast uuid to be more unique (#14925)
Current uuid is ok when using only 1 snapserver
New uuid is needed when using multiple snapserver

Because the client can connect to more snapservers and
then uuid based on client MAC is not enough
2018-06-12 15:46:53 +02:00
Ben Lebherz 1da30032a0 Add support for the Unitymedia Horizon HD Recorder (#14275)
* added new platform for the Unitymedia Horizon HD Recorder

* improve connection handling of the horizon platform

* remove unneeded parameters and fix spelling in the horizon platform

* abort or raise exception if connection to the device could not be established

* remove channel/source list and SELECT_SOURCE feature

* remove useless type check after cast and use a try block instead

* abort or raise exception if reconnect to device fails

* remove protocol specific code and restructure sending logic accordingly

* fix indentation to be pep8 complaint

* remove unused methods/properties

* fix unnecessary pylint commands and use a return to abert outside of setup_platform

* directly access config values
2018-06-10 15:38:55 +02:00
Dan Klaffenbach b4e5695bbd Bump to denonavr 0.7.3 (#14907)
Closes #14792

See #14794
2018-06-10 13:00:14 +02:00
Ing. Jaroslav Šafka 20caeb5383 Add entity registry support to media_player.snapcast (#14895)
Unique id for client is generated from prefix 'snapcast_client_'
and MAC address

Unique id for group is generated from prefix 'snapcast_group_'
and UUID provided by snapcast library
2018-06-10 08:31:42 +02:00
Ong Vairoj d7b7370c82 Samsung TV can't turn off after idle period (#14587)
When Samsung TV is idle for a period of time after issued a command,
subsequent 'turn_off' command won't turn off the TV. The issue is seen
in Samsung models with websocket as discussed in #12302.

== Reproducible Steps
1. Turn on TV (either via HA or directly).
2. Issue some commands e.g. volume ups / downs.
3. Wait for ~1 minute.
4. Issue turn_off command via HA. TV won't turn off.
5. Issue subsequent turn off commands won't turn off TV still.
6. However, issue some other commands e.g. volume ups / downs multiple
times in a row and then turn_off will turn off the TV.

== Root Cause
The underlying websocket connection opened by samsungctl get closed
after some idle time. There was no retry mechanism so issued commands
would intermittently fail but the subsequent one would succeed when
`_remote` get recreated. With `turn_off()`, however, there is an
additional call to `self.get_remote().close()` which indirectly caused
new connection to be created and then closed immediately. This causes the
component to stuck in failure mode when turn_off command is repeatly
issued.

== The Fix
Recreate the connection and retry the command if connection is closed
to avoid silent failures due to connection closed. Also set `_remote`
to None after calling close() to put it in correct state.

This fix eliminates intermittent command failure and failure mode in
turn_off().
2018-06-09 09:22:34 -04:00
Mal Curtis e3fba79126 Disable volume control for Onkyo when unavailable (Closes: #14774) (#14863) 2018-06-08 07:45:21 +02:00
Fabian Affolter 50321a29b5 Catch ConnectionError (fixes #14241) (#14748) 2018-06-07 20:25:26 +02:00
starkillerOG f696331563 Add general sound mode support (#14729)
* Media player: general sound mode support

* General sound mode support

* White spaces

* Add sound mode support to demo media player

* white space

* remove unnessesary code
2018-06-07 10:57:45 -04:00
Simon Nørager Sørensen 21d05a8b4d Fixes an issue in Xiaomi TV platform that would some TVs not sleep correctly (#14829) 2018-06-05 19:13:16 +02:00
quthla 1d23f7f900 Allow Kodi live streams to be recognized as paused (#14623) 2018-06-04 12:24:28 +01:00
quthla e35d4beb95 Fix media_title empty when title is empty but label is set (#14791) 2018-06-03 09:27:17 -04:00
quthla 919b431a24 Add Kodi OnResume event (#14790) 2018-06-03 09:26:23 -04:00
Tristan Caulfield e7985c970b Upgrade directpy to 0.5 (#14750)
* Version Requirement bump

Bump required version to 0.5 to allow component to work with Genie Mini clients using the clientAddr variable.

* Ran script/gen_requirements_all.py as requested.
2018-06-02 09:30:15 +02:00
Anders Melchiorsen f2a2f2cca5 Ignore unsupported Sonos favorite lists (#14665) 2018-05-29 10:15:30 +02:00
Enrico Berndt 07255a29b4 Add tv channel and volume level for philips js API 5 (#14276)
* PhilipsTV API 5: Added tv channel change and setting of volume level.

* set_volume only sets volume via api now and nothing else.
2018-05-28 10:41:51 -04:00
Oliver c050eb4100 Pushed to version 0.7.2 of denonavr (#14551) 2018-05-20 09:50:12 +02:00
Greg Laabs 5ff5c73e2b "unavailable" Media players should be considered off in Universal player (#14466)
The Universal media player inherits the states of the first child player that is not in some sort of "Off" state (including idle.) It was not considering the "unavailable" state to be off. Now it does.
2018-05-16 08:00:57 +02:00
Anders Melchiorsen 6ba49e12a2 Improve handling of offline Sonos devices (#14479) 2018-05-16 07:35:43 +02:00
Ville Skyttä 234bf1f0ea Spelling, grammar etc fixes (#14432)
* Spelling, grammar etc fixes

* s/an api data/data of an api/
2018-05-13 12:09:28 +02:00
Matthew Treinish e80628d45b Bump pycmus version (#14395)
This commit bumps the pycmus version used by the cmus component. There
was a bug in the previous version used, 1.0.0, when running in local
mode. This was caused by a mtreinish/pycmus#1 and also was reported in
the home-assistant forums (but not as an issue):

https://community.home-assistant.io/t/cant-install-cmus-component/7961

Version 0.1.1 of pycmus fixes this issue so it should work properly for
users running cmus and home-assistant on the same machine.
2018-05-12 07:51:48 +02:00
Teemu R 0f3ec94fba debug++ for multiple volume controls (#14349)
Be less noisy for those who have more volume controls than one, mentioned in #13022.
2018-05-09 13:44:42 +02:00
Mal Curtis a91c1bc668 Add zone 3 for Onkyo media player (#14295)
* Add zone 3 for Onkyo media player

* CR Updates

* Fix travis lint errors
2018-05-08 22:33:38 -04:00
Aaron Bach e7c7b9b2a9 Adds unique ID to Roku for entity registry inclusion (#14325)
* Adds unique ID to Roku for entity registry inclusion

* Owner-requested changes
2018-05-07 13:18:51 -04:00
Ron Šmeral 2e8eaf40f7 Onkyo: SUPPORT_VOLUME_STEP (#14299) 2018-05-05 17:06:32 +02:00
Jason Kingsbury 4d085882d5 Add support for max_volume (#13822)
* onkyo: add support for max volume range

* onkyo: make flake8 happy

* onkyo: fix PEP8 D205 on line 181

* onkyo: use range for max_volume configuration

* onkyo: fix line too long
2018-05-05 10:30:54 -04:00
Paulus Schoutsen 15e75b07d8 Allow fetching media player covers via websocket connection (#14233)
Lint
2018-05-03 22:03:26 +02:00