Update enigma2 based on review comments (#21890)
* Updates based on review comments * bump netdisco and remove enigma2 init code * revert netdisco bump
This commit is contained in:
parent
b0d55d1946
commit
85dc5fe4d5
3 changed files with 9 additions and 22 deletions
|
@ -69,7 +69,7 @@ SERVICE_HANDLERS = {
|
||||||
SERVICE_HASSIO: ('hassio', None),
|
SERVICE_HASSIO: ('hassio', None),
|
||||||
SERVICE_AXIS: ('axis', None),
|
SERVICE_AXIS: ('axis', None),
|
||||||
SERVICE_APPLE_TV: ('apple_tv', None),
|
SERVICE_APPLE_TV: ('apple_tv', None),
|
||||||
SERVICE_ENIGMA2: ('enigma2', None),
|
SERVICE_ENIGMA2: ('media_player', 'enigma2'),
|
||||||
SERVICE_ROKU: ('roku', None),
|
SERVICE_ROKU: ('roku', None),
|
||||||
SERVICE_WINK: ('wink', None),
|
SERVICE_WINK: ('wink', None),
|
||||||
SERVICE_XIAOMI_GW: ('xiaomi_aqara', None),
|
SERVICE_XIAOMI_GW: ('xiaomi_aqara', None),
|
||||||
|
|
|
@ -1,18 +1 @@
|
||||||
"""Support for Enigma2 devices."""
|
"""Support for Enigma2 devices."""
|
||||||
from homeassistant.components.discovery import SERVICE_ENIGMA2
|
|
||||||
from homeassistant.helpers.discovery import load_platform
|
|
||||||
from homeassistant.helpers import discovery
|
|
||||||
|
|
||||||
DOMAIN = 'enigma2'
|
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
|
||||||
"""Set up the Enigma2 platform."""
|
|
||||||
def device_discovered(service, info):
|
|
||||||
"""Handle when an Enigma2 device has been discovered."""
|
|
||||||
load_platform(hass, 'media_player', DOMAIN, info, config)
|
|
||||||
|
|
||||||
discovery.listen(
|
|
||||||
hass, SERVICE_ENIGMA2, device_discovered)
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""Support for Enigma2 media players."""
|
"""Support for Enigma2 media players."""
|
||||||
import logging
|
import logging
|
||||||
import asyncio
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -195,8 +194,7 @@ class Enigma2Device(MediaPlayerDevice):
|
||||||
"""List of available input sources."""
|
"""List of available input sources."""
|
||||||
return self.e2_box.source_list
|
return self.e2_box.source_list
|
||||||
|
|
||||||
@asyncio.coroutine
|
def select_source(self, source):
|
||||||
def async_select_source(self, source):
|
|
||||||
"""Select input source."""
|
"""Select input source."""
|
||||||
self.e2_box.select_source(self.e2_box.sources[source])
|
self.e2_box.select_source(self.e2_box.sources[source])
|
||||||
|
|
||||||
|
@ -206,7 +204,13 @@ class Enigma2Device(MediaPlayerDevice):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes.
|
||||||
|
|
||||||
|
isRecording: Is the box currently recording.
|
||||||
|
currservice_fulldescription: Full program description.
|
||||||
|
currservice_begin: is in the format '21:00'.
|
||||||
|
currservice_end: is in the format '21:00'.
|
||||||
|
"""
|
||||||
attributes = {}
|
attributes = {}
|
||||||
if not self.e2_box.in_standby:
|
if not self.e2_box.in_standby:
|
||||||
attributes[ATTR_MEDIA_CURRENTLY_RECORDING] = \
|
attributes[ATTR_MEDIA_CURRENTLY_RECORDING] = \
|
||||||
|
|
Loading…
Add table
Reference in a new issue