|
| None | __init__ (self, HomeAssistant hass, SoCo soco, dict[str, Any] speaker_info, SubscriptionBase|None zone_group_state_sub) |
| |
| SonosAlarms | alarms (self) |
| |
| None | async_check_activity (self, datetime.datetime now) |
| |
| None | async_dispatch_alarms (self, SonosEvent event) |
| |
| None | async_dispatch_device_properties (self, SonosEvent event) |
| |
| None | async_dispatch_event (self, SonosEvent event) |
| |
| None | async_dispatch_favorites (self, SonosEvent event) |
| |
| None | async_dispatch_media_update (self, SonosEvent event) |
| |
| None | async_offline (self) |
| |
| None | async_poll_battery (self, datetime.datetime|None now=None) |
| |
| None | async_rebooted (self) |
| |
| None | async_renew_failed (self, Exception exception) |
| |
| None | async_setup (self, ConfigEntry entry, bool has_battery, list[tuple[Any,...]] dispatches) |
| |
| None | async_subscribe (self) |
| |
| None | async_unsubscribe (self) |
| |
| None | async_update_battery_info (self, str more_info) |
| |
| None | async_update_device_properties (self, SonosEvent event) |
| |
| None | async_update_group_for_uid (self, str uid) |
| |
| None | async_update_groups (self, SonosEvent event) |
| |
| None | async_update_volume (self, SonosEvent event) |
| |
| None | async_vanished (self, str reason) |
| |
| None | async_write_entity_states (self) |
| |
| bool|None | charging (self) |
| |
| Coroutine | create_update_groups_coro (self, SonosEvent|None event=None) |
| |
| SonosFavorites | favorites (self) |
| |
| dict[str, Any] | fetch_battery_info (self) |
| |
| bool | is_coordinator (self) |
| |
| list[SonosSpeaker] | join (self, list[SonosSpeaker] speakers) |
| |
| None | log_subscription_result (self, Any result, str event, int level=logging.DEBUG) |
| |
| set[str] | missing_subscriptions (self) |
| |
| None | ping (self) |
| |
| PlexPlugin | plex_plugin (self) |
| |
| str|None | power_source (self) |
| |
| None | restore (self) |
| |
| None | setup (self, ConfigEntry entry) |
| |
| ShareLinkPlugin | share_link (self) |
| |
| None | snapshot (self, bool with_group) |
| |
| None | speaker_activity (self, str source) |
| |
| str | subscription_address (self) |
| |
| None | unjoin (self) |
| |
| None | update_groups (self) |
| |
| None | update_volume (self) |
| |
| None | write_entity_states (self) |
| |
Representation of a Sonos speaker.
Definition at line 92 of file speaker.py.
◆ __init__()
| None homeassistant.components.sonos.speaker.SonosSpeaker.__init__ |
( |
|
self, |
|
|
HomeAssistant |
hass, |
|
|
SoCo |
soco, |
|
|
dict[str, Any] |
speaker_info, |
|
|
SubscriptionBase | None |
zone_group_state_sub |
|
) |
| |
Initialize a SonosSpeaker.
Definition at line 95 of file speaker.py.
◆ _async_check_activity()
| None homeassistant.components.sonos.speaker.SonosSpeaker._async_check_activity |
( |
|
self | ) |
|
|
private |
Validate availability of the speaker based on recent activity.
Definition at line 632 of file speaker.py.
◆ _async_offline()
| None homeassistant.components.sonos.speaker.SonosSpeaker._async_offline |
( |
|
self | ) |
|
|
private |
Handle removal of speaker when unavailable.
Definition at line 649 of file speaker.py.
◆ _async_renew_failed()
| None homeassistant.components.sonos.speaker.SonosSpeaker._async_renew_failed |
( |
|
self, |
|
|
Exception |
exception |
|
) |
| |
|
private |
Mark the speaker as offline after a subscription renewal failure.
This is to reset the state to allow a future clean subscription attempt.
Definition at line 414 of file speaker.py.
◆ _async_subscribe()
| None homeassistant.components.sonos.speaker.SonosSpeaker._async_subscribe |
( |
|
self | ) |
|
|
private |
Create event subscriptions.
Definition at line 351 of file speaker.py.
◆ _subscribe()
| None homeassistant.components.sonos.speaker.SonosSpeaker._subscribe |
( |
|
self, |
|
|
SubscriptionBase |
target, |
|
|
Callable
|
sub_callback |
|
) |
| |
|
private |
Create a Sonos subscription.
Definition at line 383 of file speaker.py.
◆ alarms()
| SonosAlarms homeassistant.components.sonos.speaker.SonosSpeaker.alarms |
( |
|
self | ) |
|
Return the SonosAlarms instance for this household.
Definition at line 272 of file speaker.py.
◆ async_check_activity()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_check_activity |
( |
|
self, |
|
|
datetime.datetime |
now |
|
) |
| |
Validate availability of the speaker based on recent activity.
Definition at line 619 of file speaker.py.
◆ async_dispatch_alarms()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_dispatch_alarms |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Add the soco instance associated with the event to the callback.
Definition at line 450 of file speaker.py.
◆ async_dispatch_device_properties()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_dispatch_device_properties |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Update device properties from an event.
Definition at line 461 of file speaker.py.
◆ async_dispatch_event()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_dispatch_event |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Handle callback event and route as needed.
Definition at line 426 of file speaker.py.
◆ async_dispatch_favorites()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_dispatch_favorites |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Add the soco instance associated with the event to the callback.
Definition at line 484 of file speaker.py.
◆ async_dispatch_media_update()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_dispatch_media_update |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Update information about currently playing media from an event.
Definition at line 497 of file speaker.py.
◆ async_offline()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_offline |
( |
|
self | ) |
|
Handle removal of speaker when unavailable.
Definition at line 643 of file speaker.py.
◆ async_poll_battery()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_poll_battery |
( |
|
self, |
|
|
datetime.datetime | None |
now = None |
|
) |
| |
Poll the device for the current battery state.
Definition at line 769 of file speaker.py.
◆ async_rebooted()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_rebooted |
( |
|
self | ) |
|
Handle a detected speaker reboot.
Definition at line 680 of file speaker.py.
◆ async_renew_failed()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_renew_failed |
( |
|
self, |
|
|
Exception |
exception |
|
) |
| |
Handle a failed subscription renewal.
Definition at line 408 of file speaker.py.
◆ async_setup()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_setup |
( |
|
self, |
|
|
ConfigEntry |
entry, |
|
|
bool |
has_battery, |
|
|
list[tuple[Any, ...]]
|
dispatches |
|
) |
| |
Complete setup in async context.
Definition at line 181 of file speaker.py.
◆ async_subscribe()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_subscribe |
( |
|
self | ) |
|
Initiate event subscriptions under an async lock.
Definition at line 339 of file speaker.py.
◆ async_unsubscribe()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_unsubscribe |
( |
|
self | ) |
|
Cancel all subscriptions.
Definition at line 394 of file speaker.py.
◆ async_update_battery_info()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_update_battery_info |
( |
|
self, |
|
|
str |
more_info |
|
) |
| |
Update battery info using a SonosEvent payload value.
Definition at line 698 of file speaker.py.
◆ async_update_device_properties()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_update_device_properties |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Update device properties from an event.
Definition at line 470 of file speaker.py.
◆ async_update_group_for_uid()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_update_group_for_uid |
( |
|
self, |
|
|
str |
uid |
|
) |
| |
Update group topology if uid is missing.
Definition at line 797 of file speaker.py.
◆ async_update_groups()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_update_groups |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Handle callback for topology change event.
Definition at line 808 of file speaker.py.
◆ async_update_volume()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_update_volume |
( |
|
self, |
|
|
SonosEvent |
event |
|
) |
| |
Update information about currently volume settings.
Definition at line 545 of file speaker.py.
◆ async_vanished()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_vanished |
( |
|
self, |
|
|
str |
reason |
|
) |
| |
Handle removal of speaker when marked as vanished.
Definition at line 671 of file speaker.py.
◆ async_write_entity_states()
| None homeassistant.components.sonos.speaker.SonosSpeaker.async_write_entity_states |
( |
|
self | ) |
|
Write states for associated SonosEntity instances.
Definition at line 264 of file speaker.py.
◆ charging()
| bool | None homeassistant.components.sonos.speaker.SonosSpeaker.charging |
( |
|
self | ) |
|
Return the charging status of the speaker.
Definition at line 763 of file speaker.py.
◆ create_update_groups_coro()
| Coroutine homeassistant.components.sonos.speaker.SonosSpeaker.create_update_groups_coro |
( |
|
self, |
|
|
SonosEvent | None |
event = None |
|
) |
| |
Handle callback for topology change event.
Definition at line 836 of file speaker.py.
◆ favorites()
| SonosFavorites homeassistant.components.sonos.speaker.SonosSpeaker.favorites |
( |
|
self | ) |
|
Return the SonosFavorites instance for this household.
Definition at line 277 of file speaker.py.
◆ fetch_battery_info()
| dict[str, Any] homeassistant.components.sonos.speaker.SonosSpeaker.fetch_battery_info |
( |
|
self | ) |
|
Fetch battery_info for the speaker.
Definition at line 690 of file speaker.py.
◆ is_coordinator()
| bool homeassistant.components.sonos.speaker.SonosSpeaker.is_coordinator |
( |
|
self | ) |
|
Return true if player is a coordinator.
Definition at line 282 of file speaker.py.
◆ join()
Form a group with other players.
Definition at line 944 of file speaker.py.
◆ join_multi()
Form a group with other players.
Definition at line 962 of file speaker.py.
◆ log_subscription_result()
| None homeassistant.components.sonos.speaker.SonosSpeaker.log_subscription_result |
( |
|
self, |
|
|
Any |
result, |
|
|
str |
event, |
|
|
int |
level = logging.DEBUG |
|
) |
| |
Log a message if a subscription action (create/renew/stop) results in an exception.
Definition at line 316 of file speaker.py.
◆ missing_subscriptions()
| set[str] homeassistant.components.sonos.speaker.SonosSpeaker.missing_subscriptions |
( |
|
self | ) |
|
Return a list of missing service subscriptions.
Definition at line 308 of file speaker.py.
◆ ping()
| None homeassistant.components.sonos.speaker.SonosSpeaker.ping |
( |
|
self | ) |
|
Test device availability. Failure will raise SonosUpdateError.
Definition at line 590 of file speaker.py.
◆ plex_plugin()
| PlexPlugin homeassistant.components.sonos.speaker.SonosSpeaker.plex_plugin |
( |
|
self | ) |
|
Cache the PlexPlugin instance for this speaker.
Definition at line 287 of file speaker.py.
◆ power_source()
| str | None homeassistant.components.sonos.speaker.SonosSpeaker.power_source |
( |
|
self | ) |
|
Return the name of the current power source.
Observed to be either BATTERY or SONOS_CHARGING_RING or USB_POWER.
May be an empty dict if used with an S1 Move.
Definition at line 753 of file speaker.py.
◆ restore()
| None homeassistant.components.sonos.speaker.SonosSpeaker.restore |
( |
|
self | ) |
|
Restore a snapshotted state to a player.
Definition at line 1030 of file speaker.py.
◆ restore_multi()
| None homeassistant.components.sonos.speaker.SonosSpeaker.restore_multi |
( |
HomeAssistant |
hass, |
|
|
list[SonosSpeaker] |
speakers, |
|
|
bool
|
with_group |
|
) |
| |
|
static |
Restore snapshots for all the speakers.
Definition at line 1043 of file speaker.py.
◆ setup()
| None homeassistant.components.sonos.speaker.SonosSpeaker.setup |
( |
|
self, |
|
|
ConfigEntry |
entry |
|
) |
| |
Run initial setup of the speaker.
Definition at line 219 of file speaker.py.
◆ share_link()
| ShareLinkPlugin homeassistant.components.sonos.speaker.SonosSpeaker.share_link |
( |
|
self | ) |
|
Cache the ShareLinkPlugin instance for this speaker.
Definition at line 294 of file speaker.py.
◆ snapshot()
| None homeassistant.components.sonos.speaker.SonosSpeaker.snapshot |
( |
|
self, |
|
|
bool |
with_group |
|
) |
| |
Snapshot the state of a player.
Definition at line 1000 of file speaker.py.
◆ snapshot_multi()
| None homeassistant.components.sonos.speaker.SonosSpeaker.snapshot_multi |
( |
HomeAssistant |
hass, |
|
|
list[SonosSpeaker] |
speakers, |
|
|
bool
|
with_group |
|
) |
| |
|
static |
Snapshot all the speakers and optionally their groups.
Definition at line 1010 of file speaker.py.
◆ speaker_activity()
| None homeassistant.components.sonos.speaker.SonosSpeaker.speaker_activity |
( |
|
self, |
|
|
str |
source |
|
) |
| |
Track the last activity on this speaker, set availability and resubscribe.
Definition at line 597 of file speaker.py.
◆ subscription_address()
| str homeassistant.components.sonos.speaker.SonosSpeaker.subscription_address |
( |
|
self | ) |
|
Return the current subscription callback address.
Definition at line 301 of file speaker.py.
◆ unjoin()
| None homeassistant.components.sonos.speaker.SonosSpeaker.unjoin |
( |
|
self | ) |
|
Unjoin the player from a group.
Definition at line 975 of file speaker.py.
◆ unjoin_multi()
Unjoin several players from their group.
Definition at line 983 of file speaker.py.
◆ update_groups()
| None homeassistant.components.sonos.speaker.SonosSpeaker.update_groups |
( |
|
self | ) |
|
Update group topology when polling.
Definition at line 792 of file speaker.py.
◆ update_volume()
| None homeassistant.components.sonos.speaker.SonosSpeaker.update_volume |
( |
|
self | ) |
|
Update information about current volume settings.
Definition at line 1165 of file speaker.py.
◆ wait_for_groups()
| None homeassistant.components.sonos.speaker.SonosSpeaker.wait_for_groups |
( |
HomeAssistant |
hass, |
|
|
list[list[SonosSpeaker]]
|
groups |
|
) |
| |
|
static |
Wait until all groups are present, or timeout.
Definition at line 1130 of file speaker.py.
◆ write_entity_states()
| None homeassistant.components.sonos.speaker.SonosSpeaker.write_entity_states |
( |
|
self | ) |
|
Write states for associated SonosEntity instances.
Definition at line 259 of file speaker.py.
◆ _battery_poll_timer
| homeassistant.components.sonos.speaker.SonosSpeaker._battery_poll_timer |
|
private |
◆ _event_dispatchers
| dictionary homeassistant.components.sonos.speaker.SonosSpeaker._event_dispatchers |
|
staticprivate |
Initial value:= {
"AlarmClock": async_dispatch_alarms,
"AVTransport": async_dispatch_media_update,
"ContentDirectory": async_dispatch_favorites,
"DeviceProperties": async_dispatch_device_properties,
"RenderingControl": async_update_volume,
"ZoneGroupTopology": async_update_groups,
}
Definition at line 1170 of file speaker.py.
◆ _last_activity
| homeassistant.components.sonos.speaker.SonosSpeaker._last_activity |
|
private |
◆ _last_battery_event
| homeassistant.components.sonos.speaker.SonosSpeaker._last_battery_event |
|
private |
◆ _plex_plugin
| homeassistant.components.sonos.speaker.SonosSpeaker._plex_plugin |
|
private |
◆ _poll_timer
| homeassistant.components.sonos.speaker.SonosSpeaker._poll_timer |
|
private |
◆ _resub_cooldown_expires_at
| homeassistant.components.sonos.speaker.SonosSpeaker._resub_cooldown_expires_at |
|
private |
◆ _share_link_plugin
| homeassistant.components.sonos.speaker.SonosSpeaker._share_link_plugin |
|
private |
◆ _subscription_lock
| homeassistant.components.sonos.speaker.SonosSpeaker._subscription_lock |
|
private |
◆ _subscriptions
| homeassistant.components.sonos.speaker.SonosSpeaker._subscriptions |
|
private |
◆ available
| homeassistant.components.sonos.speaker.SonosSpeaker.available |
◆ balance
| homeassistant.components.sonos.speaker.SonosSpeaker.balance |
◆ battery_info
| homeassistant.components.sonos.speaker.SonosSpeaker.battery_info |
◆ coordinator
| homeassistant.components.sonos.speaker.SonosSpeaker.coordinator |
◆ cross_fade
| homeassistant.components.sonos.speaker.SonosSpeaker.cross_fade |
◆ hass
| homeassistant.components.sonos.speaker.SonosSpeaker.hass |
◆ loudness
| homeassistant.components.sonos.speaker.SonosSpeaker.loudness |
◆ media
| homeassistant.components.sonos.speaker.SonosSpeaker.media |
◆ mic_enabled
| homeassistant.components.sonos.speaker.SonosSpeaker.mic_enabled |
◆ muted
| homeassistant.components.sonos.speaker.SonosSpeaker.muted |
◆ snapshot_group
| homeassistant.components.sonos.speaker.SonosSpeaker.snapshot_group |
◆ soco
| homeassistant.components.sonos.speaker.SonosSpeaker.soco |
◆ soco_snapshot
| homeassistant.components.sonos.speaker.SonosSpeaker.soco_snapshot |
◆ sonos_group
| homeassistant.components.sonos.speaker.SonosSpeaker.sonos_group |
◆ sonos_group_entities
| homeassistant.components.sonos.speaker.SonosSpeaker.sonos_group_entities |
◆ volume
| homeassistant.components.sonos.speaker.SonosSpeaker.volume |
◆ websocket
| homeassistant.components.sonos.speaker.SonosSpeaker.websocket |
The documentation for this class was generated from the following file: