Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: application volume command, audio output command & audio sensor overhaul #19

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

amadeo-alex
Copy link

@amadeo-alex amadeo-alex commented Aug 4, 2023

Following PR needs to be merged "first":
#20

This PR:

  • changes AudioSensor to
    • return all audio sessions present on the device (active / inactive) with exception of system's "audiodg"
    • adds output device and session state information to each of the audio sessions
    • removes explicit device name as part of the sub-sensors names (in preparation for HA 2023.8 MQTT change)
    • include audio inputs / outputs sensors which provide a respective list of audio input and output devices
  • adds SetApplicationVolume command allowing for per application volume adjustments and mute
  • adds SetAudioOutput command which sets the default output device (due to how the CoreAudio library works this sets both multimedia & communication device)
  • fixes miscellaneous bugs

Related issues/requests: LAB02-Research/HASS.Agent#336

Example JSON payload for setting the application volume to given level and muting it:

{
  "playbackDevice": "Speakers (THX Spatial Audio)",
  "applicationName": "Discord",
  "volume": 90,
  "mute": true
}

Fragment of the in-app description:

If no "playbackDevice" is provided, HASS.Agent will use the default one.
If no "volume" is provided, HASS.Agent will set only mute status.
If no "mute" is provided, HASS.Agent will unmute the provided application.

SetAudioOutput command requires the device name as a payload.

Following screenshots are from HASS.Agent working with HA 2023.8 hence entity ID missing the device name (please do not confuse with "entity names missing the device name").

AudioSessions sensor:
obraz

AudioOutputs sensor:
obraz

AudioInputs sensor:
obraz

@amadeo-alex amadeo-alex marked this pull request as ready for review August 22, 2023 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant