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.
This commit is contained in:
parent
144bb3492a
commit
07255a29b4
2 changed files with 13 additions and 9 deletions
|
@ -13,20 +13,22 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.components.media_player import (
|
||||
PLATFORM_SCHEMA, SUPPORT_NEXT_TRACK, SUPPORT_PREVIOUS_TRACK,
|
||||
SUPPORT_SELECT_SOURCE, SUPPORT_TURN_OFF, SUPPORT_TURN_ON,
|
||||
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_STEP, SUPPORT_PLAY, MediaPlayerDevice)
|
||||
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_STEP,
|
||||
SUPPORT_PLAY, MediaPlayerDevice)
|
||||
from homeassistant.const import (
|
||||
CONF_HOST, CONF_NAME, CONF_API_VERSION, STATE_OFF, STATE_ON, STATE_UNKNOWN)
|
||||
from homeassistant.helpers.script import Script
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
REQUIREMENTS = ['ha-philipsjs==0.0.3']
|
||||
REQUIREMENTS = ['ha-philipsjs==0.0.4']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
|
||||
|
||||
SUPPORT_PHILIPS_JS = SUPPORT_TURN_OFF | SUPPORT_VOLUME_STEP | \
|
||||
SUPPORT_VOLUME_MUTE | SUPPORT_SELECT_SOURCE
|
||||
SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||
SUPPORT_SELECT_SOURCE
|
||||
|
||||
SUPPORT_PHILIPS_JS_TV = SUPPORT_PHILIPS_JS | SUPPORT_NEXT_TRACK | \
|
||||
SUPPORT_PREVIOUS_TRACK | SUPPORT_PLAY
|
||||
|
@ -165,6 +167,10 @@ class PhilipsTV(MediaPlayerDevice):
|
|||
if not self._tv.on:
|
||||
self._state = STATE_OFF
|
||||
|
||||
def set_volume_level(self, volume):
|
||||
"""Set volume level, range 0..1."""
|
||||
self._tv.setVolume(volume)
|
||||
|
||||
def media_previous_track(self):
|
||||
"""Send rewind command."""
|
||||
self._tv.sendKey('Previous')
|
||||
|
@ -189,12 +195,10 @@ class PhilipsTV(MediaPlayerDevice):
|
|||
self._volume = self._tv.volume
|
||||
self._muted = self._tv.muted
|
||||
if self._tv.source_id:
|
||||
src = self._tv.sources.get(self._tv.source_id, None)
|
||||
if src:
|
||||
self._source = src.get('name', None)
|
||||
self._source = self._tv.getSourceName(self._tv.source_id)
|
||||
if self._tv.sources and not self._source_list:
|
||||
for srcid in sorted(self._tv.sources):
|
||||
srcname = self._tv.sources.get(srcid, dict()).get('name', None)
|
||||
for srcid in self._tv.sources:
|
||||
srcname = self._tv.getSourceName(srcid)
|
||||
self._source_list.append(srcname)
|
||||
self._source_mapping[srcname] = srcid
|
||||
if self._tv.on:
|
||||
|
|
|
@ -368,7 +368,7 @@ gstreamer-player==1.1.0
|
|||
ha-ffmpeg==1.9
|
||||
|
||||
# homeassistant.components.media_player.philips_js
|
||||
ha-philipsjs==0.0.3
|
||||
ha-philipsjs==0.0.4
|
||||
|
||||
# homeassistant.components.sensor.geo_rss_events
|
||||
haversine==0.4.5
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue