* Implementation of `state_template` for the Universal media_player
* add tracking to entities in state template
* use normal config_validation
* fix tests, use defaults in platform schema, remove extra keys
* and test the new option `state_template`
* lint fixes
* no need to check attributes against None
* use `async_added_to_hass` and call `async_track_state_change` from `hass.helpers`
* add support for shuffle toggling on Spotify component.
this also required adding support for shuffle on the
media_player component.
* lint
* Use ATTR_MEDIA_SHUFFLING for service handler param
* Line too long fix
* fix tests
* add shuffle set to demo mediaplayer
* rename shuffle attribute
* Add source_list to universal media player
* Expanded attirubte and command support for UMP
Added support to the universal media player
for the following:
Volume Set
Current Source
Set Source
Current Volume
The goal is to facilitate a single-card media player
that includes source selection and setting the volume
of the receiver.
Example setup:
```
media_player:
- platform: universal
name: Media Center
children:
- media_player.kodi
- media_player.cast
commands:
select_source:
service: media_player.select_source
data:
entity_id: media_player.receiver
volume_set:
service: media_player.volume_set
data:
entity_id: media_player.receiver
volume_mute:
service: media_player.volume_mute
data:
entity_id: media_player.receiver
turn_on:
service: homeassistant.turn_on
data:
entity_id: media_player.receiver
turn_off:
service: homeassistant.turn_off
data:
entity_id: media_player.receiver
attributes:
state: media_player.receiver
is_volume_muted: media_player.receiver|is_volume_muted
volume_level: media_player.receiver|volume_level
source: media_player.receiver|source
source_list: media_player.receiver|source_list
```
* Remove print statements
* Change service call back to use call_from_config
* Modified service calls to use template data
* linting fixes
* Add tests
* linting fices
* More pylinting
* add media_player/clear_playlist and line-in/tv support to sonos
* add support source radio
* fix bug
* print TV/Line-In as media_title
* implement universal player
* add to demo platform
* Update demo.py
Better handling for demo object
* add unit tests
* fix unit test
* Replace switch with lock
* Update docstrings
* Add link to docs
* Add link to docs and update docstrings
* Update docstring
* Update docstrings and fix typos
* Add link to docs
* Add link to docs
* Add link to docs and update docstrings
* Fix link to docs and update docstrings
* Remove blank line
* Add link to docs
Sonos (SoCo) supports add_uri_to_queue capability, making it possible
to stream media available via HTTP for example. This patch extends
media_player component and sonos platform to support this feature
* Add tests to reach full coverage for helpers/state.py.
* Refactor reproduce_state function in helpers/state.py. Add two dicts,
as global constants, service_attributes and service_to_state. Use
these in combination with the dict of services per domain from
ServiceRegistry, to find the correct service to use in a scene state
change.
* Use break statement in for loop, to break if service was selected
to update state, in preference to update state attributes, ie state
update takes precedence.
* Add ATTR_CODE and ATTR_CODE_FORMAT in const. Import these in
alarm_control_panel and lock platforms instead of making duplicate
constants in multiple modules.
* Use ATTR_MEDIA_CONTENT_TYPE and ATTR_MEDIA_CONTENT_ID in media_player
platform in SERVICE_PLAY_MEDIA and play_media methods, instead of
'media_type' and 'media_id'.
* Fix PEP257 in modified files.
The universal media player contained a private method that was replaced
by the update method. It was meant to be removed and wasn’t. This
commit removed that method.
Renamed update_state method in universal media player to update so that
it would be called by HA when the state was being published. Moved the
update_ha_state to a function inside of __init__. Updated the tests
accordingly.
Forced all parsed attribute configurations to be of length 2. Removed
entity_id=None option from entity lookups. Explicitly passed entity
lookup information to _entity_lkp.
The dependencies property was only being called once by the __init__
method so it was removed and the code was moved to the __init__ method.
The tests were updated to reflect this.
The active_child_state property was unnecessary as it was not being
referenced outside the class. This commit removes it and updates the
tests accordingly.
Revised universal media player to cache the active player when updating
the state when any of the children change. Revised tests to accommodate
this change.
1) Removed children property because it was only being used by one
method.
2) Removed option to return state as object from _entity_lkp as it was
no longer needed.
3) Used hass.states.get to get entity state objects.
4) Revised test to remove children property.
Changed universal media player to use the call_from_config helper to
call services specified in the configuration file. This was done to
copy what is done in the Alexa and Automation components.