Adding enigma2 media player#15799
Conversation
|
@frenck docs are now added. Thanks! |
|
Thanks, @fbradyirl! Removed |
| # pylint: disable=unused-argument | ||
| def setup_platform(hass, config, add_devices, discovery_info=None): | ||
| """Setup the Enigma2 TV platform.""" | ||
| name = config.get(CONF_NAME) |
There was a problem hiding this comment.
Don't use dict.get(key) on required config keys or keys that have default values. Use dict[key].
| add_devices([Enigma2Device(name, remote_config)]) | ||
|
|
||
|
|
||
| # pylint: disable=abstract-method |
There was a problem hiding this comment.
This is already globally disabled.
| class Enigma2Device(MediaPlayerDevice): | ||
| """Representation of a Enigma2 box.""" | ||
|
|
||
| # pylint: disable=too-many-public-methods |
|
|
||
| # pylint: disable=abstract-method | ||
| class Enigma2Device(MediaPlayerDevice): | ||
| """Representation of a Enigma2 box.""" |
| def __init__(self, name, config): | ||
| """Initialize the Enigma2 device.""" | ||
| import openwebif.api | ||
| self._state = STATE_UNKNOWN |
There was a problem hiding this comment.
Init state to None. The base entity class will handle unknown state.
| def media_title(self): | ||
| """Title of current playing media.""" | ||
| if self.currservice_serviceref.startswith('1:0:0'): | ||
| return "[Recording Playback] - " + \ |
There was a problem hiding this comment.
Please use new style string formatting instead of string concatenation.
| @property | ||
| def volume_level(self): | ||
| """Volume level of the media player (0..1).""" | ||
| _LOGGER.info('self.volume : %s', self.volume) |
There was a problem hiding this comment.
Debug max. Please move this to a volume method instead, if it's really needed.
|
|
||
| def mute_volume(self, mute): | ||
| """Send mute command.""" | ||
| self.e2_box.mute_volume() |
There was a problem hiding this comment.
The mute parameter is a boolean saying if the muting should be true/on or false/off. Please implement that.
|
|
||
| def update(self): | ||
| """Update state of the media_player.""" | ||
| _LOGGER.info("Updating...") |
| vol.Required(CONF_HOST): cv.string, | ||
| vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
| vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, | ||
| vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int, |
There was a problem hiding this comment.
Is it necessary to have this configurable? We prefer to set a hardcoded sensible timeout, if possible.
|
This PR seems to have gone stale. You can open a new PR when you are ready to finish. |
Description:
Adding enigma2 media player.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5984
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: