Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 3 additions & 38 deletions src/wiim/wiim_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@ def _internal_handle_rendering_control_event(
self.logger.debug(
"Device %s: Internal RenderingControl event: %s", self.name, state_variables
)

self._handle_rendering_control_event(service, state_variables=state_variables)

if self.rendering_control_event_callback:
try:
self.rendering_control_event_callback(service, list(state_variables))
Expand All @@ -574,44 +577,6 @@ def _internal_handle_rendering_control_event(
exc_info=True,
)

temp_parsed_data = (
parse_last_change_event(str(state_variables[0].value), self.logger)
if state_variables and state_variables[0].name == "LastChange"
else {}
)
if "Volume" in temp_parsed_data:
vol_data = temp_parsed_data["Volume"]
if isinstance(vol_data, list) and vol_data:
master_vol = next(
(
ch_vol
for ch_vol in vol_data
if ch_vol.get("channel") == "Master"
),
None,
)
if master_vol and master_vol.get("val") is not None:
self.volume = int(master_vol.get("val"))
elif isinstance(vol_data, dict) and vol_data.get("val") is not None:
# self.volume = int(vol_data.get("val"))
val = vol_data.get("val")
self.volume = int(val) if val is not None else 0
if "Mute" in temp_parsed_data:
mute_data = temp_parsed_data["Mute"]
if isinstance(mute_data, list) and mute_data:
master_mute = next(
(
ch_mute
for ch_mute in mute_data
if ch_mute.get("channel") == "Master"
),
None,
)
if master_mute and master_mute.get("val") is not None:
self.is_muted = master_mute.get("val") == "1"
elif isinstance(mute_data, dict) and mute_data.get("val") is not None:
self.is_muted = mute_data.get("val") == "1"

def _internal_handle_play_queue_event(
self, service: UpnpService, state_variables: Sequence[UpnpStateVariable]
) -> None:
Expand Down