Skip to content

Commit

Permalink
Expose sources_json attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
crowbarz committed Apr 30, 2021
1 parent 8838f83 commit 4ca4b3a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/pioneer_async/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,17 @@ def media_title(self):
@property
def device_state_attributes(self):
"""Return device specific state attributes."""
attrs = {}
volume = self._pioneer.volume.get(self._zone)
max_volume = self._pioneer.max_volume.get(self._zone)
pioneer = self._pioneer
attrs = {"sources_json": json.dumps(pioneer.get_source_dict())}
volume = pioneer.volume.get(self._zone)
max_volume = pioneer.max_volume.get(self._zone)
if volume is not None and max_volume is not None:
if self._zone == "1":
volume_db = volume / 2 - 80.5
else:
volume_db = volume - 81
attrs = {
**attrs,
"device_volume": volume,
"device_max_volume": max_volume,
"device_volume_db": volume_db,
Expand Down

0 comments on commit 4ca4b3a

Please sign in to comment.