mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Optimize reading of Sonos source mode (#43541)
This commit is contained in:
parent
8ab15f6867
commit
47ff04d9ad
@ -3,7 +3,7 @@
|
|||||||
"name": "Sonos",
|
"name": "Sonos",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/sonos",
|
"documentation": "https://www.home-assistant.io/integrations/sonos",
|
||||||
"requirements": ["pysonos==0.0.36"],
|
"requirements": ["pysonos==0.0.37"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"st": "urn:schemas-upnp-org:device:ZonePlayer:1"
|
"st": "urn:schemas-upnp-org:device:ZonePlayer:1"
|
||||||
|
@ -9,7 +9,13 @@ import urllib.parse
|
|||||||
import async_timeout
|
import async_timeout
|
||||||
import pysonos
|
import pysonos
|
||||||
from pysonos import alarms
|
from pysonos import alarms
|
||||||
from pysonos.core import PLAY_MODE_BY_MEANING, PLAY_MODES
|
from pysonos.core import (
|
||||||
|
PLAY_MODE_BY_MEANING,
|
||||||
|
PLAY_MODES,
|
||||||
|
PLAYING_LINE_IN,
|
||||||
|
PLAYING_RADIO,
|
||||||
|
PLAYING_TV,
|
||||||
|
)
|
||||||
from pysonos.exceptions import SoCoException, SoCoUPnPException
|
from pysonos.exceptions import SoCoException, SoCoUPnPException
|
||||||
import pysonos.music_library
|
import pysonos.music_library
|
||||||
import pysonos.snapshot
|
import pysonos.snapshot
|
||||||
@ -750,9 +756,12 @@ class SonosEntity(MediaPlayerEntity):
|
|||||||
update_position = new_status != self._status
|
update_position = new_status != self._status
|
||||||
self._status = new_status
|
self._status = new_status
|
||||||
|
|
||||||
if self.soco.is_playing_tv:
|
track_uri = variables["current_track_uri"] if variables else None
|
||||||
|
whats_playing = self.soco.whats_playing(track_uri)
|
||||||
|
|
||||||
|
if whats_playing == PLAYING_TV:
|
||||||
self.update_media_linein(SOURCE_TV)
|
self.update_media_linein(SOURCE_TV)
|
||||||
elif self.soco.is_playing_line_in:
|
elif whats_playing == PLAYING_LINE_IN:
|
||||||
self.update_media_linein(SOURCE_LINEIN)
|
self.update_media_linein(SOURCE_LINEIN)
|
||||||
else:
|
else:
|
||||||
track_info = self.soco.get_current_track_info()
|
track_info = self.soco.get_current_track_info()
|
||||||
@ -764,7 +773,7 @@ class SonosEntity(MediaPlayerEntity):
|
|||||||
self._media_album_name = track_info.get("album")
|
self._media_album_name = track_info.get("album")
|
||||||
self._media_title = track_info.get("title")
|
self._media_title = track_info.get("title")
|
||||||
|
|
||||||
if self.soco.is_radio_uri(track_info["uri"]):
|
if whats_playing == PLAYING_RADIO:
|
||||||
self.update_media_radio(variables, track_info)
|
self.update_media_radio(variables, track_info)
|
||||||
else:
|
else:
|
||||||
self.update_media_music(update_position, track_info)
|
self.update_media_music(update_position, track_info)
|
||||||
|
@ -1695,7 +1695,7 @@ pysnmp==4.4.12
|
|||||||
pysoma==0.0.10
|
pysoma==0.0.10
|
||||||
|
|
||||||
# homeassistant.components.sonos
|
# homeassistant.components.sonos
|
||||||
pysonos==0.0.36
|
pysonos==0.0.37
|
||||||
|
|
||||||
# homeassistant.components.spc
|
# homeassistant.components.spc
|
||||||
pyspcwebgw==0.4.0
|
pyspcwebgw==0.4.0
|
||||||
|
@ -845,7 +845,7 @@ pysmartthings==0.7.6
|
|||||||
pysoma==0.0.10
|
pysoma==0.0.10
|
||||||
|
|
||||||
# homeassistant.components.sonos
|
# homeassistant.components.sonos
|
||||||
pysonos==0.0.36
|
pysonos==0.0.37
|
||||||
|
|
||||||
# homeassistant.components.spc
|
# homeassistant.components.spc
|
||||||
pyspcwebgw==0.4.0
|
pyspcwebgw==0.4.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user