cleanup / fix typo in 'files/homeassistant.logrotate'
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
AUX hasstest 72 BLAKE2B 219dc5045193bbbf18f91d37d90072304c3f9937ac55337b692fcb03adea8e3fc63b3852b928d40b13162172d22f712feedb088d3d9b54c9b199a01c7446c865 SHA512 57491109c03926f0ab0a1cd3f55da0faac1afafc0ba405b4244652376d4da943227c17b1bf6b136dea151649cf02caf51d9aa49581addffc8ccf4c80d3c43c9c
|
||||
AUX homeassistant.conf.d 289 BLAKE2B f4a85e5a451a254a8ef39ae481275eb93b52df645d5b5c5801fee30aa548b9ccc0eacc9fb5256793d819dabe7b53f6ff5809798d0cf771464d56aae5a58332d2 SHA512 db860c0c66d0ea66eae08e62befc07d06ccea37a2ab89280328faa54ef6cc0623a65257e7806c72b1afe608e502566ca4ee8ac7de3547705ee6394184b5da110
|
||||
AUX homeassistant.init.d 922 BLAKE2B 0ff290187ca08f0a2afe011e9284f91c25722f4d2a97e4d26cf6cf06b56f66caa30c777bf1b4f7a32ebdde644a3d8b2e5c625bd86f70601548d886deb54c9a50 SHA512 78328ec822f43c04b614e63b27625c0fff75419203080b651c881ea91ea00dc32eb62273c23e3e150a5c22c952bcd86a929b10e92a0e3b24540d2ae66909216d
|
||||
AUX homeassistant.logrotate 186 BLAKE2B e68ccfa4c31af503a1c158be7839fac8b46a5587dc914089e403173be71471ec605323978ab3acda741ee64e9db4ad20245744d5b391bb4df50ae86ac0d52040 SHA512 4424d86134431f08f7cdba69177ed550d013eb9b142036d3a5e82fcaaf371a3cce835c00cca322d6d986f0e207a24e080d643368e4667689c1107bde98ec2423
|
||||
AUX homeassistant.logrotate 186 BLAKE2B 260c2260bffc1bd164499beb2d63168c1d7bf838c586f1dbd782e9d6d88ee641f187ff0ea38b587db2f8de986a0f3cf75ee170779ac218e890fb6daf520f482d SHA512 917a4a33747c195e9d7477846f846a79d56b5cce37aa0bfb417d1d9acd24a2c106d9f2d348e1f779e3ef4e778fc5fdcbea26b56c91a0d84615ea7d7f55fc2f56
|
||||
AUX homeassistant.service 261 BLAKE2B 54819aa30aa5564aca693fa2dd70ad4a9831929a33f1042542e2555fa1ec2cb5cefd746b6abc308bc970f627803279dc3caf5fbf3de5c94b3fd73760e1343a38 SHA512 83f6ba1782f844c290f349ff50bdea8d8d88d41e2f39f3f7d5a015a0f463a4c8f7328acbd3838380cf6ca78090b39ebdbeb5e3f39607b5e307c0e53ff55ee697
|
||||
AUX maxcube_TypeError_dirty_hack.patch 1460 BLAKE2B 08570971bb3ce4c120086a32ec2048796d705dd3958cf89b28e744089a51531c967c5c54f3deb9c0a39ba68d93e062550c0af44eedf464922ee55435cb01ceac SHA512 1c7a2c45a7eefe6e6cb1b9354e94a0fe0afcfa09f519f6d6237359f67545a438cccf53121850ebf5258519d0adeb3e653159d41f5aea398e5c8f7a8ed07081a5
|
||||
AUX recorder.yaml 114 BLAKE2B af04840805aa13124208584e7f1d40335905a083ee7deead5c0e4324c969f2a231c801c23e42075782950aba7535496d92747bf03efd73a80b0d07e8492d18f6 SHA512 cb4e353e54fb6dc7034569b8d62ddcdca92680c23c2c4e1ce707d21cf95e93f41a0c44521d8c3ee90b68c830f6b8e65dab82ae64bfa09727ae384550f7de0c94
|
||||
AUX socat-zwave.init.d 637 BLAKE2B d61c1024a6fe3ce8d322e62ac1ec15e00d08f5c5a63feabc8603ecc51ec16e0a4775e0c7da83d12d1ef0c9815c9ebf8ec8a86a678bb4a3b40decb04adc887f26 SHA512 2b13cd4175427853d5a4169cc7d441d62618e8136e4f5d9fd24d08a47f6916953ebd1e747ea9c7a0907b00766c7b2108ba3b8917178fd9a795da23e6525a0faf
|
||||
AUX update-homeassistant 1326 BLAKE2B 917bdd332c4e5dea5177eecd11a7f8d72b911fddfdc8e5eb54960c526fe8c735e20d44e570cf7aeb99669d2a9670c70da1c5fbc30efb284d1f0f330799de6e24 SHA512 3c05f0d6d1bde0e1526c3e679568794c07091e7856dfd8793e13feec6f22725ddaa3163ca2c81d9df86cf73573f932e561743f05de420b350a0b68f6a9582aca
|
||||
AUX yamaha.py 13403 BLAKE2B e073c1e3d4bab02e93e971cb6003705e5e82d20524204ed00f5cd4d0f8f1628419a3a0c8a50ce2e2e13a57017607e5543cfed49a3241de549c572c2012c044d7 SHA512 be6ab79a49c47ad15642ac06adc194318a2ae812cdeffa442e32303b7865b1589383386d84f57b50e942b850ffe68c1ce208d0a4c5bb70fee14f39ea77d01ef4
|
||||
DIST homeassistant-0.100.2.tar.gz 4569079 BLAKE2B 761a7e893a0b4818beacb11569d3e3ce287eb1b9f2b789ef6c61b0a3ed44810cfb05900efec8496c476e68aec5cd2915f9c106571f9c0ad254d421e7c04fb73e SHA512 36a3558715984d1e124913977b13acacdf2954f7027eb1b7bc394de1211ad56e3f5cd33147ac2942314999c4448f1e0acadd622642e6d861389c7c585294311d
|
||||
DIST homeassistant-0.100.3.tar.gz 4569043 BLAKE2B 7382c098b7e0468713add85e74e0aedd00d884fa2ee6e7d0fff1618d1e8eaa31656320033e620e9a43d46f8f6439ed10184a87ff9060e832e827f499319131bd SHA512 1495b6ded358698b42435fcdb338825fe560a76ad174bb4198cb7865275c74863daf9205746546d46b2eefb3693ebe2238770638699aad161ad1ef5350d819d6
|
||||
DIST homeassistant-0.101.1.tar.gz 4700217 BLAKE2B 0a3146f93007c89dcefc7358fae2deb59ee2055c32d7db8c0f46a554ea63bfbf2019579b56cb038c852959116504a441fe76257fecdfd84e527d5eecc815e76d SHA512 7d314a10fe519e89b5f71c356dc1e191864e36b95d0b2fd2cf8a155bba66a6c6cf689a3668438428be60434318d157e8430b426222aa98652fa2573a7421c705
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
notifempty
|
||||
missingok
|
||||
copytruncate
|
||||
su homeassistant.homeassistant
|
||||
su homeassistant homeassistant
|
||||
}
|
||||
|
||||
@@ -1,389 +0,0 @@
|
||||
"""
|
||||
Support for Yamaha Receivers.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/media_player.yamaha/
|
||||
"""
|
||||
import logging
|
||||
|
||||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
DOMAIN, MEDIA_PLAYER_SCHEMA, MEDIA_TYPE_MUSIC, PLATFORM_SCHEMA,
|
||||
SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PLAY, SUPPORT_PLAY_MEDIA,
|
||||
SUPPORT_PREVIOUS_TRACK, SUPPORT_SELECT_SOURCE, SUPPORT_STOP,
|
||||
SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET,
|
||||
SUPPORT_SELECT_SOUND_MODE, MediaPlayerDevice)
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, STATE_IDLE, STATE_OFF, STATE_ON,
|
||||
STATE_PLAYING)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['rxv==0.5.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTR_ENABLED = 'enabled'
|
||||
ATTR_PORT = 'port'
|
||||
|
||||
CONF_SOURCE_IGNORE = 'source_ignore'
|
||||
CONF_SOURCE_NAMES = 'source_names'
|
||||
CONF_ZONE_IGNORE = 'zone_ignore'
|
||||
CONF_ZONE_NAMES = 'zone_names'
|
||||
|
||||
DATA_YAMAHA = 'yamaha_known_receivers'
|
||||
DEFAULT_NAME = "Yamaha Receiver"
|
||||
|
||||
ENABLE_OUTPUT_SCHEMA = MEDIA_PLAYER_SCHEMA.extend({
|
||||
vol.Required(ATTR_ENABLED): cv.boolean,
|
||||
vol.Required(ATTR_PORT): cv.string,
|
||||
})
|
||||
|
||||
SERVICE_ENABLE_OUTPUT = 'yamaha_enable_output'
|
||||
|
||||
SUPPORT_YAMAHA = SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_SELECT_SOURCE | SUPPORT_PLAY \
|
||||
| SUPPORT_SELECT_SOUND_MODE
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
vol.Optional(CONF_HOST): cv.string,
|
||||
vol.Optional(CONF_SOURCE_IGNORE, default=[]):
|
||||
vol.All(cv.ensure_list, [cv.string]),
|
||||
vol.Optional(CONF_ZONE_IGNORE, default=[]):
|
||||
vol.All(cv.ensure_list, [cv.string]),
|
||||
vol.Optional(CONF_SOURCE_NAMES, default={}): {cv.string: cv.string},
|
||||
vol.Optional(CONF_ZONE_NAMES, default={}): {cv.string: cv.string},
|
||||
})
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Yamaha platform."""
|
||||
import rxv
|
||||
# Keep track of configured receivers so that we don't end up
|
||||
# discovering a receiver dynamically that we have static config
|
||||
# for. Map each device from its zone_id to an instance since
|
||||
# YamahaDevice is not hashable (thus not possible to add to a set).
|
||||
if hass.data.get(DATA_YAMAHA) is None:
|
||||
hass.data[DATA_YAMAHA] = {}
|
||||
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
source_ignore = config.get(CONF_SOURCE_IGNORE)
|
||||
source_names = config.get(CONF_SOURCE_NAMES)
|
||||
zone_ignore = config.get(CONF_ZONE_IGNORE)
|
||||
zone_names = config.get(CONF_ZONE_NAMES)
|
||||
|
||||
if discovery_info is not None:
|
||||
name = discovery_info.get('name')
|
||||
model = discovery_info.get('model_name')
|
||||
ctrl_url = discovery_info.get('control_url')
|
||||
desc_url = discovery_info.get('description_url')
|
||||
receivers = rxv.RXV(
|
||||
ctrl_url, model_name=model, friendly_name=name,
|
||||
unit_desc_url=desc_url).zone_controllers()
|
||||
_LOGGER.debug("Receivers: %s", receivers)
|
||||
# when we are dynamically discovered config is empty
|
||||
zone_ignore = []
|
||||
elif host is None:
|
||||
receivers = []
|
||||
for recv in rxv.find():
|
||||
receivers.extend(recv.zone_controllers())
|
||||
else:
|
||||
ctrl_url = "http://{}:80/YamahaRemoteControl/ctrl".format(host)
|
||||
receivers = rxv.RXV(ctrl_url, name).zone_controllers()
|
||||
|
||||
devices = []
|
||||
for receiver in receivers:
|
||||
if receiver.zone in zone_ignore:
|
||||
continue
|
||||
|
||||
device = YamahaDevice(
|
||||
name, receiver, source_ignore, source_names, zone_names)
|
||||
|
||||
# Only add device if it's not already added
|
||||
if device.zone_id not in hass.data[DATA_YAMAHA]:
|
||||
hass.data[DATA_YAMAHA][device.zone_id] = device
|
||||
devices.append(device)
|
||||
else:
|
||||
_LOGGER.debug("Ignoring duplicate receiver: %s", name)
|
||||
|
||||
def service_handler(service):
|
||||
"""Handle for services."""
|
||||
entity_ids = service.data.get(ATTR_ENTITY_ID)
|
||||
|
||||
devices = [device for device in hass.data[DATA_YAMAHA].values()
|
||||
if not entity_ids or device.entity_id in entity_ids]
|
||||
|
||||
for device in devices:
|
||||
port = service.data[ATTR_PORT]
|
||||
enabled = service.data[ATTR_ENABLED]
|
||||
|
||||
device.enable_output(port, enabled)
|
||||
device.schedule_update_ha_state(True)
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN, SERVICE_ENABLE_OUTPUT, service_handler,
|
||||
schema=ENABLE_OUTPUT_SCHEMA)
|
||||
|
||||
add_entities(devices)
|
||||
|
||||
|
||||
class YamahaDevice(MediaPlayerDevice):
|
||||
"""Representation of a Yamaha device."""
|
||||
|
||||
def __init__(
|
||||
self, name, receiver, source_ignore, source_names, zone_names):
|
||||
"""Initialize the Yamaha Receiver."""
|
||||
self.receiver = receiver
|
||||
self._muted = False
|
||||
self._volume = 0
|
||||
self._pwstate = STATE_OFF
|
||||
self._current_source = None
|
||||
self._sound_mode = None
|
||||
self._sound_mode_list = None
|
||||
self._source_list = None
|
||||
self._source_ignore = source_ignore or []
|
||||
self._source_names = source_names or {}
|
||||
self._zone_names = zone_names or {}
|
||||
self._reverse_mapping = None
|
||||
self._playback_support = None
|
||||
self._is_playback_supported = False
|
||||
self._play_status = None
|
||||
self._name = name
|
||||
self._zone = receiver.zone
|
||||
|
||||
def update(self):
|
||||
"""Get the latest details from the device."""
|
||||
try:
|
||||
self._play_status = self.receiver.play_status()
|
||||
except requests.exceptions.ConnectionError:
|
||||
_LOGGER.info("Receiver is offline: %s", self._name)
|
||||
return
|
||||
|
||||
if self.receiver.on:
|
||||
if self._play_status is None:
|
||||
self._pwstate = STATE_ON
|
||||
elif self._play_status.playing:
|
||||
self._pwstate = STATE_PLAYING
|
||||
else:
|
||||
self._pwstate = STATE_IDLE
|
||||
else:
|
||||
self._pwstate = STATE_OFF
|
||||
|
||||
self._muted = self.receiver.mute
|
||||
self._volume = (self.receiver.volume / 100) + 1
|
||||
|
||||
if self.source_list is None:
|
||||
self.build_source_list()
|
||||
|
||||
current_source = self.receiver.input
|
||||
self._current_source = self._source_names.get(
|
||||
current_source, current_source)
|
||||
self._playback_support = self.receiver.get_playback_support()
|
||||
self._is_playback_supported = self.receiver.is_playback_supported(
|
||||
self._current_source)
|
||||
if self._zone == "Main_Zone":
|
||||
self._sound_mode = self.receiver.surround_program
|
||||
self._sound_mode_list = self.receiver.surround_programs()
|
||||
else:
|
||||
self._sound_mode = None
|
||||
self._sound_mode_list = None
|
||||
|
||||
def build_source_list(self):
|
||||
"""Build the source list."""
|
||||
self._reverse_mapping = {alias: source for source, alias in
|
||||
self._source_names.items()}
|
||||
|
||||
self._source_list = sorted(
|
||||
self._source_names.get(source, source) for source in
|
||||
self.receiver.inputs()
|
||||
if source not in self._source_ignore)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
name = self._name
|
||||
zone_name = self._zone_names.get(self._zone, self._zone)
|
||||
if zone_name != "Main_Zone":
|
||||
# Zone will be one of Main_Zone, Zone_2, Zone_3
|
||||
name += " " + zone_name.replace('_', ' ')
|
||||
return name
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the device."""
|
||||
return self._pwstate
|
||||
|
||||
@property
|
||||
def volume_level(self):
|
||||
"""Volume level of the media player (0..1)."""
|
||||
return self._volume
|
||||
|
||||
@property
|
||||
def is_volume_muted(self):
|
||||
"""Boolean if volume is currently muted."""
|
||||
return self._muted
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
"""Return the current input source."""
|
||||
return self._current_source
|
||||
|
||||
@property
|
||||
def sound_mode(self):
|
||||
"""Return the current sound mode."""
|
||||
return self._sound_mode
|
||||
|
||||
@property
|
||||
def sound_mode_list(self):
|
||||
"""Return the current sound mode."""
|
||||
return self._sound_mode_list
|
||||
|
||||
@property
|
||||
def source_list(self):
|
||||
"""List of available input sources."""
|
||||
return self._source_list
|
||||
|
||||
@property
|
||||
def zone_id(self):
|
||||
"""Return a zone_id to ensure 1 media player per zone."""
|
||||
return '{0}:{1}'.format(self.receiver.ctrl_url, self._zone)
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag media player features that are supported."""
|
||||
supported_features = SUPPORT_YAMAHA
|
||||
|
||||
supports = self._playback_support
|
||||
mapping = {
|
||||
'play': (SUPPORT_PLAY | SUPPORT_PLAY_MEDIA),
|
||||
'pause': SUPPORT_PAUSE,
|
||||
'stop': SUPPORT_STOP,
|
||||
'skip_f': SUPPORT_NEXT_TRACK,
|
||||
'skip_r': SUPPORT_PREVIOUS_TRACK,
|
||||
}
|
||||
for attr, feature in mapping.items():
|
||||
if getattr(supports, attr, False):
|
||||
supported_features |= feature
|
||||
return supported_features
|
||||
|
||||
def turn_off(self):
|
||||
"""Turn off media player."""
|
||||
self.receiver.on = False
|
||||
|
||||
def set_volume_level(self, volume):
|
||||
"""Set volume level, range 0..1."""
|
||||
receiver_vol = 100 - (volume * 100)
|
||||
negative_receiver_vol = -receiver_vol
|
||||
self.receiver.volume = negative_receiver_vol
|
||||
|
||||
def mute_volume(self, mute):
|
||||
"""Mute (true) or unmute (false) media player."""
|
||||
self.receiver.mute = mute
|
||||
|
||||
def turn_on(self):
|
||||
"""Turn the media player on."""
|
||||
self.receiver.on = True
|
||||
self._volume = (self.receiver.volume / 100) + 1
|
||||
|
||||
def media_play(self):
|
||||
"""Send play command."""
|
||||
self._call_playback_function(self.receiver.play, "play")
|
||||
|
||||
def media_pause(self):
|
||||
"""Send pause command."""
|
||||
self._call_playback_function(self.receiver.pause, "pause")
|
||||
|
||||
def media_stop(self):
|
||||
"""Send stop command."""
|
||||
self._call_playback_function(self.receiver.stop, "stop")
|
||||
|
||||
def media_previous_track(self):
|
||||
"""Send previous track command."""
|
||||
self._call_playback_function(self.receiver.previous, "previous track")
|
||||
|
||||
def media_next_track(self):
|
||||
"""Send next track command."""
|
||||
self._call_playback_function(self.receiver.next, "next track")
|
||||
|
||||
def _call_playback_function(self, function, function_text):
|
||||
import rxv
|
||||
try:
|
||||
function()
|
||||
except rxv.exceptions.ResponseException:
|
||||
_LOGGER.warning(
|
||||
"Failed to execute %s on %s", function_text, self._name)
|
||||
|
||||
def select_source(self, source):
|
||||
"""Select input source."""
|
||||
self.receiver.input = self._reverse_mapping.get(source, source)
|
||||
|
||||
def play_media(self, media_type, media_id, **kwargs):
|
||||
"""Play media from an ID.
|
||||
|
||||
This exposes a pass through for various input sources in the
|
||||
Yamaha to direct play certain kinds of media. media_type is
|
||||
treated as the input type that we are setting, and media id is
|
||||
specific to it.
|
||||
|
||||
For the NET RADIO mediatype the format for ``media_id`` is a
|
||||
"path" in your vtuner hierarchy. For instance:
|
||||
``Bookmarks>Internet>Radio Paradise``. The separators are
|
||||
``>`` and the parts of this are navigated by name behind the
|
||||
scenes. There is a looping construct built into the yamaha
|
||||
library to do this with a fallback timeout if the vtuner
|
||||
service is unresponsive.
|
||||
|
||||
NOTE: this might take a while, because the only API interface
|
||||
for setting the net radio station emulates button pressing and
|
||||
navigating through the net radio menu hierarchy. And each sub
|
||||
menu must be fetched by the receiver from the vtuner service.
|
||||
|
||||
"""
|
||||
if media_type == "NET RADIO":
|
||||
self.receiver.net_radio(media_id)
|
||||
|
||||
def enable_output(self, port, enabled):
|
||||
"""Enable or disable an output port.."""
|
||||
self.receiver.enable_output(port, enabled)
|
||||
|
||||
def select_sound_mode(self, sound_mode):
|
||||
"""Set Sound Mode for Receiver.."""
|
||||
self.receiver.surround_program = sound_mode
|
||||
|
||||
@property
|
||||
def media_artist(self):
|
||||
"""Artist of current playing media."""
|
||||
if self._play_status is not None:
|
||||
return self._play_status.artist
|
||||
|
||||
@property
|
||||
def media_album_name(self):
|
||||
"""Album of current playing media."""
|
||||
if self._play_status is not None:
|
||||
return self._play_status.album
|
||||
|
||||
@property
|
||||
def media_content_type(self):
|
||||
"""Content type of current playing media."""
|
||||
# Loose assumption that if playback is supported, we are playing music
|
||||
if self._is_playback_supported:
|
||||
return MEDIA_TYPE_MUSIC
|
||||
return None
|
||||
|
||||
@property
|
||||
def media_title(self):
|
||||
"""Artist of current playing media."""
|
||||
if self._play_status is not None:
|
||||
song = self._play_status.song
|
||||
station = self._play_status.station
|
||||
|
||||
# If both song and station is available, print both, otherwise
|
||||
# just the one we have.
|
||||
if song and station:
|
||||
return '{}: {}'.format(station, song)
|
||||
|
||||
return song or station
|
||||
Reference in New Issue
Block a user