* 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.