home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.97k stars 29.05k forks source link

Vizio: KeyError: 'mute' error thrown when updating device information #34730

Closed zachowj closed 4 years ago

zachowj commented 4 years ago

The problem

When a device added from the Vizio integration goes to update its device information it is attempting to access a dictionary key that doesn't exist.

Environment

Problem-relevant configuration.yaml

Traceback/Error logs

2020-04-25 17:30:35 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.vizio_tv fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/vizio/media_player.py", line 203, in async_update
    self._is_muted = audio_settings["mute"].lower() == "on"
KeyError: 'mute'

Additional information

Here's is the audio_settings dictionary output for my TV. Even when the tv is muted there still is no mute key.

{'tv_speakers': 'Auto', 'volume_control_display': 'Off', 'surround_sound': 'Off', 'volume_leveling': 'On', 'balance': 0, 'lip_sync': 1, 'digital_audio_out': 'Auto', 'analog_audio_out': 'Fixed', 'volume': 63}
probot-home-assistant[bot] commented 4 years ago

Hey there @raman325, mind taking a look at this issue as its been labeled with a integration (vizio) you are listed as a codeowner for? Thanks!

raman325 commented 4 years ago

@zachowj thanks for sharing the audio_settings dictionary. It appears some, but not all, TVs have this mute property. I will push a fix out soon.

raman325 commented 4 years ago

@zachowj this should get released as part of 0.109.2