mirror of https://github.com/home-assistant/core
Update pysonos to 0.0.16 (#24607)
This commit is contained in:
parent
6d9f1b3fd3
commit
08e2959742
|
@ -4,7 +4,7 @@
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/components/sonos",
|
"documentation": "https://www.home-assistant.io/components/sonos",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pysonos==0.0.15"
|
"pysonos==0.0.16"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"ssdp": {
|
"ssdp": {
|
||||||
|
|
|
@ -34,8 +34,7 @@ from . import (
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
PARALLEL_UPDATES = 0
|
SCAN_INTERVAL = 10
|
||||||
|
|
||||||
DISCOVERY_INTERVAL = 60
|
DISCOVERY_INTERVAL = 60
|
||||||
|
|
||||||
# Quiet down pysonos logging to just actual problems.
|
# Quiet down pysonos logging to just actual problems.
|
||||||
|
@ -241,7 +240,7 @@ class SonosEntity(MediaPlayerDevice):
|
||||||
"""Initialize the Sonos entity."""
|
"""Initialize the Sonos entity."""
|
||||||
self._seen = None
|
self._seen = None
|
||||||
self._subscriptions = []
|
self._subscriptions = []
|
||||||
self._receives_events = False
|
self._poll_timer = None
|
||||||
self._volume_increment = 2
|
self._volume_increment = 2
|
||||||
self._unique_id = player.uid
|
self._unique_id = player.uid
|
||||||
self._player = player
|
self._player = player
|
||||||
|
@ -347,6 +346,10 @@ class SonosEntity(MediaPlayerDevice):
|
||||||
if self._seen < time.monotonic() - 2*DISCOVERY_INTERVAL:
|
if self._seen < time.monotonic() - 2*DISCOVERY_INTERVAL:
|
||||||
self._available = False
|
self._available = False
|
||||||
|
|
||||||
|
if self._poll_timer:
|
||||||
|
self._poll_timer()
|
||||||
|
self._poll_timer = None
|
||||||
|
|
||||||
def _unsub(subscriptions):
|
def _unsub(subscriptions):
|
||||||
for subscription in subscriptions:
|
for subscription in subscriptions:
|
||||||
subscription.unsubscribe()
|
subscription.unsubscribe()
|
||||||
|
@ -393,7 +396,8 @@ class SonosEntity(MediaPlayerDevice):
|
||||||
|
|
||||||
def _subscribe_to_player_events(self):
|
def _subscribe_to_player_events(self):
|
||||||
"""Add event subscriptions."""
|
"""Add event subscriptions."""
|
||||||
self._receives_events = False
|
self._poll_timer = self.hass.helpers.event.track_time_interval(
|
||||||
|
self.update, datetime.timedelta(seconds=SCAN_INTERVAL))
|
||||||
|
|
||||||
# New player available, build the current group topology
|
# New player available, build the current group topology
|
||||||
for entity in self.hass.data[DATA_SONOS].entities:
|
for entity in self.hass.data[DATA_SONOS].entities:
|
||||||
|
@ -412,9 +416,13 @@ class SonosEntity(MediaPlayerDevice):
|
||||||
subscribe(player.zoneGroupTopology, self.update_groups)
|
subscribe(player.zoneGroupTopology, self.update_groups)
|
||||||
subscribe(player.contentDirectory, self.update_content)
|
subscribe(player.contentDirectory, self.update_content)
|
||||||
|
|
||||||
def update(self):
|
@property
|
||||||
|
def should_poll(self):
|
||||||
|
"""Return that we should not be polled (we handle that internally)."""
|
||||||
|
return False
|
||||||
|
|
||||||
|
def update(self, now=None):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
if self._available and not self._receives_events:
|
|
||||||
try:
|
try:
|
||||||
self.update_groups()
|
self.update_groups()
|
||||||
self.update_volume()
|
self.update_volume()
|
||||||
|
@ -653,7 +661,10 @@ class SonosEntity(MediaPlayerDevice):
|
||||||
self.hass.data[DATA_SONOS].topology_condition.notify_all()
|
self.hass.data[DATA_SONOS].topology_condition.notify_all()
|
||||||
|
|
||||||
if event:
|
if event:
|
||||||
self._receives_events = True
|
# Cancel poll timer since we do receive events
|
||||||
|
if self._poll_timer:
|
||||||
|
self._poll_timer()
|
||||||
|
self._poll_timer = None
|
||||||
|
|
||||||
if not hasattr(event, 'zone_player_uui_ds_in_group'):
|
if not hasattr(event, 'zone_player_uui_ds_in_group'):
|
||||||
return
|
return
|
||||||
|
|
|
@ -1351,7 +1351,7 @@ pysmarty==0.8
|
||||||
pysnmp==4.4.9
|
pysnmp==4.4.9
|
||||||
|
|
||||||
# homeassistant.components.sonos
|
# homeassistant.components.sonos
|
||||||
pysonos==0.0.15
|
pysonos==0.0.16
|
||||||
|
|
||||||
# homeassistant.components.spc
|
# homeassistant.components.spc
|
||||||
pyspcwebgw==0.4.0
|
pyspcwebgw==0.4.0
|
||||||
|
|
|
@ -286,7 +286,7 @@ pysmartapp==0.3.2
|
||||||
pysmartthings==0.6.8
|
pysmartthings==0.6.8
|
||||||
|
|
||||||
# homeassistant.components.sonos
|
# homeassistant.components.sonos
|
||||||
pysonos==0.0.15
|
pysonos==0.0.16
|
||||||
|
|
||||||
# homeassistant.components.spc
|
# homeassistant.components.spc
|
||||||
pyspcwebgw==0.4.0
|
pyspcwebgw==0.4.0
|
||||||
|
|
Loading…
Reference in New Issue