Skip to content

Commit

Permalink
Add ability to remove vo,ume hook. (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavoni authored Nov 6, 2023
1 parent 314aa8c commit 57f10da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "roonapi"
version = "0.1.4"
version = "0.1.5"
description = "Provides a python interface to interact with Roon"
authors = [
"Greg Dowling <[email protected]>"
Expand Down
18 changes: 18 additions & 0 deletions roonapi/roonapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,24 @@ def register_volume_control(
data = {"controls_added": [control_data]}
self._roonsocket.send_continue(self._volume_controls_request_id, data)

def unregister_volume_control(
self,
control_key,
):
"""Delete a new volume control on the api."""

if control_key not in self._volume_controls:
LOGGER.error("source_control %s is not registered!" % control_key)
return
control_data = {
"control_key": control_key,
}
del self._volume_controls[control_key]

if self._volume_controls_request_id:
data = {"controls_removed": [control_data]}
self._roonsocket.send_continue(self._volume_controls_request_id, data)

def update_volume_control(self, control_key, volume=None, mute=None):
"""Update an existing volume control, report its state to Roon."""
if control_key not in self._volume_controls:
Expand Down

0 comments on commit 57f10da

Please sign in to comment.