Dutch & Dutch 8C Smart Volume Control with Philips Hue Dial

Dutch & Dutch 8C active speakers have a very comprehensive web interface, also encapsulated into a phone App, that allows configuration of all the supported modes, inputs, DSP filters etc.

I wanted to be able to incorporate the speakers into my existing home automation setup, that's based on Home Assistant. So I wrote a custom component for HA that allows for control of all the basic features of the 8C: Volume, Input and Preset selection, track navigation. Github link

One thing that was still missing in my setup was a decent volume control solution, as depending on an app to control the device volume is annoying, and using multiple remotes to control volume of different devices is confusing for non-technical users.

I recently learnt about the Philips Hue Tap Dial switch, for which support has been added to Home Assistant. Since I already had a Zigbee network set up, this seemed like an ideal solution.  It provides four buttons and a rotary dial that can be hooked up to actions within HA. Someone had already written an HA Blueprint to allow the device to be easily connected up to a Media Player.



My speakers are connected via a MiniDSP SHD device, which acts as a source selector and also as volume control for TV and streaming sources. However, this doesn't work when streaming directly to the speakers via Spotify (or Roon if you have it), so you have to rely on the app to control volume.

I wanted a solution that would allow volume control to be seamless, so the Dial would control either the MiniDSP volume, or the 8C volume, depending on what was actually playing at the time, without the user having to do anything.

It turns out that this is fairly easy to accomplish using the Universal Media Player within HA. This integration creates a single virtual Media Player that's composed of multiple Media Players under the hood.   So I have one Universal Media Player that simply directs volume commands to whichever media source is appropriate. In my case, if Spotify is playing on the speakers, it controls the speakers directly, otherwise it uses the MiniDSP.  Then I have a further Universal Media Player that combines the TV with the other UMP, to provide a virtual device that can be easily controlled by the Hue Dial Blueprint and allows TV channel control, with volume control via the external device.

Here's a section of the configuration.yaml that creates these UMPs:


# Universal media player for Lounge AV. 
# Some commands are specifically done to match the Hue Dial Blueprint.
# Uses second Universal Media Player to handle MiniDSP or 8C volume
media_player:
  - platform: universal
    name: TVandDSP
    state_template: >
      {% if is_state('media_player.minidspshd', 'off') and is_state('media_player.sony_kdl_55w829b', 'off') %}
      off
      {% else %}
      on
      {% endif %}
    children:
      - media_player.sony_kdl_55w829b
      - media_player.DSPor8C
    active_child_template: >
      {% if not is_state('media_player.sony_kdl_55w829b', 'off') %}
      media_player.sony_kdl_55w829b
      {% else %}
      media_player.DSPor8C
      {% endif %}
    commands:
      turn_on:
        action: switch.turn_on
        target:
          entity_id: 
            switch.watch_tv
      turn_off:
        action: media_player.turn_off
        target:
          entity_id: 
            media_player.sony_kdl_55w829b
      media_play_pause:
        action: switch.turn_on
        target:
          entity_id: 
            switch.watch_tv
      volume_up:
        action: media_player.volume_up
        target:
          entity_id:
            media_player.DSPor8C
      volume_down:
        action: media_player.volume_down
        target:
          entity_id:
            media_player.DSPor8C
      volume_set:
        action: media_player.volume_set
        target:
          entity_id:
            media_player.DSPor8C
        data:
          volume_level: "{{volume_level}}"
      select_source:
        action: media_player.select_source
        target:
          entity_id:
            media_player.sony_kdl_55w829b
        data:
          source: "{{source}}"
      volume_mute:
        action: media_player.volume_mute
        data:
          entity_id: media_player.DSPor8C
          is_volume_muted: "{{ is_volume_muted }}"
    unique_id: TVandDSP_UID_IS_HERE
    attributes:
      is_volume_muted: media_player.DSPor8C|is_volume_muted
      volume_level: media_player.DSPor8C|volume_level
# The configuration files don't support enough templating, so we need
# to handle switching between MiniDSP and 8C volume with a second player
# that is essentially a passthrough      
  - platform: universal
    name: DSPor8C
    state_template: >
      {% if is_state('media_player.minidspshd', 'off') and is_state('media_player.8c_3012', 'off') %}
      off
      {% else %}
      on
      {% endif %}
    children:
      - media_player.minidspshd
      - media_player.8c_3012
    active_child_template: >
      {% if not is_state_attr('media_player.8c_3012', 'source', 'XLR') %}
      media_player.8c_3012
      {% else %}
      media_player.minidspshd
      {% endif %}
    unique_id: DSPor9C_UID_IS_HERE

 

Comments

Popular posts from this blog

Time Electronics 9814 IEEE-488 Interface testing

DECnet-VAX Phase V WAN connectivity with simh