Add audio input format sensor to Sonos HT devices (#60884)

This commit is contained in:
jjlawren 2021-12-03 12:06:56 -06:00 committed by GitHub
parent b61dede826
commit cbf2bf2e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 3 deletions

View file

@ -46,6 +46,7 @@ from .const import (
SCAN_INTERVAL,
SONOS_CHECK_ACTIVITY,
SONOS_CREATE_ALARM,
SONOS_CREATE_AUDIO_FORMAT_SENSOR,
SONOS_CREATE_BATTERY,
SONOS_CREATE_LEVELS,
SONOS_CREATE_MEDIA_PLAYER,
@ -240,6 +241,11 @@ class SonosSpeaker:
dispatcher_send(self.hass, SONOS_CREATE_LEVELS, self)
if audio_format := self.soco.soundbar_audio_input_format:
dispatcher_send(
self.hass, SONOS_CREATE_AUDIO_FORMAT_SENSOR, self, audio_format
)
if battery_info := fetch_battery_info_or_none(self.soco):
self.battery_info = battery_info
# Battery events can be infrequent, polling is still necessary